How to Display the most recently added products first in magento 1.6.0.0

Share

Magento Provides three different options to sort the catalog products i.e
name, price, position. For a store with more than 1000 products it is not
possible enter position values in backend for each products. We can replace
this with product ids , so that the frontend will display the most recently
added products.

Step 1: To Achieve this copy the file Toolbar.php from app/code/core/Mage/Catalog

/Block/Product/List/Toolbar.php. Create a Directory Structure in local and paste the Toolbar.php
as shown below
app/code/local/Mage/Catalog/Block/Product/List/Toolbar.php

Step 2: Around line 232 you should see the below code in setCollection
function

if ($this->getCurrentOrder()) {
$this->_collection->setOrder($this->getCurrentOrder(), $this->getCurrentDirection());
}

Replace the above code with the new code given below

if ($this->getCurrentOrder()) {
if(($this->getCurrentOrder())=='position'){
$this->_collection->setOrder('entity_id','desc');
}
else {
$this->_collection->setOrder($this->getCurrentOrder(),$this->getCurrentDirection());
}
}

Now the newly added products will be displayed first in your magento store.

Leave a Reply

You must be logged in to post a comment.