Magento Notes — Default sorting is not logical
Now that I have my e-commerce site, tickon.com, running for a while (3-months), I am back at it adding more products to link to my affiliate partners (this is a new experiment on this web site).
As I started to add new products, I noticed that newest items are added to the last page of the category that it was assigned to…not a very smart implementatio in my opinon. Did some googling and found a fix here:
http://www.magentocommerce.com/boards/viewthread/1176/
Essentially what needs to be done is to fix the file: app/code/core/Mage/Catalog/Block/Product/List/toolbar.php
near line 47, I changed the original code to the following:
$this->_availableOrder = array(
‘entity_id’ => $this->__(’Newest’),
‘name’ => $this->__(’Name’),
‘price’ => $this->__(’Price’)
);
The first item listed will be the default sort filter, the default was “best value”…which didn’t make a lot of sense to me.
Second item to fix up is in the same file, but you go to line 108 (approx.) and modify the highlighted part as below:
public function getCurrentDirection()
{
if ($dir = (string) $this->getRequest()->getParam($this->getDirectionVarName())) {
$dir = strtolower($dir);
if (in_array($dir, array(’asc’, ‘desc’))) {
return $dir;
}
}
return ‘desc‘;
default is asc, but you need to change it to descending so that it sorts from newest id first.

Great. This worked perfect and fixed my biggest problem with Magento. Thanks!
Love the blog mate, keep up the good work - I’ll definitely recommend your blog to some friends of mine ^^
Well, i wanted to thank you for this tip, but i tried to open the file and search for the string to replace it but i could not find it.
i dono if the magento ver. makes a difference
mine is: 1.3.2.3
is there any other way please?
or can i pay someone to fix this for me?
thank you
You can also do this with the layout xml, its probably the easiest and safest way as changing core blocks is very risky when it comes to upgrading.
Look in catalog.xml, look for:
inside this block tag there some example actions that have been commented out, add the following new action:
desc