Magento 1.9 Category Page – How to Show New Products First

category-productsmagento-1.9new-products

I have added new product and it show at the end of the category page in magento 1.9.2.3.
Suppose if i have 2 page of category products than new product show at 2nd page at the end, but i want to show the product at 1st place on 1st page. Anyone know how can i show newly product at 1st place in the category page.

thanks

Best Answer

Well, as a programmer, you will not do this if you think you are expert. But, who know, this is a easiest and fastest way to get the system work well, get all of products of all of categories sort by newest products in 5 minutes without any risk. Actually, this is not really “magento core edit”, we just inherit the core code and override it in local directory, it ‘s fine if we update the core.

Now let ‘s copy app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php to app/code/local/Mage/Catalog/Block/Product/List/Toolbar.php (create a new directory if it is not exists).

Open new file and look at these lines of code in around line 232

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

Now, replace with these lines

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

That ‘s all, now remember to clear all cache and reindex too see the magic.

For more see here.

Related Topic