Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Sort by Date
 
GuyGadbois
Jr. Member
 
Avatar
Total Posts:  10
Joined:  2008-12-04
 

I am trying to add Date as a sort option in the product list toolbar on 1.3.0, noticed some changes in Toolbar.php and added the following in catalog.xml:

<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
    <
action method="addOrderToAvailableOrders"><order>created_at</order><value>Date</value></action>
    <
action method="setDefaultOrder"><field>created_at</field></action>
    <
action method="setDefaultDirection"><dir>desc</dir></action>
  </
block>

Doesn’t seem to work, anyone have any idea why?

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
umpa
Jr. Member
 
Total Posts:  7
Joined:  2009-03-06
 

I also would like to know how to edit sort options in new version?

 
Magento Community Magento Community
Magento Community
Magento Community
 
GuyGadbois
Jr. Member
 
Avatar
Total Posts:  10
Joined:  2008-12-04
 

Ok hold on, found the answer here:

http://www.magentocommerce.com/boards/viewthread/37324/#

 
Magento Community Magento Community
Magento Community
Magento Community
 
SpaceLight
Sr. Member
 
Avatar
Total Posts:  89
Joined:  2008-05-28
France
 

In app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php

replace
if ($this->getCurrentOrder()) {
$this->_collection->setOrder($this->getCurrentOrder(), $this->getCurrentDirection());
}

by

if ($this->getCurrentOrder()) {
if(($this->getCurrentOrder())==’position’){
$this->_collection->setOrder(’entity_id’,’desc’);
}
else {
$this->_collection->setOrder($this->getCurrentOrder(),$this->getCurrentDirection());
}
}

Works fine on Magento 1.5
http://mydons.com/how-to-display-the-most-recently-added-products-first-in-magento-1-6-0-0/

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top