Post by postidol » Wed Nov 07, 2018 12:42 am

Hey all,

My client has asked to have their products sorted by model number on the front end of the website. Anyone know how I could tackle this?

Thank you in advance! :)

New member

Posts

Joined
Thu May 30, 2013 1:51 am

Post by cyclops12 » Wed Nov 07, 2018 1:23 am

You can choose to sort by model in the dropdown box in category pages

Attachments

sort-model.png

sort-model.png (88.41 KiB) Viewed 171 times


Active Member

Posts

Joined
Sun Sep 27, 2015 1:10 am

Post by postidol » Thu Nov 08, 2018 11:54 am

Hi there. Thanks for the reply. Yes, that's true. But how can I make that the default sort order?

New member

Posts

Joined
Thu May 30, 2013 1:51 am

Post by ocmta » Thu Nov 08, 2018 1:36 pm

In catalog/controller/product/category.php, find this code, it's near the top of the file:

Code: Select all

if (isset($this->request->get['sort'])) {
	$sort = $this->request->get['sort'];
} else {
	$sort = 'p.sort_order';
}
if (isset($this->request->get['order'])) {
	$order = $this->request->get['order'];
} else {
	$order = 'ASC';
}
And replace

Code: Select all

$sort = 'p.sort_order';
with

Code: Select all

$sort = 'p.model';
If you want default order to be descending (from Z to A), replace

Code: Select all

$order = 'ASC';
with

Code: Select all

$order = 'DESC';
Then you can do the same for manufacturer.php, search.php and special.php in catalog/controller/product . Then if you use any modifications, refresh them in admin.

Extensions for affiliates (openCart 1, 2, 3):
Advanced Multi Level Affiliate System
Customer and Affiliate Accounts Combined into one Account
Affiliate Tracking with Coupons
Discount for Referred Customers - Order Total
Type Tracking Code
Mass Pay
Affiliate Transactions for openCart 3
Affiliate Pack X - all modules with 40% discount


Active Member

Posts

Joined
Mon Mar 12, 2012 11:21 am


Post by postidol » Fri Nov 09, 2018 12:00 am

OMG! Thank you so much for your help. I really appreciate it!!!! Thank you, thank you! You're awesome!!!

New member

Posts

Joined
Thu May 30, 2013 1:51 am
Who is online

Users browsing this forum: No registered users and 13 guests