You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.
I am attempting to merge the and forms in order to make it possible to select both the main product any related products together on the product listing pages in a single form process, - it should not be difficult, - studying the form layouts there is little difference between them (save for a wishlist button on the form), and they both submit to the process in just the same way.
So I currently have the following (stripped form process - none too pretty at the moment, but I am just trying to get it working at this stage):
<?php $app = $this->globals('khxc_display.app'); $ns = $this->globals('khxc.namespace'); $ref = $this->globals('khxc.ref'); $eol = $this->globals('khxc.eol'); $prod = $this->globals('ecom.prod_prodlist'); $prodid = $prod['prodid']; $product = $this->globals('ecom.prod_proddetail'); $formid = $app . '--prodaddtocartM--' . $product; $this->xhtml_quickform_header($formid,$app,'addcart'); $add_ok = 1; if (($prod['useinv']) && (!($prod['invlevel'] > 0))) {$add_ok = 0;} if ($prod['pricestatus'] == 'D') {$add_ok = 0;} $quandisp = 1; $quanform = $this->globals('khxc_cgi.' . $formid . '--' . $prodid . '--quantity'); if (isset($quanform)) {$quandisp = $quanform;} if ($add_ok) { print '<label for="' . $formid . '--' . $prodid . '--quantity'; print '" class="hidden">Quantity</label>' . $eol; print '<input class="khxc_formfield_box" type="checkbox" name="'; print $formid . '--' . $prodid . '--quantity'; print '" id="' . $formid . '--' . $prodid . '--quantity'; print '" value="' . $quandisp . '" size="5" maxlength="5" /> <span style="font-style: normal; display: inline-block; color: black; font-size: 0.7em; font-weight: bold;">Click Box To Select<br />...Then Add To Purchase List</span>' . $eol; } else { print '<label for="' . $formid . '--' . $prodid . '--quantity'; print '" class="hidden">Quantity</label>' . $eol; print '<p class="hidden"><input type="hidden" name="'; print $formid . '--' . $prodid . '--quantity'; print '" id="' . $formid . '--' . $prodid . '--quantity'; print '" value="' . $quandisp . '" /></p>' . $eol; } // End of if statement. $this->xhtml_quickform_footer($formid,'Add To Purchase List',1); ?>
The problem is that no matter how I change the code around I cannot get this working. - I have not started testing on the multi-add side of things within the area yet, but the main buttons, whilst working, do not add anything to the cart or wishlist. - They just generate the following error in debug:
GBU_Cart::addcart_internal: Product information not supplied. Printing error and returning. GBU_Cart::print_message: Printing message 'carterrrnc' for application 'gbu0'.
I have tried working around this by modifying the , as can be seen above, but to no avail. Also, I cannot be certain at this stage, least not until I can get this first part working, whether or not this actually will add the main item any selected related items to the cart or whether it will still require that the two be selected and added seperately (which is how it is by default, how it is at the moment in our webstore, and not what I want). Can someone help with this, please?
Last edited by Design_Wholesale (02-09-2011 03:25:36)
Offline
Well, once again I've completely confounded support with this one (no replies even after a couple of days) ...
Fortunately, I have managed to hack the form myself to create a solution for others, like myself, who are fed up with not being able to have a combined form for items and related items .
First off, there is no saying what this might or will do to your webstore - at the moment webstore is still working...
Secondly you will need to modify the for your items () in order to remove the existing button code (only those parts for the and buttons, the following section (which is normally right at the end of the script)]
<?php // +-- // | Print the product options if we can add the item to the // | shopping cart or wish list and we're on the prodshow // | namespace. // +-- $add_ok = 1; if (($proddisp['useinv']) && (!($proddisp['invlevel'] > 0))) {$add_ok = 0;} if ($proddisp['pricestatus'] == 'D') {$add_ok = 0;} if (($ns == 'prodshow') && ($add_ok)) { $this->include_namespace($app,'prodshowopt',array()); } // End of if statement. ?>
Thirdly, modify {private} (or ) where you have this section:
// +-- // | We may need to do a multi-add display if that global is set. // +-- if ($this->globals('ecom.prod_multiadd')) { $this->KHXC_Display->include_file($this->app,'prodmulti.php'); if ($this->debug) {$this->debugger("prodlist: Finished product listing (multi-add). App: {$this->app}");} } else { $this->KHXC_Display->include_file($this->app,'prodlist.php'); if ($this->debug) {$this->debugger("prodlist: Finished product listing (regular). App: {$this->app}");} } // End of if statement.
to this:
// +-- // | We may need to do a multi-add display if that global is set. - **AMENDED TO ALWAYS SHOW MULTIADD** // +-- $this->KHXC_Display->include_file($this->app,'prodmulti.php'); if ($this->debug) {$this->debugger("prodlist: Finished product listing (multi-add). App: {$this->app}");}
Lastly (and this will overwrite any existing related product entries in your product listings - there may be a MySQL string function for appending this rather than doing an outright overwrite, but I am not sure what it is at present) do a raw MySQL statement like:
UPDATE `gbu0_prod` SET xprod = id;
or
UPDATE `ccp0_prod` SET xprod = id;
If all went as it should your webstore will hopefully still be working, and you will now have each and every item in the namespace ( all your product listings) displaying with no buttons and a duplicate underneath that can be added to a customer's basket or wishlist. Further, if you add related products to that product's listing details, these, too, will be displayed in that section ...and will be addable(???) (watch out Shakespeare... ) to your basket or wishlist.
Last edited by Design_Wholesale (02-10-2011 07:58:49)
Offline
This can also be further modified by enclosing the old button code in an if statement in your product listing template to make the product multiadd display only be used if there are related products to display, so something like:
if (empty($xprod)) { BUTTON CODE HERE } // End of if statement
There will be no risk of the prodmulti display being seen, because that will remain hidden unless a product has related products, but don't forget the required variable(s) for the above if implementing something like that.
Offline