Hey guys,
I've googled how to solve this, but all solutions have been for older versions of OpenCart, where the code is different...
Basically my products are currently displaying alphabetically.. I want them to display in the order I add them (date added).. can anyone help?
Many thanks!
I've googled how to solve this, but all solutions have been for older versions of OpenCart, where the code is different...
Basically my products are currently displaying alphabetically.. I want them to display in the order I add them (date added).. can anyone help?
Many thanks!
Line 196 of catalog/model/catalog/product.php determines the field used for default sort order. It reads:
You could simply change it to:
Code: Select all
$sql .= " ORDER BY p.sort_order";
Code: Select all
$sql .= " ORDER BY p.date_added";
Ah yes, that changes the default sort order but category pages specifically ask for sort_order on lin e21 of catalog/controller/product/category.php. Change:
to
that should do it. if you want sort order changed on other pages you can make a similar change in the relevant controller request.
Code: Select all
$sort = 'p.sort_order';
Code: Select all
$sort = 'p.date_added';
billynoah wrote:I'd love to help but you still haven't completely answered my question. Products appears in the store front in many places.
menus
search results
category pages
featured list
specials page
and so on.
ANy idea where i can change the SORT order for the FEATURED List..?
most of the solutions discussed here are for older versions of OC
Not sure what you mean - solutions here are for 1.5.6 which is the newest version.
Featured doesn't use a sort order, it gets products in the order they appear in the extension, i.e., the order you added them. Easiest way would be to change the order you added them in. If you have lots of products already added and prefer to do this programmatically you could assign a key based on product info to the $this->data['products'] array and then use ksort or krsort to sort the array. For instance, to sort by product model instead of:
do:
and then when loop is complete
Featured doesn't use a sort order, it gets products in the order they appear in the extension, i.e., the order you added them. Easiest way would be to change the order you added them in. If you have lots of products already added and prefer to do this programmatically you could assign a key based on product info to the $this->data['products'] array and then use ksort or krsort to sort the array. For instance, to sort by product model instead of:
Code: Select all
$this->data['products'][] = array(
Code: Select all
$this->data['products'][$product_info['model']] = array(
Code: Select all
$this->data['products'] = ksort($this->data['products']);
Is there a way to sort products by name AND THEN by model? I have perfume store, and it doesn't look nice when three the same name perfumes are listed like this in category:
Armani Code 75ml
Armani Code 30ml
Armani Code 50ml
(where Armani Code is 'Product name' and 75ml is 'Model').
I don't know what causes this kind of sorting.
I would like to see them listed like this:
Armani Code 30ml
Armani Code 50ml
Armani Code 75ml
Any ideas?
p.s.
still using 1.5.1. version
Armani Code 75ml
Armani Code 30ml
Armani Code 50ml
(where Armani Code is 'Product name' and 75ml is 'Model').
I don't know what causes this kind of sorting.
I would like to see them listed like this:
Armani Code 30ml
Armani Code 50ml
Armani Code 75ml
Any ideas?
p.s.
still using 1.5.1. version
Who is online
Users browsing this forum: No registered users and 285 guests