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

Page 11 of 11
…set the default sort order for catalog pages? 
 
pradeep_kumar67
Sr. Member
 
Avatar
Total Posts:  160
Joined:  2010-06-24
Bangalore
 

please check this post

http://www.magentocommerce.com/boards/viewthread/287173/

its some what fix , here i added most viewed in category sort by option, if you get error i gave solution to fix it also

 
Magento Community Magento Community
Magento Community
Magento Community
 
headwaystl
Jr. Member
 
Avatar
Total Posts:  2
Joined:  2011-08-15
St. Louis, MO
 

The following changes worked for me on Community edition 1.7.0.2. Now all category pages list products in descending order by price.

In /theme-name/template/catalog/product/list/toolbar.phtml change (line 82 for me):

$this->getOrderUrl($_key'asc')

to

$this->getOrderUrl($_key'desc')

Then in /theme-name/layout/catalog.xml add the following to the product_list_toolbar block under the Category default layout (line 86 for me):

<action method="setDefaultDirection"><string>desc</string></action>

Hope this helps.

 
Magento Community Magento Community
Magento Community
Magento Community
 
CafeBandito
Jr. Member
 
Total Posts:  14
Joined:  2012-01-31
 

Hey guys,

This worked for me.

Edit this file: app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php
(sidenote, I always make a backup of files I edit and rename it something like ToolbarBACKUP.php)

Find this code:

public function setDefaultDirection($dir)
    
{
        
if (in_array(strtolower($dir), array('asc''desc'))) {
            $this
->_direction strtolower($dir);
        
}
        
return $this;
    
}

Change ‘asc’ to ‘desc’ and change ‘desc’ to ‘asc’.

Presto!

 
Magento Community Magento Community
Magento Community
Magento Community
 
CafeBandito
Jr. Member
 
Total Posts:  14
Joined:  2012-01-31
 

Hey guys,

This worked for me.

Edit this file: app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php
(sidenote, I always make a backup of files I edit and rename it something like ToolbarBACKUP.php)

Find this code:

public function setDefaultDirection($dir)
    
{
        
if (in_array(strtolower($dir), array('asc''desc'))) {
            $this
->_direction strtolower($dir);
        
}
        
return $this;
    
}

Change ‘asc’ to ‘desc’ and change ‘desc’ to ‘asc’.

Presto!

 
Magento Community Magento Community
Magento Community
Magento Community
 
marionnex
Member
 
Total Posts:  38
Joined:  2012-03-30
 

Best and easiest way.

Go to app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php
And copy this to app/code/local/Mage/Catalog/Block/Product/List/Toolbar.php
As it is recommended not to touch the core files.

Look for:

protected $_direction           'asc';
change to:
protected $_direction           'desc';

Easy. Hope this helps!

 
Magento Community Magento Community
Magento Community
Magento Community
 
rochoventura
Jr. Member
 
Total Posts:  18
Joined:  2013-01-31
 

i know this topic might be little bit old, but im runnign magento 1.7.0.2 ce , and trying to sorty by “newest” as default category page but it keep showing me price, by changing manually every categories in the design options it does work, but we have too many categories/subc to do it manually, also the options: Admin > Configuration > Catalog > Frontend > Product Listing Sort By: New does not take effect....

any ideas?????? thanks a lot!!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Jase007
Guru
 
Total Posts:  388
Joined:  2013-11-05
 

Hi,

In Toolbar,php,changed this:

$this->_availableOrder = array('position'=>__('Best Value'), 'name'=>'Name''price'=>__('Price'));

to this:

$this->_availableOrder = array('name'=>'Name''position'=>__('Best Value'), 'price'=>__('Price'));

Thanks

iLoveMage

 
Magento Community Magento Community
Magento Community
Magento Community
 
rochoventura
Jr. Member
 
Total Posts:  18
Joined:  2013-01-31
 

