Page 1 of 1

[SOLVED] Sort Admin Products Listing By Date as Default 3.0.3.6

Posted: Fri Oct 16, 2020 7:21 pm
by iplocker
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

Re: Sort Admin Products Listing By Date as Default 3.0.3.6

Posted: Fri Oct 16, 2020 8:06 pm
by xxvirusxx
Contact extension developer.

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

Re: Sort Admin Products Listing By Date as Default 3.0.3.6

Posted: Fri Oct 16, 2020 9:47 pm
by letxobnav
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'
		);

Re: Sort Admin Products Listing By Date as Default 3.0.3.6

Posted: Fri Oct 16, 2020 11:21 pm
by iplocker
Thanks you guys !
Specially to letxobnav , that was the solution indeed !!
My best regards !!! :)