Post by trenttdogg » Sun Apr 21, 2013 12:26 pm

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.

Newbie

Posts

Joined
Mon Mar 04, 2013 1:11 pm

Post by pprmkr » Sun Apr 21, 2013 2:35 pm

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)';

User avatar
Active Member

Posts

Joined
Sat Jan 08, 2011 11:05 pm
Location - Netherlands

Post by trenttdogg » Mon Apr 22, 2013 9:17 am

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,

Newbie

Posts

Joined
Mon Mar 04, 2013 1:11 pm

Post by pprmkr » Mon Apr 22, 2013 2:23 pm

Try attached vQmod ...

Attachments


User avatar
Active Member

Posts

Joined
Sat Jan 08, 2011 11:05 pm
Location - Netherlands

Post by delmi » Fri Dec 19, 2014 12:31 am

hello,

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

Thank you.

Newbie

Posts

Joined
Fri Dec 27, 2013 12:26 am
Who is online

Users browsing this forum: Majestic-12 [Bot] and 93 guests