This FAQ will show you how to easily sort your Magento products by newest product first.
Copy app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php
upload the copy to:
app/code/local/Mage/Catalog/Block/Product/List/Toolbar.php (create a folder if it doesn’t exist already)
Now open the newly copied file and look for this line of code around line 232:
if
(
$this
->getCurrentOrder()) {
$this
->_collection->setOrder(
$this
->getCurrentOrder(),
$this
->getCurrentDirection());
}
Replace it with the following:
if
(
$this
->getCurrentOrder()) {
if
((
$this
->getCurrentOrder())==
'position'
){
$this
->_collection->setOrder(
'entity_id'
,
'desc'
);
}
else
{
$this
->_collection->setOrder(
$this
->getCurrentOrder(),
$this
->getCurrentDirection());
}
}
Save your file, flush the Magento site caches and update your Magento indexes.
0 Comments