Post by iplocker » Fri Oct 16, 2020 7:21 pm

Hello.
I am wondering how easy is to sort at admin area at Products listing by Date and not by name as it is now .
Using OC 3.0.3.6
I have bought a simple extension https://www.opencart.com/index.php?rout ... n_id=22186 but still I have to click to sort, and after import a product it gaves again sorting by name
Thanks
Last edited by iplocker on Fri Oct 16, 2020 11:21 pm, edited 1 time in total.

Active Member

Posts

Joined
Sun May 26, 2013 6:39 pm


Post by xxvirusxx » Fri Oct 16, 2020 8:06 pm

Contact extension developer.

Or change in the product controller and model: $sort = 'pd.name'; with $sort = 'p.date_added'; and ASC to DESC

OC 2.3.0.2 | OC 3.0.3.6 | Extensions converted by me | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by letxobnav » Fri Oct 16, 2020 9:47 pm

admin/contoller/catalog/product.php -> function getList

find:

Code: Select all

		if (isset($this->request->get['sort'])) {
			$sort = $this->request->get['sort'];
		} else {
			$sort = 'pd.name';
		}
change to:

Code: Select all

		if (isset($this->request->get['sort'])) {
			$sort = $this->request->get['sort'];
		} else {
			$sort = 'p.date_added'; // default sorting on date added
		}
or:

Code: Select all

		if (isset($this->request->get['sort'])) {
			$sort = $this->request->get['sort'];
		} else {
			$sort = 'p.date_modified'; // default sorting on date modified
		}

admin/model/catalog/product.php -> function getProducts

change:

Code: Select all

		$sort_data = array(
			'pd.name',
			'p.model',
			'p.price',
			'p.quantity',
			'p.status',
			'p.sort_order'
		);
to:

Code: Select all

		$sort_data = array(
			'pd.name',
			'p.model',
			'p.price',
			'p.quantity',
			'p.status',
			'p.sort_order',
			'p.date_added',
			'p.date_modified'
		);

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by iplocker » Fri Oct 16, 2020 11:21 pm

Thanks you guys !
Specially to letxobnav , that was the solution indeed !!
My best regards !!! :)

Active Member

Posts

Joined
Sun May 26, 2013 6:39 pm

Who is online

Users browsing this forum: No registered users and 33 guests