How to Display the most recently added products first in magento

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.

Comments