Page 1 of 1
How to set a default product sort in admin view of all products.
Posted: Tue Feb 22, 2022 6:33 am
by IsmaelPR1
Hi there, I have searched and tried a few things in order to set a default product sort view. I would like to have my products always sorted by "Model" ascending due to the way that I setup my products. Where do I need to set that exactly? See image attached. I am running OC v3.0.3.8 on stock theme. I have tried I have tried to set
$sql .= " ORDER BY p.sort_order"; to
$sql .= " ORDER BY p.model" cleared all cache but that had no effect.

Re: How to set a default product sort in admin view of all products.
Posted: Tue Feb 22, 2022 2:38 pm
by halfhope
Hi.
admin/controller/catalog/product.php function getList()
find (on line 258):
Code: Select all
if (isset($this->request->get['sort'])) {
$sort = $this->request->get['sort'];
} else {
$sort = 'pd.name';
}
if (isset($this->request->get['order'])) {
$order = $this->request->get['order'];
} else {
$order = 'ASC';
}
replace to:
Code: Select all
if (isset($this->request->get['sort'])) {
$sort = $this->request->get['sort'];
} else {
$sort = 'p.model';
}
if (isset($this->request->get['order'])) {
$order = $this->request->get['order'];
} else {
$order = 'ASC';
}
Re: How to set a default product sort in admin view of all products.
Posted: Wed Feb 23, 2022 2:51 am
by IsmaelPR1
halfhope wrote: ↑Tue Feb 22, 2022 2:38 pm
Hi.
admin/controller/catalog/product.php function getList()
find (on line 258):
Code: Select all
if (isset($this->request->get['sort'])) {
$sort = $this->request->get['sort'];
} else {
$sort = 'pd.name';
}
if (isset($this->request->get['order'])) {
$order = $this->request->get['order'];
} else {
$order = 'ASC';
}
replace to:
Code: Select all
if (isset($this->request->get['sort'])) {
$sort = $this->request->get['sort'];
} else {
$sort = 'p.model';
}
if (isset($this->request->get['order'])) {
$order = $this->request->get['order'];
} else {
$order = 'ASC';
}
Hi there, unfortunately this is not what my line 258 looks like here is what I have.

Re: How to set a default product sort in admin view of all products.
Posted: Wed Feb 23, 2022 6:22 am
by halfhope
Hi. Look for the code throughout the document. I already wrote that the desired code in the getList function.
Re: How to set a default product sort in admin view of all products.
Posted: Wed Feb 23, 2022 8:58 am
by IsmaelPR1
halfhope wrote: ↑Wed Feb 23, 2022 6:22 am
Hi. Look for the code throughout the document. I already wrote that the desired code in the getList function.
I searched for the exact code you listed, nothing came up. But thank you for your time.
Re: How to set a default product sort in admin view of all products.
Posted: Wed Feb 23, 2022 10:12 am
by halfhope
File admin/controller/catalog/product.php IS NOT catalog/model/product/product.php
"Do good and run"
Re: How to set a default product sort in admin view of all products.
Posted: Wed Feb 23, 2022 10:29 am
by IsmaelPR1
halfhope wrote: ↑Wed Feb 23, 2022 10:12 am
File admin/controller/catalog/product.php
IS NOT catalog/model/product/product.php
"Do good and run"
Thank you sir, you are a true friend. Your help is very much so appreciated. You have helped to resolve my request.