i don’t have such code, maybe its because i have improved sorting extension by amasty?
anyway im attaching my toolbar.php hopefully you can point me what changes to-do.
many thanks for the help, really appreciate it.

Jase007 - 26 November 2013 09:31 AM

Hi,

In Toolbar,php,changed this:

$this->_availableOrder = array('position'=>__('Best Value'), 'name'=>'Name''price'=>__('Price'));

to this:

$this->_availableOrder = array('name'=>'Name''position'=>__('Best Value'), 'price'=>__('Price'));

Thanks

iLoveMage
File Attachments
Toolbar.php  (File Size: 22KB - Downloads: 7)
 
Magento Community Magento Community
Magento Community
Magento Community
 
Jase007
Guru
 
Total Posts:  388
Joined:  2013-11-05
 

okay Let me check again

 
Magento Community Magento Community
Magento Community
Magento Community
 
stefanschulz
Jr. Member
 
Total Posts:  7
Joined:  2013-06-26
 

Hey guys,

this Thread helped me very much. I used the ‘<action method="setDefaultDirection"><dir>desc</dir></action>’ method and its working fine. Althoug theres a little problem.
I used the method in this link to promote a set of items. To sum it up: In Admin --> CMS I created block using following code under the content tab:

{{block type='catalog/product_list_promotion' template='catalog/product/list.phtml'}}
The block successfully presents promotion articles but they are sortet ascending and I would like to sort them descending by default.

I tried to alter the catalog.xml to add the block there in order to add the “setDefaultDirection” line but but I failed. Can anybody tell me how to solve this issue?

Thanks and best regards
Stefan

 
Magento Community Magento Community
Magento Community
Magento Community
 
userCreativa
Jr. Member
 
Total Posts:  3
Joined:  2013-05-31
 

Hi,

According to what all the catalog shows, I have all my products sorted by name (I\’m a designer, not a developer, so I don\’t have much expertise in this subject) except for this only category: http://www.dragogear.com/products/pistol-cases.html

I tried configuring the category Display Setting with no success (see attachment). I searched for all the codes mentioned in this forum, but my Toolbar.php file doesn\’t have any of the codes. (I\’m also including the Toolbar.php)

Any help received will be much appreciated!

Image Attachments
Screen Shot 2014-03-20 at 9.44.01 AM.png
 
Magento Community Magento Community
Magento Community
Magento Community
 
FmeAddons
Sr. Member
 
Avatar
Total Posts:  123
Joined:  2014-01-15
USA
 

The following FMEAddons module enables you to provide your customers more sorting options such as by best seller, top rated etc. Out of stock products are displayed seperately. Click here to read more.

 
Magento Community Magento Community
Magento Community
Magento Community
 
ZbyszekTomek
Sr. Member
 
Total Posts:  121
Joined:  2013-11-28
 

Hi. Setting sorting in Magento is rather easy. You can do this manually or use specialized plugin like Advanced Sorting.
Usefull for best discounts sorting, by stock, most viewed

Zbych

 
Magento Community Magento Community
Magento Community
Magento Community
 
christinavick
Guru
 
Total Posts:  355
Joined:  2013-11-13
 

Hi,

in Toolbar,php, (near line 40) I changed this:

$this->_availableOrder = array('position'=>__('Best Value'), 'name'=>'Name''price'=>__('Price'));

to this:

$this->_availableOrder = array('name'=>'Name''position'=>__('Best Value'), 'price'=>__('Price'));

Thanks

iLoveMage

 
Magento Community Magento Community
Magento Community
Magento Community
 
FmeAddons
Sr. Member
 
Avatar
Total Posts:  123
Joined:  2014-01-15
USA
 

Try this Magento Sorting Extension as it increases the sorting options for products and make your product catalog easy to browse. You can set the detail sorting option and that can be the best seller in order to emphasize more on hot products and increase their conversions,

http://www.magentocommerce.com/magento-connect/sort-products-extension-improved-catalog-sorting.html

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 11 of 11