Page 1 of 1

Display Newest Products First??

Posted: Sun Apr 21, 2013 12:26 pm
by trenttdogg
Can anyone tell me how to change the display order on the category page? My products are being displayed in reverse chronological order (oldest products first) and I would like newest products to display first. I have read several posts but cannot find a good answer. I'm sure it's something simple but I cannot figure it out.

Any help is greatly appreciated.

Re: Display Newest Products First??

Posted: Sun Apr 21, 2013 2:35 pm
by pprmkr
Default sortorder is: p.sort_order ASC

Edit catalog/controller/product/category.php.

Find:

Code: Select all

$sort = 'p.sort_order';
Change into:

Code: Select all

$sort = 'p.date_added';
Find:

Code: Select all

$order = 'ASC';
Change into:

Code: Select all

$order = 'DESC';
To set it as default sorting:
Change:

Code: Select all

'value' => 'p.sort_order-ASC',
Into:

Code: Select all

'value' => 'p.date_added-DESC',
OR: If you want to add this value to the Sort By:select field:
Find:

Code: Select all

			$this->data['sorts'][] = array(
				'text'  => $this->language->get('text_default'),
				'value' => 'p.sort_order-ASC',
				'href'  => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.sort_order&order=ASC' . $url)
			);
After that add:

Code: Select all

			$this->data['sorts'][] = array(
				'text'  => $this->language->get('text_date_added_asc'),
				'value' => 'pd.date_added-ASC',
				'href'  => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=pd.date_added&order=ASC' . $url)
			);
			$this->data['sorts'][] = array(
				'text'  => $this->language->get('text_date_added_desc'),
				'value' => 'pd.date_added-DESC',
				'href'  => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=pd.date_added&order=DESC' . $url)
			);
Edit catalog/language/english/catalog/category.php and before ?> add:

Code: Select all

$_['text_model_desc']   = 'Date (Latest - Oldest)';
$_['text_model_asc']   = 'Date (Oldest - Latest)';

Re: Display Newest Products First??

Posted: Mon Apr 22, 2013 9:17 am
by trenttdogg
Thanks PPRMKR, it didn't work though. When I add a new item, it goes to the bottom of the list. I also added the "sort by" option you suggested and it shows in the drop down, but when you choose sort by newest-oldest, it acutally sorts alphabetically z-a.
Any other ideas?

Thanks,

Re: Display Newest Products First??

Posted: Mon Apr 22, 2013 2:23 pm
by pprmkr
Try attached vQmod ...

Re: Display Newest Products First??

Posted: Fri Dec 19, 2014 12:31 am
by delmi
hello,

Who knows how to configure to show products in category by most viewed or by bestsellers, etc..

Thank you.