Magento 'Sort By' - How to make Magento forget which option was selected

Please LogIn to Reply!

Post By: admin | 26-01-2012 06:35 Reply

Something that I have not noticed before is that Magento will remember which option you've selected to 'Sort By' on category list pages. So if you go to a category page, and lets say the default sort is ordered by price, if you change the sort to be ordered by name instead, the page reloads and all is well.

However, if you remove the get variable(s) in the URL and reload the page, it still sorts by name instead of reverting back to price.

I was thinking this was a problem specific to the site I'm working on, as there are some custom things happening with collection building and sorting and such, but I've now checked a handful of other Magento sites (some of which I found at random on the web) and they all do the same thing.

Does anyone know how this is being 'remembered'? Is this stored in user's session? I would think it's part of caching, but this site is still in development and thus caching is disabled.

It's not that big of a deal, but it does seem like a bug.

The sort order parameter is stored in session. See Mage_Catalog_Block_Product_List_Toolbar::getCurrentOrder method. You can switch it off by calling Mage_Catalog_Block_Product_List_Toolbar::disableParamsMemorizing method or by setting params_memorize_allowed in catalog session. I mean Mage::getSingleton('catalog/session')->setParamsMemorizeAllowed(true)

`Reply Or Comment!
Please LogIn to Reply!