Sunday, April 10, 2016

Set different sorting direction for a Category

In here following code can be used for 2 purposes.
  1. Set default direction of the Sorting on a particular Category
  2. Disable parameter memorizing and reset sorting when moving to different Category
NOTE:
Following options will NOT work when Full Page Cache (FPC) is enabled in Enterprise version.
This issue will address on different blog post.

Option 01:
Put the following code either in local.xml or catalog.xml

<layout version="0.1.0">
    <default>
        <catalog_category_default translate="label">
            <reference name="product_list_toolbar">
                <action method="setDefaultDirection"><string>desc</string></action>
                <action method="disableParamsMemorizing" />
            </reference>
        </catalog_category_default>
    </default>
</layout>


Option 02:
Go to Catalog => Categories and select the Category you want to set default direction. Under "Custom Design => Custom Layout Update" add the following content.
<reference name="product_list_toolbar">
    <action method="setDefaultDirection"><string>desc</string></action>
    <action method="disableParamsMemorizing" />
</reference>