Question

We have customized bundles to add mandatory custom options to the bundle items. Problem is, if you edit a bundle from cart the changed custom options on bundle-item level is not recognized by the standard compare function, as this function currently does not know about this customization.

Procedure:

  1. Select bundle and make the selections.
  2. Add bundle to cart.
  3. In cart press edit in bundle line.
  4. Magento opens the configure id and you can change the bundle.
  5. Change a custom option on bundle-item level.
  6. Press "update cart".
  7. If just a custom option was changed, Magento does not recognize the change.

Questions:

Which function/source compares current bundle with bundle in cart if something was changed and a update of the existing bundle in cart is necessary.

Was it helpful?

Solution

Take a look at Mage_Sales_Model_Quote_Item::representProduct($product).

It compares a quote item with a configured product (i.e. custom options, bundle options etc. are set) that would be added to the cart and returns true if it is considered the same item. In that case, Mage_Sales_Quote::updateItem() only updates the qty.

Note that you should not change anything in this method, just understand how it works. As soon as your own "custom options" are really saved as custom options (as Magento knows them) in the quote item, it will work.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top