Monday 14 December 2015

How to Display the recently added products first in Magento?

 Display the recently added products first in Magento


Please copy the file Toolbar.php from 


app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php

And  Create a Directory structure in local and paste the Toolbar.php as shown below 

app/code/local/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 above code with below code:

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








7 comments:

  1. This post includes how to display added products first at magento. Pretty well maintained post and keep updating.
    Buy zambian emerald natural online

    ReplyDelete
  2. I was just looking for this kind of posts and this kind of posts is so well mannered in the way of informations. Thanks for sharing this posts. keep updating.
    pre and probiotic capsules

    ReplyDelete
  3. Author deserves to be appreciated, thanks for the post and keep updating.
    buy Australian opal online

    ReplyDelete
  4. This post is really nice and very well maintained, thanks for it and keep updating your posts.

    gemstone wholesaler in Delhi

    ReplyDelete