В классе /classes/Category.php в методе getProducts присвоит переменной $order_by нужное значение.
if ($order_by == 'id_product' || $order_by == 'date_add' || $order_by == 'date_upd') $order_by_prefix = 'p';elseif ($order_by == 'name') $order_by_prefix = 'pl';elseif ($order_by == 'manufacturer'){ $order_by_prefix = 'm'; $order_by = 'name';} elseif ($order_by == 'position') $order_by_prefix = 'cp'; if ($order_by == 'price') $order_by = 'orderprice';
Функция сортировки productSort в файле FrontController.php использует значения из админки.Код: [Выделить]// $this->orderBy = Tools::getProductsOrder('by', Tools::getValue('orderby'));// $this->orderWay = Tools::getProductsOrder('way', Tools::getValue('orderway'));// 'orderbydefault' => Tools::getProductsOrder('by'),// 'orderwayposition' => Tools::getProductsOrder('way'), // Deprecated: orderwayposition// 'orderwaydefault' => Tools::getProductsOrder('way'),class ToolsКод: [Выделить]/*** Get products order field name for queries.** @param string $type by|way* @param string $value If no index given, use default order from admin -> pref -> products* @param bool|\bool(false)|string $prefix** @return string Order by sql clause*/public static function getProductsOrder($type, $value = null, $prefix = false){Добавить нужно еще одно значение по полю "available_for_order" из таблицы "ps_product p"
// $this->orderBy = Tools::getProductsOrder('by', Tools::getValue('orderby'));// $this->orderWay = Tools::getProductsOrder('way', Tools::getValue('orderway'));// 'orderbydefault' => Tools::getProductsOrder('by'),// 'orderwayposition' => Tools::getProductsOrder('way'), // Deprecated: orderwayposition// 'orderwaydefault' => Tools::getProductsOrder('way'),
/*** Get products order field name for queries.** @param string $type by|way* @param string $value If no index given, use default order from admin -> pref -> products* @param bool|\bool(false)|string $prefix** @return string Order by sql clause*/public static function getProductsOrder($type, $value = null, $prefix = false){
И что это даст? Как мне указать какой товар приоритетный?
$order_by = 'по какому полю сортировать'