如何将我的 opencart 商店中的默认排序顺序更改为减少 stock_status_id?

How to change the default sort order in my opencart store to decreasing by stock_status_id?

我做了这些:

catalog/controller/product/category.php

我改变了:

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

默认情况下,当我刷新页面时,当我选择默认选项时没有任何操作起作用,我看到此代码 ?sort=p.stock_status_id&order=DESC&limit=100 但尚未按 stock_status_id 排序!

打开此文件:

catalog/controller/product/category.php

查找:

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

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

改为:

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

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