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
1 2 3 |
if ($this->getCurrentOrder()) { $this->collection->setOrder($this->getCurrentOrder(), $this->getCurrentDirection()); } |
Replace the above code with the new code given below
1 2 3 4 5 6 7 8 |
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.
Compatability: Magento 1.6