1

I am using a bundle product say Samsung Mobile in my website for which i have added a bundle item called free gift. This free gift can be any simple product like a Sony memory card.

Now, i am facing a situation where in the navigation filter i am getting the filters for not only the bundled product but also for the simple product attached to it. For eg, Samsung Mobile is having an attribute called brand for which the value is Samsung but the memory card which is the bundle item attached to it is also having an attribute brand for which the value is Sony. I do not want Sony to be in the filters as that is referring to the free gift product attribute.

Upon digging up the code for layer navigation, i found out that While reindexing Magento saves the attributes of the children products to the parent product as well in the table "catalog_product_index_eav".

I need to edit the code where the system saves the bundle items attributes to the parent product but unable to find the code for it. Is there any observer that i can use to achieve this? I only need to customize the reindexing part for the process "Product Attributes".

3

The code is in Mage_Catalog_Model_Resource_Product_Indexer_Eav_Abstract::_prepareRelationIndex() (See also: Inconsistent product attribute index: Duplicate entries in catalog_product_index_eav)

But I would advice against fiddling with the indexer when there is a simpler solution to your original problem "Add free gift to a product": Don't use bundles, add the gift with a shopping cart price rule instead.

You still need a bit of customization if the gift should be added automatically together with the main product, but there's already a free extension for this: https://github.com/code4business/freeproduct (Disclaimer: I was involved in the development)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.