Post by IsmaelPR1 » Tue Feb 22, 2022 6:33 am

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.
Image

User avatar
Newbie

Posts

Joined
Sat Oct 21, 2017 1:30 am

Post by halfhope » 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';
}

My FREE extensions in marketplace. [ security | flexibility | speedup ]


User avatar
Active Member

Posts

Joined
Tue Dec 10, 2013 9:44 pm
Location - San Diego

Post by IsmaelPR1 » Wed Feb 23, 2022 2:51 am

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.
Image

User avatar
Newbie

Posts

Joined
Sat Oct 21, 2017 1:30 am

Post by halfhope » 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.

My FREE extensions in marketplace. [ security | flexibility | speedup ]


User avatar
Active Member

Posts

Joined
Tue Dec 10, 2013 9:44 pm
Location - San Diego

Post by IsmaelPR1 » Wed Feb 23, 2022 8:58 am

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.

User avatar
Newbie

Posts

Joined
Sat Oct 21, 2017 1:30 am

Post by halfhope » Wed Feb 23, 2022 10:12 am

File admin/controller/catalog/product.php IS NOT catalog/model/product/product.php

"Do good and run"

My FREE extensions in marketplace. [ security | flexibility | speedup ]


User avatar
Active Member

Posts

Joined
Tue Dec 10, 2013 9:44 pm
Location - San Diego

Post by IsmaelPR1 » Wed Feb 23, 2022 10:29 am

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.

User avatar
Newbie

Posts

Joined
Sat Oct 21, 2017 1:30 am
Who is online

Users browsing this forum: No registered users and 99 guests