Tuesday, November 6, 2012

Change default sort by order for one category in Magento


>> If you want to change default sort by value "position" to "name", change admin category setting. see the screen-shot.

   

    you can change default direction by providing the following code in Custom Layout Update section in admin category "Custom Design" Tab
    <reference name="product_list_toolbar">
          <action method="setDefaultDirection"><dir>desc</dir></action>
    </reference>

>> Add "created_at" in sort by dropdown.


    update eav_attribute set frontend_label = "Date" where attribute_code = "created_at" AND entity_type_id = 4; // Ensure about the entity_type_id
    update catalog_eav_attribute set used_for_sort_by = 1 where attribute_id = (select attribute_id from eav_attribute where attribute_code = "created_at" AND entity_type_id = 4);
   
    Now You can see the Date in admin default sort by configuration.
    Admin=>System=>Configuration=>Catalog=>Frontend=> change value here "Product Listing Sort by"

>> If you want to add another attribute, go to the attribute setting and set "yes" for use for default sort by, see the screen-shot.

    Admin=>Attributes=>Manage Attributes




No comments:

Post a Comment