cart->get_items(); $query_where = ''; // Показывать в списке отключенные товары, если у них имеются включенные варианты: if (!$admin_mode) { $ignore_check = true; $query_where = "(a.`Checked` = 1 OR (a.`Checked` = 0 AND (" . "SELECT `Message_ID` FROM `Message$classID` as `child` " . " WHERE `child`.`Parent_Message_ID` = a.`Message_ID` AND `child`.`Checked` = 1 " . " LIMIT 1" . ")))"; } // Поля, которые отличают варианты друг от друга $variant_fields = json_decode(nc_array_value($cc_settings, 'variant_fields', '[]'), true) ?: array(); // Инициализация и применение фильтра (кроме страницы объекта) if ((!isset($action) || $action !== 'full') && !empty($isMainContent)) { // Поля фильтра можно выбрать в режиме редактирования в блоке фильтра $filter_fields = json_decode(nc_array_value($cc_settings, 'filter_fields', '[]'), true) ?: array(); $netshop->filter->init_fields($filter_fields); $netshop->filter->options('list_field', 'checkbox'); $netshop->filter->query_where($query_where); // Инициализация формы фильтра (выводится в отдельном компоненте netcat_module_netshop_filter // через макрофункцию %NETCAT_NETSHOP_FILTER_FORM%) $netshop->filter->init_form_macro(); } // Сортировка результатов $price_column = 'Price'; $sort_by = (string)$nc_core->input->fetch_get('order_by'); $sorting_methods = array( '' => array( 'query_order' => "", 'title' => 'по умолчанию', 'query_select' => '', ), 'price asc' => array( 'query_order' => "`__PriceRange` ASC", 'title' => 'по возрастанию цены', 'query_select' => "(IF(`Price` = 0 OR `$price_column` IS NULL," . "(SELECT MIN(`$price_column`) FROM `Message$classID` AS pr WHERE pr.`Parent_Message_ID` = a.`Message_ID`), " . "`Price`)) AS `__PriceRange`", ), 'price desc' => array( 'query_order' => "`__PriceRange` DESC", 'title' => 'по убыванию цены', 'query_select' => "(IF(`Price` = 0 OR `$price_column` IS NULL," . "(SELECT MIN(`$price_column`) FROM `Message$classID` AS pr WHERE pr.`Parent_Message_ID` = a.`Message_ID`), " . "`Price`)) AS `__PriceRange`", ), 'name' => array( 'query_order' => "`Name` ASC", 'title' => 'по алфавиту', 'query_select' => '', ), ); if (isset($sorting_methods[$sort_by])) { $query_order = $sorting_methods[$sort_by]['query_order']; $query_select .= $sorting_methods[$sort_by]['query_select']; } $size = $cc_settings['object_size']; if ($cc_settings['object_size'] === 'custom') { $size = $cc_settings['custom_size']; } list($w, $h) = explode(":", str_replace(",", ".", $size)); if ((float)$w > 0) { $padding_top = str_replace(",", ".", ($h / $w) * 100) . "%"; $full_image_ratio = str_replace(",", ".", ($w / $h)); } else { $padding_top = '100%'; $full_image_ratio = 1; } $goods_item_styles = array(); $goods_item_styles[] = "--item-image-padding-top: " . $padding_top; $goods_item_styles[] = "--item-image-fit: " . $cc_settings['image_format']; $goods_item_styles = " style='" . implode(";", $goods_item_styles) . "'"; if (!function_exists('current_link')) { function current_link($params, $val = null) { if (!is_array($params)) { $params = array($params => ($val == '' ? null : $val)); } if ($get = nc_core('input')->fetch_get()) { $params = array_merge($get, $params); } global $cc_array, $cc, $sub; if (count($cc_array) === 1 || $cc_array[0] == $cc) { return nc_folder_path($sub, null, $params); } else { return nc_infoblock_path($cc, 'index', 'html', null, $params); } } } if (!function_exists('nc_netshop_goods_scripts')) { function nc_netshop_goods_scripts() { global $btn_in_compare_text, $netshop; global $btn_not_in_compare_text; global $current_catalogue; ob_start(); ?>