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 10 of 11
…set the default sort order for catalog pages? 
 
doanmade
Jr. Member
 
Avatar
Total Posts:  3
Joined:  2011-01-31
 

Anyone know how to add and remove a “Sort By” in magento 1.6? i can not find anything in toolbar.php

Please help

 
Magento Community Magento Community
Magento Community
Magento Community
 
vonsharkel
Jr. Member
 
Total Posts:  6
Joined:  2011-11-22
 

Hi guys,

I’m hoping that one of you can help me with the following question:

Does anyone know how to change the drop down box infor simply clicking the sort words in the bar? I cannot seem to find this anywhere on the internet. i know that i need to be in the toolbar.phtml file....but what to change.. i’m lost..

Cheers,

Tom.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Tusher Khan
Member
 
Total Posts:  66
Joined:  2011-01-07
 

Here is a simple way to change default sort order:

http://www.xpressbangla.com/change-default-sort-order-direction-asc-to-desc-for-product-listing-in-magento/

 
Magento Community Magento Community
Magento Community
Magento Community
 
Tusher Khan
Member
 
Total Posts:  66
Joined:  2011-01-07
 

Here is a great way to change default sort order:

http://www.xpressbangla.com/change-default-sort-order-direction-asc-to-desc-for-product-listing-in-magento/

 
Magento Community Magento Community
Magento Community
Magento Community
 
MageBright
Sr. Member
 
Avatar
Total Posts:  100
Joined:  2011-11-21
 

How To Add Most View Product in Sort By??

 
Magento Community Magento Community
Magento Community
Magento Community
 
Amasty
Mentor
 
Avatar
Total Posts:  3988
Joined:  2009-11-10
 
khamar_pratik - 01 February 2012 01:46 AM

How To Add Most View Product in Sort By??

Hello. You can do it using our Improved Sorting extension: http://amasty.com/improved-sorting.html

 
Magento Community Magento Community
Magento Community
Magento Community
 
osyris
Member
 
Avatar
Total Posts:  39
Joined:  2009-05-17
Tallinn, Estonia
 

Here’s a little script that will set “created_at” attribute to be available in “Sort By” box in front-end. Script is harmless and does not do anything irreversible. What it does:
- gets a collection of all product attributes in the system
- iterates over them and looks for the one with code “created_at”
- if such attribute is found, sets Frontend Label to “Newest” and Used For Sort By to “true”
- prints all of the “created_at” attribute’s parameters for your reference

Edit from 20 March 2012:
To use it, you will need to download the file and place it in the root of you magento installation. In you browser go to http://mydomain.com/activate_newest.php. Now go to you catalog, you should see “Newest” as an option in the “Sort By” box. If not, flush cache, rebuild indexes, recompile.

Have fun!

File Attachments
activate_newest.php  (File Size: 1KB - Downloads: 150)
 
Magento Community Magento Community
Magento Community
Magento Community
 
MageBright
Sr. Member
 
Avatar
Total Posts:  100
Joined:  2011-11-21
 

I Have Done It So Why I m Purchase id…

 
Magento Community Magento Community
Magento Community
Magento Community
 
All4coding
Jr. Member
 
Avatar
Total Posts:  4
Joined:  2012-01-10
 

Hi Everyone,

I have create an extension for it.
You can set the default sort direction for all category at System > Configuration
Also you can set default sort direction for a specific category
Check my extension here
http://www.all4coding.com/magento/sort-direction.html
It is FREE!!!
Also check the demo here
http://demo.all4coding.com/magento/apparel.html

 
Magento Community Magento Community
Magento Community
Magento Community
 
MageBright
Sr. Member
 
Avatar
Total Posts:  100
Joined:  2011-11-21
 

not interested bcoz here discuss about not default sort order add some extra sort by like rating,bestseller,newest,and i have done it sorru..

 
Magento Community Magento Community
Magento Community
Magento Community
 
shadowxgws
Jr. Member
 
