I want to be able to have the comparison "basket" clear itself when I navigate away from one category to another.
Is this possible? I searched via Google and could not find anyone asking about this kind of feature.
I want to be able to have the comparison "basket" clear itself when I navigate away from one category to another.
Is this possible? I searched via Google and could not find anyone asking about this kind of feature.
It definitely is possible, here are the steps I would take:
1) When user visits ANY category store the category id in the session (you can do this by looking at this question How do I save value in my own session variable in Magento? )
2) Before the category is stored in Magento's session variable check if it is already set, if it is, compare it to the current id
3) If it's different get all the current items in the compare block (you need to get the block Mage_Catalog_Block_Product_Compare_List and call the getItems() function to get an array of items)
4) Remove the products from the block (you need to get the Mage_Catalog_Model_Product_Compare_List model and call the removeProduct function)
If you need further assistance let us know