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.
