Answer the question
In order to leave comments, you need to log in
Sorting in opencart 3 by default?
Hello.
How to make sorting "by rating" open by default?
I changed $sort in catalog/controller/product/category.php
to all possible values, updated the modifier, nothing changed.
Version ocStore 3.0.2.0
Answer the question
In order to leave comments, you need to log in
Changed in catalog/controller/product/category.php
$sort_data = array(
'pd.name',
'p.model',
'p.quantity',
'p.price',
'rating',
'p.sort_order',
'p.date_added'
);
if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
if ($data['sort'] == 'pd.name' || $data['sort'] == 'p.model') {
$sql .= " ORDER BY LCASE(" . $data['sort'] . ")";
} elseif ($data['sort'] == 'p.price') {
$sql .= " ORDER BY (CASE WHEN special IS NOT NULL THEN special WHEN discount IS NOT NULL THEN discount ELSE p.price END)";
} else {
$sql .= " ORDER BY " . $data['sort'];
}
} else {
$sql .= " ORDER BY p.sort_order";
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question