我是 Prestashop 的新手,我正在尝试添加一个新的“排序依据”字段(默认情况下,您有:“相关性”,“名称,A 到 Z”,“名称,Z 到 A”,“价格,低至高”, “价格从高到低”)
如你们所知,该功能位于名为“Ps_facetedsearch”的模块中,链接此处。
我试过:
所以我的问题是:
任何提示表示赞赏!
PrestaShop 版本:1.7.4.2
我需要复制/粘贴 Ps_facetedsearch 模块中的行,以便添加额外的“排序依据”字段:
private function getAvailableSortOrders()
{
return [
(new SortOrder('product', 'position', 'asc'))->setLabel(
$this->module->getTranslator()->trans('Relevance', array(), 'Modules.Facetedsearch.Shop')
),
(new SortOrder('product', 'name', 'asc'))->setLabel(
$this->module->getTranslator()->trans('Name, A to Z', array(), 'Shop.Theme.Catalog')
),
(new SortOrder('product', 'name', 'desc'))->setLabel(
$this->module->getTranslator()->trans('Name, Z to A', array(), 'Shop.Theme.Catalog')
),
(new SortOrder('product', 'price', 'asc'))->setLabel(
$this->module->getTranslator()->trans('Price, low to high', array(), 'Shop.Theme.Catalog')
),
(new SortOrder('product', 'price', 'desc'))->setLabel(
$this->module->getTranslator()->trans('Price, high to low', array(), …Run Code Online (Sandbox Code Playgroud)