When a bundled product has custom options like a textfield and you add 1combination of the bundled product to the cart, THEN add the same combination but with a different text in the custom option field, the cart doesn’t show the second bundled poduct as it should. It adds the second bundled product, but also the simple products you selected as a single cart item.
how to re-produce:
1) Create a bundled product with a fixed price.
- add a custom option (eg: textfield)
- add atleast one bundled item.
2) Add the bundled product to cart - select the bundled item and type “test” for the custom option.
everything looks okay in cart
3) add the bundled product again - select the same bundled item and type “test 2” for the custom option.
stuff goes wrong! the simple product of the bunded product are shown. then the bundled product is shown again.
I currently don’t have a workarround. I found that when you change the quantity to add to the cart of the second bundled product to something else as the first bundled product, things work correct as expected.
somebody an idea on how to fix this?
except for this showstopper i love magento, thanks for the hard work and open sourcing it!
Since you guys seem to be dealing with Bundle Items like I am, I thought I would post my problem here.
The items of my Bundled Product are no longer showing up as a list in the cart (see first image attachment). They use to look like my second image attachment. As you can see, the included options of my Bundle no longer show in the cart. This is a big problem.
I really need customers to be able to see what they just spent time configuring. If anyone can guide me how to fix this, that would be great.
I think I the code involved may be located in default/template/checkout/onepage/review/item.phtml, but I’m not sure? The code that I think needs modification looks like this, but then again, I’m not sure if I’ve tracked down the right code?
That’s not the right file, you probably want:
template/checkout/cart/item/default.phtml
This has the loop that iterates through all the options (both bundled products and normal product options). In your screenshot it looks like either that entire file is being skipped or all options have been missed from the product model.
If this was working previously its most likely:
1) a problem in your layout xml file (probably bundle.xml or checkout.xml)
2) the phtml file that calls default.phtml has been changed
3) or possibly the entire bundle products module has been disabled - although you wouldn’t be able to add it to the cart in the first place if that was the case!
If you are missing custom options for non-bundle products as well then it will probably be something in checkout.xml or template/checkout/cart.phtml
The only thing to do is slowly chase through the files!
If you haven’t already turn on template path hints so you can at least get close to the block that’s causing the problem (System > Configuration > Developer > (pick a website) > Debug > Template Path Hints). Remember, if this is live store visitors will see your template path hints as well unless you restrict them to your IP address.
Just following up, I think I found a solution finally…
In /app/code/core/Mage/Sales/Model/Quote.php on line 783, change getAllItems() to getAllVisibleItems(). This should make it grab only the parent (bundle) products.
Note: You should obviously do this under the ‘local’ directory or create a module.
This seems to work for version 1.4.1, but haven’t seen any side effects yet.
The 1.4.x versions I am looking at contain “getAllItems()” on a number of lines in that file, but not on line 783. Could you post the context of the code that needs changing please?
Sorry, for version 1.4.1 the line number should be 774 under the function getItemByProduct().
It should then be:
public function getItemByProduct($product) { foreach ($this->getAllVisibleItems() as $item) { if ($item->representProduct($product)) { return $item; } } return false; }
Edit: Sorry, this “fix” causes other bundles to double when adding them to the cart and therefore will not work. Will keep trying.
Well, I wish I could say that the problem was completely resolved. It appears though that the side effects of this is the bundle id gets confused and added the the first product to cart.
Update _addCatalogProduct function above to
protected function _addCatalogProduct(Mage_Catalog_Model_Product $product, $qty=1) { $item = $this->getItemByProduct($product); if (!$item || $item->getParentItemId()) { $item = Mage::getModel('sales/quote_item'); $item->setQuote($this); if (Mage::app()->getStore()->isAdmin()) { $item->setStoreId($this->getStore()->getId()); } else { $item->setStoreId(Mage::app()->getStore()->getId()); } }
/** * We can't modify existing child items */ if ($item->getId() && $product->getParentProductId()) { return $item; }
try { $this->getProduct()->getTypeInstance(true)->checkProductBuyState($this->getProduct()); } catch (Mage_Core_Exception $e) { $this->setHasError(true); $this->setMessage($e->getMessage()); $this->getQuote()->setHasError(true); $this->getQuote()->addMessage( Mage::helper('sales')->__('Some of the products below do not have all the required options. Please remove them and add again with all the required options.') ); } catch (Exception $e) { $this->setHasError(true); $this->setMessage(Mage::helper('sales')->__('Item options declaration error.')); $this->getQuote()->setHasError(true); $this->getQuote()->addMessage(Mage::helper('sales')->__('Items options declaration error.')); }
The above fixes issue of adding 2 or more to cart or selecting different bundle options on the particular bundle item and fixes the bundle custom options.