Total Posts:  6
Joined:  2009-04-09
 

It’s workring perfectly on magento 1.6.2
http://www.dconstructing.com/php/2011/04/07/sort-magento-catalog-by-date-added/

 
Magento Community Magento Community
Magento Community
Magento Community
 
pradeep_kumar67
Sr. Member
 
Avatar
Total Posts:  160
Joined:  2010-06-24
Bangalore
 
bas87 - 12 March 2010 04:02 AM

Hi, this is my solution sorting by saleability.

I chaneged in code/local/Mage/Catalog/Block/Product/List/Toolbar.php method setCollection to

/**
     * Set collection to pager
     *
     * @param Varien_Data_Collection $collection
     * @return Mage_Catalog_Block_Product_List_Toolbar
     */
    public function setCollection($collection{
        parent
::setCollection($collection);
        if (
$this->getCurrentOrder()) {
            
if($this->getCurrentOrder() == 'saleability'{
               $this
->getCollection()->getSelect()->
                
joinLeft('sales_flat_order_item AS sfoi',
                        
'e.entity_id = sfoi.product_id',
                        
'SUM(sfoi.qty_ordered) AS ordered_qty')->
                
group('e.entity_id')->order('ordered_qty ' $this->getCurrentDirectionReverse());
            
}
            
else {
                $this
->getCollection()->setOrder($this->getCurrentOrder(), $this->getCurrentDirection());
            
}
        }
        
return $this;
    
}

After setCollection I added this method:

/**
     * Retrieve current direction reverse
     *
     * @return string
     */
    public function getCurrentDirectionReverse() {
        
if ($this->getCurrentDirection() == 'asc'{
            
return 'desc';
        
elseif ($this->getCurrentDirection() == 'desc'{
            
return 'asc';
        
else {
            
return $this->getCurrentDirection();
        
}
    }

And finally I changed mehod setDefaultOrder to

/**
     * Set default Order field
     *
     * @param string $field
     * @return Mage_Catalog_Block_Product_List_Toolbar
     */
    public function setDefaultOrder($field{
        
if (isset($this->_availableOrder[$field])) {
            $this
->_availableOrder = array(
                
'name'        => $this->__('Name'),
                
'price'       => $this->__('Price'),
                
'position'    => $this->__('Position'),
                
'saleability' => $this->__('Saleability'),
            );
            
$this->_orderField $field;
        
}
        
return $this;
    
}

I hope it helps someone, Michal

it wont work in magento 1.2 or magneto 1.7 plase can you tell how to use it in magento 1.7
and also Zend_Db_Expr is not working throughing some error can you please help me out

 
Magento Community Magento Community
Magento Community
Magento Community
 
colin008
Sr. Member
 
Total Posts:  84
Joined:  2008-10-20
 

What about changing the sort order (ASC or DESC) on a per category basis, this code works fine on 1.5.1 in Category>Custom Design>Custom Layout Update

<reference name="content">
<
block name="category.products">
<
block name="product_list">
<
block name="product_list_toolbar">
<
action method="setDefaultDirection"><dir>desc</dir></action>
</
block>
</
block>
</
block>
</
reference>
 
Magento Community Magento Community
Magento Community
Magento Community
 
Indigo Blue
Jr. Member
 
Total Posts:  3
Joined:  2012-09-24
 

where do i find app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php?  I desperately need to change my default sorting order to Price descending.  Also - what are the default sorting options?  I have removed Best Value and now only have Price as an option.  I would like to search by designer/brand but I am not sure if this is possible?

http://www.indigobluetrading.com

 
Magento Community Magento Community
Magento Community
Magento Community
 
Indigo Blue
Jr. Member
 
Total Posts:  3
Joined:  2012-09-24
 

Colin

I have tried to add the code that you suggested to the custom layout field within the individual categories to change the default sorting order from ascending to descending but it doesn’t work for me.  It works for about 2 mins and then it reverts back to price ascending.  any further ideas or advice on this?

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