What I want to do is:
$this->_availableOrder = array(
‘brand’, ‘name’ => $this->__(’Brand’),
‘name’,’brand’ => $this->__(’Name’),
‘packaged_in’,’brand’,’name’ => $this->__(’Packaged’)
);
$this->setDefaultOrder(’brand’, ‘name.);
This will allow me to get a useable list for the user.
Has anyone had any progress with multiple sort??? I could really use this option for a more in depth sort. Please share
I changed it to
‘name’ => Mage::helper(’catalog’)->__(’name’)
because the client want the products sorted by name ^^
Anyone a better way by setting it up in the backoffice?
notice that I dont let the user sort the data, i’ve disabled/removed the dropdown in the phtml..
don’t think the default sorting can be changed after this mod and this could be overwritten when updating magento to a newer version.
this is by all means a quick hack and defenitly not the way to go
open up:
\app\code\core\Mage\Catalog\Block\Product\List\Toolbar.php
change line 159 in the method “setCollection” where you can find
$this->getCollection()->setOrder('sell_type', 'DESC'); // sell_type is a custom attribute i want to sort on $this->getCollection()->setOrder('price', 'ASC');
OK, I am officially lost. I got all my new products on my main page, and I increased the number that show up to the amount I wanted, but I just can’t seem to get them to sort properly.
I would like them to sort on news_from_date and then alphabetically after that (for products that have the same news_from_date entry).
They seem to be sorting by entity_id and from oldest to newest order.
I am really not much of a coder (a little html, shell, perl, php), and I have gone crosseyed reading forums trying to fix this. I have tried many different methods mentioned in the forums, to no avail.
Can anyone please point me in the right (very specific) direction? You can even point and call me n00b, if you want…
Running 1.3.0
Grunge Theme from magthemes.com
Zblocks
color views plus
Manage Products (Enhanced)
GoDaddy.com deluxe hosting plan
notice that I dont let the user sort the data, i’ve disabled/removed the dropdown in the phtml..
don’t think the default sorting can be changed after this mod and this could be overwritten when updating magento to a newer version.
this is by all means a quick hack and defenitly not the way to go
open up:
\app\code\core\Mage\Catalog\Block\Product\List\Toolbar.php
change line 159 in the method “setCollection” where you can find
$this->getCollection()->setOrder('sell_type', 'DESC'); // sell_type is a custom attribute i want to sort on $this->getCollection()->setOrder('price', 'ASC');
// second param i want to sort on
i have 1.3.x and changed function getCurrentOrder()
at the end it says
return $keys[0];
so no matter what you selected in system config, it will sort by [0:"relevance”,1:"name”,2:"price"]
so i simply return return $keys[2];
thats it, hard coded until magento solves this for me....
i still have the problem that this solution only works for advanced search and category listings, but not for quick search.
i tried to change setListOrders in /catalogsearch/block/result.php to accept price order.
now the select box at the quick search page is set to price, but it is not sorted by price :(
getCurrentOrder from the toolbar.php is called from that page, but it simply does not affect the order…
any suggestions how to order quick search results by price?
For those of you who don’t want to alter the core code, but want to sort by one of the default Magento sort options (like “name") adding this to the /app/design/frontend/default/[theme]/layout/catalog.xml file seems to work:
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml"> <!-- Add this line --> <action method="setDefaultOrder"><field>name</field></action> <!-- ... --> </block>
This would make your code “upgrade-proof”. Feel free to correct this if it’s wrong.