Добавить сортировку по номеру артикула в cs-cart

Добавляем в каталог app/addons/my_changes файл init.php

<?php

if (!defined('BOOTSTRAP')) { die('Access denied'); }

fn_register_hooks(
    'products_sorting'
);

и файл func.php

<?php

if (!defined('BOOTSTRAP')) { die('Access denied'); }

// Создаём функцию, которая подключится к хуку.
function fn_my_changes_products_sorting(&$sorting, $simple_mode) {

        $sorting = array(
        'null' => array('description' => __('none'), 'default_order' => 'asc', 'desc' => false),
        'timestamp' => array('description' => __('date'), 'default_order' => 'desc'),
        'position' => array('description' => __('default'), 'default_order' => 'asc'),
        'product' => array('description' => __('name'), 'default_order' => 'asc'),
        'price' => array('description' => __('price'), 'default_order' => 'asc'),
        'popularity' => array('description' => __('popularity'), 'default_order' => 'desc'),
        'code' => array('description' => __('code'), 'default_order' => 'desc')
    );

}
);

В языковые переменные добавляем названия типов сортировки.

Включаем модуль «Мои изменения».

Пользуемся.

Поделиться
Отправить
 86   2021   cs-cart
Популярное