OpenCart Product listing default sort order is as per product name, and you can sort them with product name asc or desc, Model acs or desc, price asc or desc, quantity asc or desc and Status asc or desc just by clicking on the listing of the table heading.


But if you want to sort as per the latest inserted product then you need to do some code changes in default file which is not good but requirements always comes first. (OcMod coming soon)

Find following lines of code in admin\controller\catalog\product.php:

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 with the following lines of code:

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

if (isset($this->request->get['order'])) {
    $order = $this->request->get['order'];
} else {
    $order = 'DESC';
}

 

LEAVE A REPLY

Please enter your comment!
Please enter your name here