/** * Get available product sortings * @return array - [sort_label, sort_order, sort_by] */ function fn_twg_get_sortings() { $sortings = fn_get_products_sorting(false); $sorting_orders = fn_get_products_sorting_orders(); $avail_sorting = Registry::get('settings.Appearance.available_product_list_sortings'); $default_sorting = fn_get_default_products_sorting(); $result = array($default_sorting); $result[0]['sort_label'] = __('sort_by_' . $default_sorting['sort_by'] . '_' . $default_sorting['sort_order']); // Reverse sorting (for usage in view) $default_sorting['sort_order'] = $default_sorting['sort_order'] == 'asc' ? 'desc' : 'asc'; foreach ($sortings as $option => $value) { if ($default_sorting['sort_by'] == $option) { $sort_order = $default_sorting['sort_order']; } else { if ($value['default_order']) { $sort_order = $value['default_order']; } else { $sort_order = 'asc'; } } foreach ($sorting_orders as $sort_order) { if ($default_sorting['sort_by'] != $option or $default_sorting['sort_order'] == $sort_order) { if (!$avail_sorting or !empty($avail_sorting[$option . '-' . $sort_order]) and $avail_sorting[$option . '-' . $sort_order] == 'Y') { $result[] = array('sort_by' => $option, 'sort_order' => $sort_order, 'sort_label' => __('sort_by_' . $option . '_' . $sort_order)); } } } } return $result; }
function content_55ccf2ea3eb161_07733351($_smarty_tpl) { if (!is_callable('smarty_modifier_replace')) { include '/home/coriolan/public_html/lead/app/lib/other/smarty/plugins/modifier.replace.php'; } $_smarty_tpl->tpl_vars["curl"] = new Smarty_variable(fn_query_remove($_smarty_tpl->tpl_vars['config']->value['current_url'], "sort_by", "sort_order", "result_ids", "layout"), null, 0); ?> <?php $_smarty_tpl->tpl_vars["sorting"] = new Smarty_variable(fn_get_products_sorting(''), null, 0); ?> <?php $_smarty_tpl->tpl_vars["sorting_orders"] = new Smarty_variable(fn_get_products_sorting_orders(''), null, 0); ?> <?php $_smarty_tpl->tpl_vars["layouts"] = new Smarty_variable(fn_get_products_views('', false, false), null, 0); ?> <?php $_smarty_tpl->tpl_vars["pagination_id"] = new Smarty_variable(($tmp = @$_smarty_tpl->tpl_vars['id']->value) === null || $tmp === '' ? "pagination_contents" : $tmp, null, 0); ?> <?php $_smarty_tpl->tpl_vars["avail_sorting"] = new Smarty_variable($_smarty_tpl->tpl_vars['settings']->value['Appearance']['available_product_list_sortings'], null, 0); ?> <?php if (!(count($_smarty_tpl->tpl_vars['category_data']->value['selected_layouts']) == 1 || count($_smarty_tpl->tpl_vars['category_data']->value['selected_layouts']) == 0 && count(fn_get_products_views('', true)) <= 1) && !$_smarty_tpl->tpl_vars['hide_layouts']->value) { ?> <div class="ty-sort-container__views-icons"> <?php $_smarty_tpl->tpl_vars["item"] = new Smarty_Variable(); $_smarty_tpl->tpl_vars["item"]->_loop = false; $_smarty_tpl->tpl_vars["layout"] = new Smarty_Variable(); $_from = $_smarty_tpl->tpl_vars['layouts']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars["item"]->key => $_smarty_tpl->tpl_vars["item"]->value) { $_smarty_tpl->tpl_vars["item"]->_loop = true; $_smarty_tpl->tpl_vars["layout"]->value = $_smarty_tpl->tpl_vars["item"]->key; ?> <?php if ($_smarty_tpl->tpl_vars['category_data']->value['selected_layouts'][$_smarty_tpl->tpl_vars['layout']->value] || !$_smarty_tpl->tpl_vars['category_data']->value['selected_layouts'] && $_smarty_tpl->tpl_vars['item']->value['active']) { ?> <?php if ($_smarty_tpl->tpl_vars['layout']->value == $_smarty_tpl->tpl_vars['selected_layout']->value) { ?> <?php $_smarty_tpl->tpl_vars['sort_order'] = new Smarty_variable($_smarty_tpl->tpl_vars['search']->value['sort_order_rev'], null, 0); ?> <?php } else { ?> <?php $_smarty_tpl->tpl_vars['sort_order'] = new Smarty_variable($_smarty_tpl->tpl_vars['search']->value['sort_order'], null, 0); ?> <?php } ?> <a class="ty-sort-container__views-a <?php echo htmlspecialchars($_smarty_tpl->tpl_vars['ajax_class']->value, ENT_QUOTES, 'UTF-8'); ?> <?php if ($_smarty_tpl->tpl_vars['layout']->value == $_smarty_tpl->tpl_vars['selected_layout']->value) { ?> active<?php } ?> " data-ca-target-id="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['pagination_id']->value, ENT_QUOTES, 'UTF-8'); ?> " href="<?php echo htmlspecialchars(fn_url((string) $_smarty_tpl->tpl_vars['curl']->value . "&sort_by=" . (string) $_smarty_tpl->tpl_vars['search']->value['sort_by'] . "&sort_order=" . (string) $_smarty_tpl->tpl_vars['sort_order']->value . "&layout=" . (string) $_smarty_tpl->tpl_vars['layout']->value), ENT_QUOTES, 'UTF-8'); ?> " rel="nofollow"> <i class="ty-icon-<?php echo htmlspecialchars(smarty_modifier_replace($_smarty_tpl->tpl_vars['layout']->value, "_", "-"), ENT_QUOTES, 'UTF-8'); ?> "></i> </a> <?php } ?> <?php } ?> </div> <?php } }
/** * Gets settings variants for 'Available product list sortings' option * * @return array Possible sortings for product list */ function fn_settings_variants_appearance_available_product_list_sortings() { $sortings = fn_get_products_sorting(); $orders = fn_get_products_sorting_orders(); $return = array(); foreach ($sortings as $option => $info) { foreach ($orders as $order) { if (!isset($info[$order]) || $info[$order] !== false) { $label = 'sort_by_' . $option . '_' . $order; $return[$option . '-' . $order] = __($label); } } } return $return; }
function content_55ccf2ea448c55_01077073($_smarty_tpl) { fn_preload_lang_vars(array('per_page')); ?> <div class="ty-sort-container"> <?php if (!$_smarty_tpl->tpl_vars['config']->value['tweaks']['disable_dhtml']) { ?> <?php $_smarty_tpl->tpl_vars["ajax_class"] = new Smarty_variable("cm-ajax", null, 0); ?> <?php } ?> <?php $_smarty_tpl->tpl_vars["curl"] = new Smarty_variable(fn_query_remove($_smarty_tpl->tpl_vars['config']->value['current_url'], "sort_by", "sort_order", "result_ids", "layout"), null, 0); ?> <?php $_smarty_tpl->tpl_vars["sorting"] = new Smarty_variable(fn_get_products_sorting(''), null, 0); ?> <?php $_smarty_tpl->tpl_vars["sorting_orders"] = new Smarty_variable(fn_get_products_sorting_orders(''), null, 0); ?> <?php $_smarty_tpl->tpl_vars["layouts"] = new Smarty_variable(fn_get_products_views('', false, false), null, 0); ?> <?php $_smarty_tpl->tpl_vars["pagination_id"] = new Smarty_variable(($tmp = @$_smarty_tpl->tpl_vars['id']->value) === null || $tmp === '' ? "pagination_contents" : $tmp, null, 0); ?> <?php $_smarty_tpl->tpl_vars["avail_sorting"] = new Smarty_variable($_smarty_tpl->tpl_vars['settings']->value['Appearance']['available_product_list_sortings'], null, 0); ?> <?php if ($_smarty_tpl->tpl_vars['search']->value['sort_order_rev'] == "asc") { ?> <?php $_smarty_tpl->_capture_stack[0][] = array("sorting_text", null, null); ob_start(); ?> <a><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['sorting']->value[$_smarty_tpl->tpl_vars['search']->value['sort_by']]['description'], ENT_QUOTES, 'UTF-8'); ?> <i class="ty-icon-up-dir"></i></a> <?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]); if (!empty($_capture_buffer)) { if (isset($_capture_assign)) { $_smarty_tpl->assign($_capture_assign, ob_get_contents()); } if (isset($_capture_append)) { $_smarty_tpl->append($_capture_append, ob_get_contents()); } Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean(); } else { $_smarty_tpl->capture_error(); } ?> <?php } else { ?> <?php $_smarty_tpl->_capture_stack[0][] = array("sorting_text", null, null); ob_start(); ?> <a><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['sorting']->value[$_smarty_tpl->tpl_vars['search']->value['sort_by']]['description'], ENT_QUOTES, 'UTF-8'); ?> <i class="ty-icon-down-dir"></i></a> <?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]); if (!empty($_capture_buffer)) { if (isset($_capture_assign)) { $_smarty_tpl->assign($_capture_assign, ob_get_contents()); } if (isset($_capture_append)) { $_smarty_tpl->append($_capture_append, ob_get_contents()); } Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean(); } else { $_smarty_tpl->capture_error(); } ?> <?php } ?> <?php if ($_smarty_tpl->tpl_vars['avail_sorting']->value) { ?> <?php echo $_smarty_tpl->getSubTemplate("common/sorting.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0); ?> <?php } ?> <?php $_smarty_tpl->tpl_vars["pagination"] = new Smarty_variable(fn_generate_pagination($_smarty_tpl->tpl_vars['search']->value), null, 0); ?> <?php if ($_smarty_tpl->tpl_vars['pagination']->value['total_items']) { ?> <?php $_smarty_tpl->tpl_vars["range_url"] = new Smarty_variable(fn_query_remove($_smarty_tpl->tpl_vars['curl']->value, "items_per_page", "page"), null, 0); ?> <?php $_smarty_tpl->tpl_vars["product_steps"] = new Smarty_variable(fn_get_product_pagination_steps($_smarty_tpl->tpl_vars['settings']->value['Appearance']['columns_in_products_list'], $_smarty_tpl->tpl_vars['settings']->value['Appearance']['products_per_page']), null, 0); ?> <!--div class="ty-sort-dropdown"> <a id="sw_elm_pagination_steps" class="ty-sort-dropdown__wrapper cm-combination"><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['pagination']->value['items_per_page'], ENT_QUOTES, 'UTF-8'); ?> <?php echo $_smarty_tpl->__("per_page"); ?> <i class="ty-sort-dropdown__icon ty-icon-down-micro"></i></a> <ul id="elm_pagination_steps" class="ty-sort-dropdown__content cm-popup-box hidden"> </ul> </div--> <?php } ?> </div><?php }