Search code examples
magentocomparelimitproductmax

Magento Products Comparison limit


I need to limit the number of products added to compare in Magento. Only wanted to have a maximum of 4 products to be compared.

I'm thinking of doing it in the .phtml (where item display looping is) but have no idea where I should edit to display the message "Compare list is full". Any idea?

Thanks!


Solution

  • compare items are added in Mage_Catalog_Product_CompareController and you can see that there are events dispatched that you can hook your observer to or you can add your limits by extending Mage_Catalog_Model_Product_Compare_List and overriding addProduct() or addProducts() methods or even make this in collection classes