Tuesday, 24 February 2015

Display recently added products first in magento


Display recently added products first in magento

Kindly Open app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php and Find the below code at around line 232

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

Now Replace the below code and Enjoy chandresh rana's Coding

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

2 comments:

Anonymous said...

Are you really a coder? How can you make changes directly core files in magento?

you should need to override core files.

PHP Coder said...

You are right bro...