Здравствуйте! Подскажите как сделать функционал “добавить в список сравнения” без ссылки по аналогии с “добавить в избранное”. Так как на всех страницах, где используются списки товаров, из-за этого появляется очень много ненужных (мусорных) ссылок такого вида https://unitheme.net/index.php?dispatch=product_features.add_product&product_id=304&redirect_url=index.php%3Fdispatch%3Dcategories.view%26category_id%3D166
Эти ссылки видят боты поисковиков и переходят по ним, тратят краулинговый бюджет на сканирование сайта попусту
<div id="compare_list_{$product_id}">
{assign var="status_compare" value=false}
{foreach from=$smarty.session.comparison_list item="comp"}
{if $comp == $product_id}
{assign var="status_compare" value=true}
{/if}
{/foreach}
{if !$config.tweaks.disable_dhtml}
{$ajax_class = "cm-ajax cm-ajax-full-render"}
{/if}
{if !$hide_compare_list_button}
{$c_url = $redirect_url|default: $config.current_url|escape:url}
{$compare_button_typ = $compare_button_typ|default: "icon"}
{$but_id = $compare_but_id|default: $but_id}
{$but_name = $compare_but_name|default: $but_name}
{$but_title = $compare_but_title|default: __("add_to_comparison_list")}
{$but_meta = $compare_but_meta|default: "ut2-add-to-compare $ajax_class"}
{if $status_compare}
{$but_href = "product_features.delete_product?product_id=$product_id&redirect_url=$c_url"|fn_url}
{$but_title = __("delete_from_comparison_list")}
<a class="ty-active
{if $but_meta}{$but_meta}{/if}
{if $details_page} label{/if}
{if $but_name} cm-submit{/if}
{if !$runtime.customization_mode.live_editor} cm-tooltip{/if}"
{if $but_title} title="{$but_title}" data-ce-tooltip-position="center"{/if}
{if $but_id} id="{$but_id}"{/if}
data-ca-target-id="compare_list*,comparison_list,account_info*,abt__ut2_compared_products"
{if $but_href} href="{$but_href|fn_url}"{/if}>
{if $compare_button_typ == "icon"}<i class="ut2-icon-baseline-equalizer"></i>{/if}
<span>{__("compared")}</span>
</a>
{else}
{$but_name = "dispatch[product_features.add..$product_id]"}
{$but_id = "button_compare_$product_id"}
<a class="
{if $but_meta}{$but_meta}{/if}
{if $details_page} label{/if}
{if $but_name} cm-submit{/if}
{if !$runtime.customization_mode.live_editor} cm-tooltip{/if}"
{if $but_title} title="{$but_title}" data-ce-tooltip-position="center"{/if}
{if $but_id} id="{$but_id}"{/if}
{if $but_name} data-ca-dispatch = {$but_name} {/if}
>
{if $compare_button_typ == "icon"}<i class="ut2-icon-baseline-equalizer"></i>{/if}
<span>{__("compare")}</span>
</a>
{/if}
{/if}
<!--compare_list_{$product_id}--></div>
оверрайд buttons/add_to_compare_list.tpl
правильно ли я Вас понял, надо заменить код в файле?\design\themes\abt__grtheme2\templates\buttons\add_to_compare_list.tpl
добавьте в свой модуль my_changes, чтобы не заменять код и не потерять при обновлении
у меня получается вот такое
и при нажатии пару секунд крутится но товар так и не добавляется к сравнению (кэш чистил)
тоесть, тут не так важно отображение (это не сложно поправить), а сама функция добавления к сравнению не срабатывает (не открывается popup окно)
Меняем кнопку:
Спойлер
{$comp_list = $smarty.session.comparison_list}
{* constant *}
{$compare_button_type = $compare_button_type|default:"icon"}
{$but_name = "dispatch[product_features.add_product..$product_id]"}
{$but_id = $compare_but_id|default:"button_compare_$product_id"}
{$but_role = $compare_but_role|default:"text"}
{$but_href = $compare_but_href|default:$but_href}
{$but_onclick = $compare_but_onclick|default:$but_onclick}
{* dynamic *}
{$but_title = $compare_but_title|default:__("add_to_comparison_list")}
{$but_meta = $compare_but_meta|default:"compare"}
{* change active *}
{if $comp_list && in_array($product_id, $comp_list)}
{$but_title = "Убрать из сравнения"}
{$but_meta = "compare uk-active"}
{/if}
{if $compare_button_type == "icon"}
{$but_icon = $compare_but_icon|default:"barchart"}
{$but_text = $compare_but_text|default:false}
{else}
{$but_icon = ($compare_but_icon === true) ? "barchart" : $compare_but_icon}
{$but_text = $compare_but_text|default:__("add_to_comparison_list")}
{/if}
{include file="buttons/button.tpl"
but_id=$but_id
but_meta=$but_meta
but_name=$but_name
but_text=$but_text
but_title=$but_title
but_role=$but_role
but_onclick=$but_onclick
but_href=$but_href
but_icon=$but_icon
}
И модифицируем контроллер product_features:
Спойлер
$list = 'features';
Tygh::$app['session']['excluded_features'] = isset(Tygh::$app['session']['excluded_features']) ? Tygh::$app['session']['excluded_features'] : [];
Tygh::$app['session']['comparison_list'] = isset(Tygh::$app['session']['comparison_list']) ? Tygh::$app['session']['comparison_list'] : [];
$comp_list = & Tygh::$app['session']['comparison_list'];
/*$auth = & Tygh::$app['session']['auth'];*/
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Add feature to comparison list
if ($mode === 'add_feature') {
if (!empty($_REQUEST['add_features'])) {
Tygh::$app['session']['excluded_features'] = array_diff(Tygh::$app['session']['excluded_features'], $_REQUEST['add_features']);
}
}
if ($mode === 'add_product') {
if (empty($comp_list)) $comp_list = array();
$list = $_REQUEST['product_data'];
foreach($list as $item) {
$p_id = (int)$item['product_id'];
}
if (!in_array($p_id, $comp_list)) {
array_unshift($comp_list, $p_id);
$product_data = fn_get_product_data($p_id, $auth);
}
if (defined('AJAX_REQUEST')) {
if (!empty($product_data)) {
fn_gather_additional_product_data($product_data, true, true);
$product_data['amount'] = 1;
$product_data['display_price'] = $product_data['price'];
$added_products = [$p_id => $product_data];
Tygh::$app['view']->assign('added_products', $added_products);
fn_set_notification('N', __('notice'), __('product_added_to_cl'));
} else {
$key = array_search($p_id, $comp_list);
unset($comp_list[$key]);
fn_set_notification('W', __('notice'), "Товар удалён из списка избранного");
}
} else {
unset($_REQUEST['redirect_url']);
}
}
return [CONTROLLER_STATUS_OK];
}
// Add product to comparison list
if ($mode === 'add_product') {
...
В common/product_data указываем id блоков, в которых будут ссылки и кнопки:
<input type="hidden" name="result_ids" value="cart_status*,comp_list*,wish_list*,checkout*,account_info*" />
Получилось вот так: CS Cart: избранное и сравнение ajax - YouTube
Полдскажите как переписать add_to_compare_list.tpl
{if !$config.tweaks.disable_dhtml}
{$ajax_class = "cm-ajax cm-ajax-full-render"}
{/if}
{if !$hide_compare_list_button}
{$c_url = $redirect_url|default: $config.current_url|escape:url}
{$compare_button_type = $compare_button_type|default: "icon"}
{$but_title = $compare_but_title|default: __("add_to_comparison_list")}
{$but_href = $compare_but_href|default: "product_features.add_product?product_id=$product_id&redirect_url=$c_url"}
{$but_role = $compare_but_role|default: "text"}
{$but_target_id = $compare_but_target_id|default:"comparison_list,account_info*"}
{$but_rel = $compare_but_rel|default: "nofollow"}
{if $compare_button_type == "icon"}
{$but_icon = $compare_but_icon|default: "ty-icon-chart-bar"}
{$but_text = $compare_but_text|default: false}
{$but_meta = $compare_but_meta|default: "ty-btn__tertiary ty-btn-icon ty-add-to-compare $ajax_class"}
{else}
{$but_icon = ($compare_but_icon === true) ? "ty-icon-chart-bar" : $compare_but_icon}
{$but_text = $compare_but_text|default: __("add_to_comparison_list")}
{$but_meta = $compare_but_meta|default: "ty-btn__text ty-add-to-compare $ajax_class"}
{/if}
{include file="buttons/button.tpl"
but_text=$but_text
but_title=$but_title
but_href=$but_href
but_role=$but_role
but_target_id=$but_target_id
but_meta=$but_meta
but_rel=$but_rel
but_icon=$but_icon
}
{/if}
/design/themes/responsive/templates/addons/my_changes/overrides/buttons/add_to_compare_list.tpl
Через модуль Мои изменения можно так
Да, но что там прописывать?
Видел но пока не разобрался
я так понял этот кусок
[quote="BillBoard, post:7, topic:13934"]
Tygh::$app[‘session’][‘excluded_features’] = isset(Tygh::$app[‘session’][‘excluded_features’]) ? Tygh::$app[‘session’][‘excluded_features’] : ;
Tygh::$app[‘session’][‘comparison_list’] = isset(Tygh::$app[‘session’][‘comparison_list’]) ? Tygh::$app[‘session’][‘comparison_list’] : ;
$comp_list = & Tygh::$app[‘session’][‘comparison_list’];
/$auth = & Tygh::$app[‘session’][‘auth’];/
[/quote]
.......
// Add product to comparison list
if ($mode === 'add_product') {
...
надо дописать в контроллер product_features? а не изменять его
Верно, это добавление ajax для нажатия/отжатия кнопки избранного.
ЗЫ. Наверное это можно сделать по-православному — через my_changes, но я так до конца с ним не разобрался, фигачу в ядро )
что-то видимо делаю не так - не работает * CS-Cartv4.18.4
product_features.php
[details="Спойлер"]
<?php
/***************************************************************************
* *
* (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev *
* *
* This is commercial software, only users who have purchased a valid *
* license and accept to the terms of the License Agreement can install *
* and use this program. *
* *
****************************************************************************
* PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
****************************************************************************/
use Tygh\Enum\ObjectStatuses;
use Tygh\Enum\ProductFeatures;
use Tygh\Enum\ProductFeaturesDisplayOn;
use Tygh\Registry;
defined('BOOTSTRAP') or die('Access denied');
/**
* @var string $mode
* @var array $auth
*/
$_REQUEST['variant_id'] = empty($_REQUEST['variant_id']) ? 0 : $_REQUEST['variant_id'];
if (empty($action)) {
$action = 'show_all';
}
$list = 'features';
Tygh::$app['session']['excluded_features'] = isset(Tygh::$app['session']['excluded_features']) ? Tygh::$app['session']['excluded_features'] : [];
Tygh::$app['session']['comparison_list'] = isset(Tygh::$app['session']['comparison_list']) ? Tygh::$app['session']['comparison_list'] : [];
$comp_list = & Tygh::$app['session']['comparison_list'];
/*$auth = & Tygh::$app['session']['auth'];*/
if (empty(Tygh::$app['session']['excluded_features'])) {
Tygh::$app['session']['excluded_features'] = [];
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Add feature to comparison list
if ($mode === 'add_feature') {
if (!empty($_REQUEST['add_features'])) {
Tygh::$app['session']['excluded_features'] = array_diff(Tygh::$app['session']['excluded_features'], $_REQUEST['add_features']);
}
}
return [CONTROLLER_STATUS_OK];
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Add feature to comparison list добавление ajax для нажатия/отжатия кнопки избранного
if ($mode === 'add_feature') {
if (!empty($_REQUEST['add_features'])) {
Tygh::$app['session']['excluded_features'] = array_diff(Tygh::$app['session']['excluded_features'], $_REQUEST['add_features']);
}
}
if ($mode === 'add_product') {
if (empty($comp_list)) $comp_list = array();
$list = $_REQUEST['product_data'];
foreach($list as $item) {
$p_id = (int)$item['product_id'];
}
if (!in_array($p_id, $comp_list)) {
array_unshift($comp_list, $p_id);
$product_data = fn_get_product_data($p_id, $auth);
}
if (defined('AJAX_REQUEST')) {
if (!empty($product_data)) {
fn_gather_additional_product_data($product_data, true, true);
$product_data['amount'] = 1;
$product_data['display_price'] = $product_data['price'];
$added_products = [$p_id => $product_data];
Tygh::$app['view']->assign('added_products', $added_products);
fn_set_notification('N', __('notice'), __('product_added_to_cl'));
} else {
$key = array_search($p_id, $comp_list);
unset($comp_list[$key]);
fn_set_notification('W', __('notice'), "Товар удалён из списка избранного");
}
} else {
unset($_REQUEST['redirect_url']);
}
}
return [CONTROLLER_STATUS_OK];
}
// Add product to comparison list
if ($mode === 'add_product') {
if (empty(Tygh::$app['session']['comparison_list'])) {
Tygh::$app['session']['comparison_list'] = [];
}
$p_id = (int) $_REQUEST['product_id'];
if (!in_array($p_id, Tygh::$app['session']['comparison_list'])) {
$product_data = fn_get_product_data($p_id, $auth);
if (!$product_data) {
return [CONTROLLER_STATUS_REDIRECT];
}
array_unshift(Tygh::$app['session']['comparison_list'], $p_id);
fn_gather_additional_product_data($product_data, true, true);
$product_data['amount'] = 1;
$product_data['display_price'] = $product_data['price'];
$added_products = [
$p_id => $product_data
];
Tygh::$app['view']->assign('added_products', $added_products);
/*fn_set_notification(
'I',
__('product_added_to_cl'),
Tygh::$app['view']->fetch('views/product_features/components/product_notification.tpl'),
'I'
);*/
} else {
fn_set_notification('W', __('notice'), __('product_in_comparison_list'));
}
return [CONTROLLER_STATUS_REDIRECT];
} elseif ($mode === 'clear_list') {
unset(Tygh::$app['session']['comparison_list']);
unset(Tygh::$app['session']['excluded_features']);
if (defined('AJAX_REQUEST')) {
Tygh::$app['view']->assign('compared_products', []);
Tygh::$app['view']->display('blocks/static_templates/feature_comparison.tpl');
exit;
}
return [CONTROLLER_STATUS_REDIRECT];
} elseif ($mode === 'delete_product' && !empty($_REQUEST['product_id'])) {
$key = array_search($_REQUEST['product_id'], Tygh::$app['session']['comparison_list']);
unset(Tygh::$app['session']['comparison_list'][$key]);
return [CONTROLLER_STATUS_REDIRECT];
} elseif ($mode === 'delete_feature') {
Tygh::$app['session']['excluded_features'][] = $_REQUEST['feature_id'];
return [CONTROLLER_STATUS_REDIRECT];
} elseif ($mode === 'compare') {
fn_add_breadcrumb(__('feature_comparison'));
if (!empty(Tygh::$app['session']['comparison_list'])) {
$comparison_data = fn_get_product_data_for_compare((array) Tygh::$app['session']['comparison_list'], $action);
Tygh::$app['session']['comparison_list'] = [];
if (!empty($comparison_data['products'])) {
Tygh::$app['session']['comparison_list'] = array_column($comparison_data['products'], 'product_id');
}
Tygh::$app['view']->assign('comparison_data', $comparison_data);
Tygh::$app['view']->assign('total_products', count(Tygh::$app['session']['comparison_list']));
}
Tygh::$app['view']->assign('list', $list);
Tygh::$app['view']->assign('action', $action);
if (!empty(Tygh::$app['session']['continue_url'])) {
Tygh::$app['view']->assign('continue_url', Tygh::$app['session']['continue_url']);
}
}
if ($mode === 'view_all') {
$filter_id = !empty($_REQUEST['filter_id']) ? $_REQUEST['filter_id'] : 0;
if (empty($filter_id)) {
return [CONTROLLER_STATUS_NO_PAGE];
}
if (isset($_REQUEST['order_ids'])) {
$order_ids = is_array($_REQUEST['order_ids']) ? $_REQUEST['order_ids'] : explode(',', $_REQUEST['order_ids']);
foreach ($order_ids as $order_id) {
/** @psalm-suppress UndefinedGlobalVariable */
if (!fn_is_order_allowed($order_id, $auth)) {
unset($_REQUEST['order_ids']);
break;
}
}
}
list($filters) = fn_product_filters_get_filters_products_count($_REQUEST);
if (empty($filters[$filter_id]) || $filters[$filter_id]['feature_type'] !== ProductFeatures::EXTENDED) {
return [CONTROLLER_STATUS_NO_PAGE];
}
fn_add_breadcrumb($filters[$filter_id]['filter']);
$variants = [];
if (!empty($filters[$filter_id]['variants'])) {
foreach ($filters[$filter_id]['variants'] as $variant) {
$variants[fn_strtoupper(fn_substr($variant['variant'], 0, 1))][] = $variant;
}
}
ksort($variants, SORT_STRING);
Tygh::$app['view']->assign('variants', $variants);
} elseif ($mode === 'view') {
$variant_data = fn_get_product_feature_variant($_REQUEST['variant_id']);
$variant_id = $_REQUEST['variant_id'];
$status_variant = db_get_field(
'SELECT ?:product_features.status FROM ?:product_features'
. ' INNER JOIN ?:product_feature_variants ON ?:product_features.feature_id = ?:product_feature_variants.feature_id'
. ' WHERE ?:product_feature_variants.variant_id = ?i',
$variant_id
);
if (empty($variant_data) || $status_variant === ObjectStatuses::DISABLED) {
return [CONTROLLER_STATUS_NO_PAGE];
} else {
$feature_data = fn_get_product_feature_data($variant_data['feature_id']);
if (empty($feature_data)) {
return [CONTROLLER_STATUS_NO_PAGE];
}
}
Tygh::$app['view']->assign('variant_data', $variant_data);
fn_add_breadcrumb($variant_data['variant']);
// Override meta description/keywords
if (!empty($variant_data['meta_description']) || !empty($variant_data['meta_keywords'])) {
Tygh::$app['view']->assign('meta_description', $variant_data['meta_description']);
Tygh::$app['view']->assign('meta_keywords', $variant_data['meta_keywords']);
}
// Override page title
if (!empty($variant_data['page_title'])) {
Tygh::$app['view']->assign('page_title', $variant_data['page_title']);
}
$params = $_REQUEST;
$params['extend'] = ['description'];
if ($items_per_page = fn_change_session_param(Tygh::$app['session']['search_params'], $_REQUEST, 'items_per_page')) {
$params['items_per_page'] = $items_per_page;
}
if ($sort_by = fn_change_session_param(Tygh::$app['session']['search_params'], $_REQUEST, 'sort_by')) {
$params['sort_by'] = $sort_by;
}
if ($sort_order = fn_change_session_param(Tygh::$app['session']['search_params'], $_REQUEST, 'sort_order')) {
$params['sort_order'] = $sort_order;
}
if (isset($params['order_ids'])) {
$order_ids = is_array($params['order_ids']) ? $params['order_ids'] : explode(',', $params['order_ids']);
foreach ($order_ids as $order_id) {
/** @psalm-suppress UndefinedGlobalVariable */
if (!fn_is_order_allowed($order_id, $auth)) {
return [CONTROLLER_STATUS_NO_PAGE];
}
}
}
list($products, $search) = fn_get_products($params, Registry::get('settings.Appearance.products_per_page'));
if (isset($search['page']) && ($search['page'] > 1) && empty($products) && (!defined('AJAX_REQUEST'))) {
return [CONTROLLER_STATUS_NO_PAGE];
}
fn_filters_handle_search_result($params, $products, $search);
fn_gather_additional_products_data($products, [
'get_icon' => true,
'get_detailed' => true,
'get_options' => true,
'get_discounts' => true,
'get_features' => false
]);
$selected_layout = fn_get_products_layout($_REQUEST);
Tygh::$app['view']->assign('products', $products);
Tygh::$app['view']->assign('search', $search);
Tygh::$app['view']->assign('selected_layout', $selected_layout);
}
/**
* Gets data for compare products
*
* @param array<int> $product_ids Product IDs
* @param string $action Action
*
* @return array
*
* @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification
*/
function fn_get_product_data_for_compare(array $product_ids, $action)
{
$auth = & Tygh::$app['session']['auth'];
$comparison_data = [
'product_features' => [0 => []]
];
foreach ($product_ids as $product_id) {
$product_data = fn_get_product_data($product_id, $auth, CART_LANGUAGE, '', false, true, false, false, false, false);
if (empty($product_data)) {
continue;
}
$product_data['detailed_params']['features_compare'] = true;
$params = [
'get_icon' => true,
'get_detailed' => true,
'get_options' => true,
'get_discounts' => true,
'get_features' => true,
'features_display_on' => ProductFeaturesDisplayOn::ALL
];
fn_gather_additional_products_data($product_data, $params);
if (!empty($product_data['product_features'])) {
foreach ($product_data['product_features'] as $k => $v) {
if (!empty($v['variants'])) {
foreach ($v['variants'] as $key => $variant) {
$product_data['product_features'][$k]['variants'][$key]['selected'] = $variant['variant_id'];
}
}
if ($v['display_on_product'] === 'N' && $v['display_on_catalog'] === 'N' && $v['display_on_header'] === 'N') {
continue;
}
if ($v['feature_type'] === ProductFeatures::GROUP && empty($v['subfeatures'])) {
continue;
}
$_features = ($v['feature_type'] === ProductFeatures::GROUP) ? $v['subfeatures'] : [$k => $v];
$group_id = ($v['feature_type'] === ProductFeatures::GROUP) ? $k : 0;
$comparison_data['feature_groups'][$k] = $v['description'];
foreach ($_features as $_k => $_v) {
if (in_array($_k, Tygh::$app['session']['excluded_features'])) {
if (empty($comparison_data['hidden_features'][$_k])) {
$comparison_data['hidden_features'][$_k] = $_v['description'];
}
continue;
}
if (empty($comparison_data['product_features'][$group_id][$_k])) {
$comparison_data['product_features'][$group_id][$_k] = $_v['description'];
}
}
}
}
$comparison_data['products'][] = $product_data;
unset($product_data);
}
if ($action !== 'show_all' && !empty($comparison_data['product_features'])) {
$value = '';
foreach ($comparison_data['product_features'] as $group_id => $v) {
foreach (array_keys($v) as $feature_id) {
unset($value);
$c = $action === 'similar_only';
foreach ($comparison_data['products'] as $product) {
$features = !empty($group_id) && isset($product['product_features'][$group_id]['subfeatures'])
? $product['product_features'][$group_id]['subfeatures']
: $product['product_features'];
if (empty($features[$feature_id])) {
$c = !$c;
break;
}
if (!isset($value)) {
$value = fn_get_feature_selected_value($features[$feature_id]);
continue;
//phpcs:ignore SlevomatCodingStandard.Operators.DisallowEqualOperators.DisallowedNotEqualOperator
} elseif ($value != fn_get_feature_selected_value($features[$feature_id])) {
$c = !$c;
break;
}
}
if ($c === false) {
unset($comparison_data['product_features'][$group_id][$feature_id]);
}
}
}
}
return !empty($comparison_data['products']) ? $comparison_data : [];
}
/**
* Gets selected value from product feature
*
* @param array $feature Product feature data
*
* @return array|mixed
*
* @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingTraversableTypeHintSpecification
* @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification
* @phpcsSuppress SlevomatCodingStandard.TypeHints.DisallowMixedTypeHint.DisallowedMixedTypeHint
*/
function fn_get_feature_selected_value(array $feature)
{
$value = null;
if (strpos(ProductFeatures::getSelectable(), $feature['feature_type']) !== false) {
if ($feature['feature_type'] === ProductFeatures::MULTIPLE_CHECKBOX) {
foreach ($feature['variants'] as $v) {
if ($v['selected']) {
$value[] = $v['variant_id'];
}
}
} else {
$value = $feature['variant_id'];
}
} elseif (strpos(ProductFeatures::NUMBER_FIELD . ProductFeatures::DATE, $feature['feature_type']) !== false) {
$value = $feature['value_int'];
} else {
$value = $feature['value'];
}
return $value;
}
[/details]
/design/themes/responsive/templates/buttons/add_to_compare_list.tpl
[details="Спойлер"]
{$comp_list = $smarty.session.comparison_list}
{* constant *}
{$compare_button_type = $compare_button_type|default:"icon"}
{$but_name = "dispatch[product_features.add_product..$product_id]"}
{$but_id = $compare_but_id|default:"button_compare_$product_id"}
{$but_role = $compare_but_role|default:"text"}
{$but_href = $compare_but_href|default:$but_href}
{$but_onclick = $compare_but_onclick|default:$but_onclick}
{* dynamic *}
{$but_title = $compare_but_title|default:__("add_to_comparison_list")}
{$but_meta = $compare_but_meta|default:"compare"}
{* change active *}
{if $comp_list && in_array($product_id, $comp_list)}
{$but_title = "Убрать из сравнения"}
{$but_meta = "compare uk-active"}
{/if}
{if $compare_button_type == "icon"}
{$but_icon = $compare_but_icon|default:"barchart"}
{$but_text = $compare_but_text|default:false}
{else}
{$but_icon = ($compare_but_icon === true) ? "barchart" : $compare_but_icon}
{$but_text = $compare_but_text|default:__("add_to_comparison_list")}
{/if}
{include file="buttons/button.tpl"
but_id=$but_id
but_meta=$but_meta
but_name=$but_name
but_text=$but_text
but_title=$but_title
but_role=$but_role
but_onclick=$but_onclick
but_href=$but_href
but_icon=$but_icon
}
[/details]
/design/themes/responsive/templates/views/products/view.tpl
[details="Спойлер"]
{capture name="val_hide_form"}{/capture}
{capture name="val_capture_options_vs_qty"}{/capture}
{capture name="val_capture_buttons"}{/capture}
{capture name="val_no_ajax"}{/capture}
{hook name="products:layout_content"}
{* NOTE: One of the selected product templates will be connected, depending on the 'Product details view' setting.
You can find product templates in the following directory: responsive/templates/blocks/product_templates/
Below are the display parameters we send to the product template.
*}
{include
file=$product.product_id|fn_get_product_details_view
product=$product
show_sku=true
show_rating=true
show_old_price=true
show_price=true
show_list_discount=true
show_clean_price=true
details_page=true
show_product_labels=true
show_discount_label=true
show_shipping_label=true
show_product_amount=true
show_product_options=true
hide_form=$smarty.capture.val_hide_form
min_qty=true
show_edp=true
capture_buttons=$smarty.capture.val_capture_buttons
capture_options_vs_qty=$smarty.capture.val_capture_options_vs_qty
separate_buttons=$smarty.capture.val_separate_buttons
show_add_to_cart=$show_add_to_cart|default:true
show_list_buttons=true
but_role="action"
block_width=true
no_ajax=$smarty.capture.val_no_ajax
show_product_tabs=true
}
{/hook}
[/details]
/design/themes/responsive/templates/common/product_data.tpl
[details="Спойлер"]
{hook name="products:product_data_content"}
{$out_of_stock_text = __("text_out_of_stock")}
{$allow_negative_amount = $allow_negative_amount|default:$settings.General.allow_negative_amount}
{if ($product.price|floatval || $product.zero_price_action == "P" || $product.zero_price_action == "A" || (!$product.price|floatval && $product.zero_price_action == "R")) && !($settings.Checkout.allow_anonymous_shopping == "hide_price_and_add_to_cart" && !$auth.user_id)}
{$show_price_values = true}
{else}
{$show_price_values = false}
{/if}
{capture name="show_price_values"}{$show_price_values}{/capture}
{$cart_button_exists = false}
{$show_qty = $show_qty|default:true}
{$obj_id = $obj_id|default:$product.product_id}
{$product_amount = $product.inventory_amount|default:$product.amount}
{$show_sku_label = $show_sku_label|default:true}
{$show_amount_label = $show_amount_label|default:true}
{$show_out_of_stock_block = $show_out_of_stock_block|default:true}
{$show_add_to_cart_block = $show_add_to_cart_block|default:true}
{if !$config.tweaks.disable_dhtml && !$no_ajax}
{$is_ajax = true}
{/if}
{capture name="form_open_`$obj_id`"}
{if !$hide_form}
<form action="{""|fn_url}" method="post" name="product_form_{$obj_prefix}{$obj_id}" enctype="multipart/form-data" class="cm-disable-empty-files {if $is_ajax} cm-ajax cm-ajax-full-render cm-ajax-status-middle{/if} {if $form_meta}{$form_meta}{/if}">
<input type="hidden" name="result_ids" value="cart_status*,comp_list*,wish_list*,checkout*,account_info*" />
{if !$stay_in_cart}
<input type="hidden" name="redirect_url" value="{$redirect_url|default:$config.current_url}" />
{/if}
<input type="hidden" name="product_data[{$obj_id}][product_id]" value="{$product.product_id}" />
{/if}
{/capture}
{if $no_capture}
{$capture_name = "form_open_`$obj_id`"}
{$smarty.capture.$capture_name nofilter}
{/if}
{capture name="name_`$obj_id`"}
{hook name="products:product_name"}
{if $show_name}
{if $hide_links}<strong>{else}<a href="{"products.view?product_id=`$product.product_id`"|fn_url}" class="product-title" title="{$product.product|strip_tags}" {live_edit name="product:product:{$product.product_id}" phrase=$product.product}>{/if}{$product.product nofilter}{if $hide_links}</strong>{else}</a>{/if}
{elseif $show_trunc_name}
{if $hide_links}<strong>{else}<a href="{"products.view?product_id=`$product.product_id`"|fn_url}" class="product-title" title="{$product.product|strip_tags}" {live_edit name="product:product:{$product.product_id}" phrase=$product.product}>{/if}{$product.product|truncate:44:"...":true nofilter}{if $hide_links}</strong>{else}</a>{/if}
{/if}
{/hook}
{/capture}
{if $no_capture}
{$capture_name = "name_`$obj_id`"}
{$smarty.capture.$capture_name nofilter}
{/if}
{capture name="sku_`$obj_id`"}
{if $show_sku}
<div class="ty-control-group ty-sku-item cm-hidden-wrapper{if !$product.product_code} hidden{/if}" id="sku_update_{$obj_prefix}{$obj_id}">
<input type="hidden" name="appearance[show_sku]" value="{$show_sku}" />
{if $show_sku_label}
<label class="ty-control-group__label" id="sku_{$obj_prefix}{$obj_id}">{__("sku")}:</label>
{/if}
<span class="ty-control-group__item cm-reload-{$obj_prefix}{$obj_id}" id="product_code_{$obj_prefix}{$obj_id}">{$product.product_code}<!--product_code_{$obj_prefix}{$obj_id}--></span>
</div>
{/if}
{/capture}
{if $no_capture}
{$capture_name = "sku_`$obj_id`"}
{$smarty.capture.$capture_name nofilter}
{/if}
{capture name="rating_`$obj_id`"}
{hook name="products:data_block"}
{/hook}
{/capture}
{if $no_capture}
{$capture_name = "rating_`$obj_id`"}
{$smarty.capture.$capture_name nofilter}
{/if}
{capture name="add_to_cart_`$obj_id`"}
{if $show_add_to_cart}
<div class="cm-reload-{$obj_prefix}{$obj_id} {$add_to_cart_class}" id="add_to_cart_update_{$obj_prefix}{$obj_id}">
<input type="hidden" name="appearance[show_add_to_cart]" value="{$show_add_to_cart}" />
<input type="hidden" name="appearance[show_list_buttons]" value="{$show_list_buttons}" />
<input type="hidden" name="appearance[but_role]" value="{$but_role}" />
<input type="hidden" name="appearance[quick_view]" value="{$quick_view}" />
{strip}
{capture name="buttons_product"}
{hook name="products:add_to_cart"}
{if $product.has_options && !$show_product_options && !$details_page}
{if $but_role == "text"}
{$opt_but_role="text"}
{else}
{$opt_but_role="action"}
{/if}
{include file="buttons/button.tpl" but_id="button_cart_`$obj_prefix``$obj_id`" but_text=__("select_options") but_href="products.view?product_id=`$product.product_id`" but_role=$opt_but_role but_name="" but_meta="ty-btn__primary ty-btn__big"}
{else}
{hook name="products:add_to_cart_but_id"}
{$_but_id="button_cart_`$obj_prefix``$obj_id`"}
{/hook}
{if $extra_button}{$extra_button nofilter} {/if}
{include file="buttons/add_to_cart.tpl" but_id=$_but_id but_name="dispatch[checkout.add..`$obj_id`]" but_role=$but_role block_width=$block_width obj_id=$obj_id product=$product but_meta=$add_to_cart_meta}
{$cart_button_exists = true}
{/if}
{/hook}
{/capture}
{hook name="products:buttons_block"}
{if $show_add_to_cart_block
&& (
$product.zero_price_action !== "ProductZeroPriceActions::NOT_ALLOW_ADD_TO_CART"|enum
|| $product.price != 0
)
&& (
$settings.General.inventory_tracking === "YesNo::NO"|enum
|| $allow_negative_amount === "YesNo::YES"|enum
|| (
$product_amount > 0
&& $product_amount >= $product.min_qty
)
|| $product.tracking == "ProductTracking::DO_NOT_TRACK"|enum
|| $product.is_edp === "YesNo::YES"|enum
|| $product.out_of_stock_actions === "OutOfStockActions::BUY_IN_ADVANCE"|enum
)
|| (
$product.has_options
&& !$show_product_options
)}
{if $smarty.capture.buttons_product|trim != ' '}
{if $product.avail_since <= $smarty.const.TIME || (
$product.avail_since > $smarty.const.TIME && $product.out_of_stock_actions == "OutOfStockActions::BUY_IN_ADVANCE"|enum
)}
{$smarty.capture.buttons_product nofilter}
{/if}
{/if}
{elseif $show_out_of_stock_block
&& $settings.General.inventory_tracking !== "YesNo::NO"|enum
&& $allow_negative_amount !== "YesNo::YES"|enum
&& (
($product_amount <= 0 || $product_amount < $product.min_qty)
&& $product.tracking != "ProductTracking::DO_NOT_TRACK"|enum
)
&& $product.is_edp != "YesNo::YES"|enum
}
{hook name="products:out_of_stock_block"}
{$show_qty = false}
{if !$details_page}
{if (!$product.hide_stock_info && !(($product_amount <= 0 || $product_amount < $product.min_qty) && ($product.avail_since > $smarty.const.TIME)))}
<span class="ty-qty-out-of-stock ty-control-group__item" id="out_of_stock_info_{$obj_prefix}{$obj_id}"><a class="cm-dialog-opener cm-dialog-auto-size" href="{"pages.view?page_id=108"|fn_url}" data-ca-target-id="open_id_ajax1" >{$out_of_stock_text}</a></span>
<div id="open_id_ajax1" class="hidden" title="Оповестить"></div>
{/if}
{elseif ($product.out_of_stock_actions == "OutOfStockActions::SUBSCRIBE"|enum)}
<div id="subscribe_form_wrapper_{$obj_prefix}{$obj_id}"><!--subscribe_form_wrapper_{$obj_prefix}{$obj_id}--></div>
<script>
(function(_, $) {
$.ceAjax('request', fn_url('products.subscription_form?product_id={$product.product_id}&obj_id={$obj_id}{($obj_prefix) ? "&obj_prefix=`$obj_prefix`" : "" nofilter}'), {
hidden: true,
result_ids: 'subscribe_form_wrapper_{$obj_prefix}{$obj_id}'
});
}(Tygh, Tygh.$));
</script>
{include file="common/image_verification.tpl" option="track_product_in_stock"}
{/if}
{/hook}
{/if}
{if $show_list_buttons}
{capture name="product_buy_now_`$obj_id`"}
{$compare_product_id = $product.product_id}
{hook name="products:buy_now"}
{if $settings.General.enable_compare_products == "Y"}
{include file="buttons/add_to_compare_list.tpl" product_id=$compare_product_id}
{/if}
{/hook}
{/capture}
{$capture_buy_now = "product_buy_now_`$obj_id`"}
{if $smarty.capture.$capture_buy_now|trim}
{$smarty.capture.$capture_buy_now nofilter}
{/if}
{/if}
{if ($product.avail_since > $smarty.const.TIME)}
{include file="common/coming_soon_notice.tpl" avail_date=$product.avail_since add_to_cart=$product.out_of_stock_actions}
{/if}
{* Uncomment these lines in the overrides hooks for back-passing $cart_button_exists variable to the product_data template *}
{*if $cart_button_exists}
{capture name="cart_button_exists"}Y{/capture}
{/if*}
{/hook}
{/strip}
<!--add_to_cart_update_{$obj_prefix}{$obj_id}--></div>
{/if}
{/capture}
{if $smarty.capture.cart_button_exists}
{$cart_button_exists = true}
{/if}
{if $no_capture}
{$capture_name = "add_to_cart_`$obj_id`"}
{$smarty.capture.$capture_name nofilter}
{/if}
{capture name="product_features_`$obj_id`"}
{hook name="products:product_features"}
{if $show_features}
<div class="cm-reload-{$obj_prefix}{$obj_id}" id="product_data_features_update_{$obj_prefix}{$obj_id}">
<input type="hidden" name="appearance[show_features]" value="{$show_features}" />
{include file="views/products/components/product_features_short_list.tpl" features=$product|fn_get_product_features_list no_container=true}
<!--product_data_features_update_{$obj_prefix}{$obj_id}--></div>
{/if}
{/hook}
{/capture}
{if $no_capture}
{$capture_name = "product_features_`$obj_id`"}
{$smarty.capture.$capture_name nofilter}
{/if}
{capture name="prod_descr_`$obj_id`"}
{if $show_descr}
{if $product.short_description}
<div {live_edit name="product:short_description:{$product.product_id}"}>{$product.short_description nofilter}</div>
{else}
<div {live_edit name="product:full_description:{$product.product_id}" phrase=$product.full_description}>{$product.full_description|strip_tags|truncate:160 nofilter}</div>
{/if}
{/if}
{/capture}
{if $no_capture}
{$capture_name = "prod_descr_`$obj_id`"}
{$smarty.capture.$capture_name nofilter}
{/if}
{********************** Old Price *****************}
{capture name="old_price_`$obj_id`"}
{if $show_price_values && $show_old_price}
<span class="cm-reload-{$obj_prefix}{$obj_id}" id="old_price_update_{$obj_prefix}{$obj_id}">
{hook name="products:old_price"}
{if $product.discount}
{if !$product.included_tax}
<span class="ty-list-price ty-nowrap" id="line_old_price_{$obj_prefix}{$obj_id}">{if $details_page}{__("old_price")}: {/if}<span class="ty-strike">{include file="common/price.tpl" value=$product.original_price|default:$product.base_price - $product.tax_value span_id="old_price_`$obj_prefix``$obj_id`" class="ty-list-price ty-nowrap"}</span></span>
{else}
<span class="ty-list-price ty-nowrap" id="line_old_price_{$obj_prefix}{$obj_id}">{if $details_page}{__("old_price")}: {/if}<span class="ty-strike">{include file="common/price.tpl" value=$product.original_price|default:$product.base_price span_id="old_price_`$obj_prefix``$obj_id`" class="ty-list-price ty-nowrap"}</span></span>
{/if}
{elseif $product.list_discount}
{if !$product.included_tax}
<span class="ty-list-price ty-nowrap" id="line_list_price_{$obj_prefix}{$obj_id}">{if $details_page}<span class="list-price-label">{__("list_price")}:</span> {/if}<span class="ty-strike">{include file="common/price.tpl" value=$product.list_price - $product.tax_value span_id="list_price_`$obj_prefix``$obj_id`" class="ty-list-price ty-nowrap"}</span></span>
{else}
<span class="ty-list-price ty-nowrap" id="line_list_price_{$obj_prefix}{$obj_id}">{if $details_page}<span class="list-price-label">{__("list_price")}:</span> {/if}<span class="ty-strike">{include file="common/price.tpl" value=$product.list_price span_id="list_price_`$obj_prefix``$obj_id`" class="ty-list-price ty-nowrap"}</span></span>
{/if}
{/if}
{/hook}
<!--old_price_update_{$obj_prefix}{$obj_id}--></span>
{/if}
{/capture}
{if $no_capture}
{$capture_name = "old_price_`$obj_id`"}
{$smarty.capture.$capture_name nofilter}
{/if}
{********************** Price *********************}
{capture name="price_`$obj_id`"}
<span class="{if $product.zero_price_action !== "A"}cm-reload-{$obj_prefix}{$obj_id}{/if} ty-price-update" id="price_update_{$obj_prefix}{$obj_id}">
<input type="hidden" name="appearance[show_price_values]" value="{$show_price_values}" />
<input type="hidden" name="appearance[show_price]" value="{$show_price}" />
{if $show_price_values}
{if $show_price}
{hook name="products:prices_block"}
{if $auth.tax_exempt === "{"YesNo::NO"|enum}" || !$product.clean_price}
{$price = $product.price}
{else}
{$price = $product.clean_price}
{/if}
{if $price|floatval || $product.zero_price_action == "P" || ($hide_add_to_cart_button == "Y" && $product.zero_price_action == "A")}
<span class="ty-price{if !$price|floatval && !$product.zero_price_action} hidden{/if}" id="line_discounted_price_{$obj_prefix}{$obj_id}">{include file="common/price.tpl" value=$price span_id="discounted_price_`$obj_prefix``$obj_id`" class="ty-price-num" live_editor_name="product:price:{$product.product_id}" live_editor_phrase=$product.base_price}</span>
{elseif $product.zero_price_action == "A" && $show_add_to_cart}
{$base_currency = $currencies[$smarty.const.CART_PRIMARY_CURRENCY]}
<span class="ty-price-curency"><span class="ty-price-curency__title">{__("enter_your_price")}:</span>
<div class="ty-price-curency-input">
<input
type="text"
name="product_data[{$obj_id}][price]"
class="ty-price-curency__input cm-numeric"
data-a-sign="{$base_currency.symbol nofilter}"
data-a-dec="{if $base_currency.decimals_separator}{$base_currency.decimals_separator nofilter}{else}.{/if}"
data-a-sep="{if $base_currency.thousands_separator}{$base_currency.thousands_separator nofilter}{else},{/if}"
data-p-sign="{if $base_currency.after === "YesNo::YES"|enum}s{else}p{/if}"
data-m-dec="{$base_currency.decimals}"
size="3"
value=""
/>
</div>
</span>
{elseif $product.zero_price_action == "R"}
<span class="ty-no-price">{__("contact_us_for_price")}</span>
{$show_qty = false}
{/if}
{/hook}
{/if}
{elseif $settings.Checkout.allow_anonymous_shopping == "hide_price_and_add_to_cart" && !$auth.user_id}
<span class="ty-price">{__("sign_in_to_view_price")}</span>
{/if}
<!--price_update_{$obj_prefix}{$obj_id}--></span>
{/capture}
{if $no_capture}
{$capture_name = "price_`$obj_id`"}
{$smarty.capture.$capture_name nofilter}
{/if}
{******************* Clean Price ******************}
{capture name="clean_price_`$obj_id`"}
{if $show_price_values
&& $show_clean_price
&& $settings.Appearance.show_prices_taxed_clean === "YesNo::YES"|enum
&& $auth.tax_exempt !== "YesNo::YES"|enum
&& $product.taxed_price
}
<span class="cm-reload-{$obj_prefix}{$obj_id}" id="clean_price_update_{$obj_prefix}{$obj_id}">
<input type="hidden" name="appearance[show_price_values]" value="{$show_price_values}" />
<input type="hidden" name="appearance[show_clean_price]" value="{$show_clean_price}" />
{if $product.clean_price != $product.taxed_price && $product.included_tax}
<span class="ty-list-price ty-nowrap" id="line_product_price_{$obj_prefix}{$obj_id}">({include file="common/price.tpl" value=$product.taxed_price span_id="product_price_`$obj_prefix``$obj_id`" class="ty-list-price ty-nowrap"} {__("inc_tax")})</span>
{elseif $product.clean_price != $product.taxed_price && !$product.included_tax}
<span class="ty-list-price ty-nowrap ty-tax-include">({__("including_tax")})</span>
{/if}
<!--clean_price_update_{$obj_prefix}{$obj_id}--></span>
{/if}
{/capture}
{if $no_capture}
{$capture_name = "clean_price_`$obj_id`"}
{$smarty.capture.$capture_name nofilter}
{/if}
{********************** You Save ******************}
{capture name="list_discount_`$obj_id`"}
{if $show_price_values && $show_list_discount && $details_page}
<span class="cm-reload-{$obj_prefix}{$obj_id}" id="line_discount_update_{$obj_prefix}{$obj_id}">
<input type="hidden" name="appearance[show_price_values]" value="{$show_price_values}" />
<input type="hidden" name="appearance[show_list_discount]" value="{$show_list_discount}" />
{if $product.discount}
<span class="ty-list-price ty-save-price ty-nowrap" id="line_discount_value_{$obj_prefix}{$obj_id}">{__("you_save")}: {include file="common/price.tpl" value=$product.discount span_id="discount_value_`$obj_prefix``$obj_id`" class="ty-list-price ty-nowrap"}<span class="ty-save-price__percent"> (<span id="prc_discount_value_{$obj_prefix}{$obj_id}" class="ty-list-price ty-nowrap">{$product.discount_prc}</span>%)</span></span>
{elseif $product.list_discount}
<span class="ty-list-price ty-save-price ty-nowrap" id="line_discount_value_{$obj_prefix}{$obj_id}"> {__("you_save")}: {include file="common/price.tpl" value=$product.list_discount span_id="discount_value_`$obj_prefix``$obj_id`"}<span class="ty-save-price__percent"> (<span id="prc_discount_value_{$obj_prefix}{$obj_id}">{$product.list_discount_prc}</span>%)</span></span>
{/if}
<!--line_discount_update_{$obj_prefix}{$obj_id}--></span>
{/if}
{/capture}
{if $no_capture}
{$capture_name = "list_discount_`$obj_id`"}
{$smarty.capture.$capture_name nofilter}
{/if}
{************************************ Discount label ****************************}
{capture name="discount_label_`$obj_prefix``$obj_id`"}
{if $show_discount_label && ($product.discount_prc || $product.list_discount_prc) && $show_price_values}
<span class="ty-discount-label cm-reload-{$obj_prefix}{$obj_id}" id="discount_label_update_{$obj_prefix}{$obj_id}">
<span class="ty-discount-label__item" id="line_prc_discount_value_{$obj_prefix}{$obj_id}"><span class="ty-discount-label__value" id="prc_discount_value_label_{$obj_prefix}{$obj_id}">{__("save_discount")} {if $product.discount}{$product.discount_prc}{else}{$product.list_discount_prc}{/if}%</span></span>
<!--discount_label_update_{$obj_prefix}{$obj_id}--></span>
{/if}
{/capture}
{if $no_capture}
{$capture_name = "discount_label_`$obj_prefix``$obj_id`"}
{$smarty.capture.$capture_name nofilter}
{/if}
{************************************ Product labels ****************************}
{$product_labels_position = $product_labels_position|default:"top-right"}
{capture name="product_labels_`$obj_prefix``$obj_id`"}
{if $show_product_labels}
{capture name="capture_product_labels_`$obj_prefix``$obj_id`"}
{hook name="products:product_labels"}
{if $show_shipping_label && $product.free_shipping == "Y"}
{include
file="views/products/components/product_label.tpl"
label_meta="ty-product-labels__item--shipping"
label_text=__("free_shipping")
label_mini=$product_labels_mini
label_static=$product_labels_static
label_rounded=$product_labels_rounded
}
{/if}
{if $show_discount_label && ($product.discount_prc || $product.list_discount_prc) && $show_price_values}
{if $product.discount}
{$label_text = "{__("save_discount")} {$product.discount_prc}%"}
{else}
{$label_text = "{__("save_discount")} {$product.list_discount_prc}%"}
{/if}
{include
file="views/products/components/product_label.tpl"
label_meta="ty-product-labels__item--discount"
label_text=$label_text
label_mini=$product_labels_mini
label_static=$product_labels_static
label_rounded=$product_labels_rounded
}
{/if}
{/hook}
{/capture}
{$capture_product_labels = "capture_product_labels_`$obj_prefix``$obj_id`"}
{if $smarty.capture.$capture_product_labels|trim}
<div class="ty-product-labels ty-product-labels--{$product_labels_position} {if $product_labels_mini}ty-product-labels--mini{/if} {if $product_labels_static}ty-product-labels--static{/if} cm-reload-{$obj_prefix}{$obj_id}" id="product_labels_update_{$obj_prefix}{$obj_id}">
{$smarty.capture.$capture_product_labels nofilter}
<!--product_labels_update_{$obj_prefix}{$obj_id}--></div>
{/if}
{/if}
{/capture}
{if $no_capture}
{$capture_name = "product_labels_`$obj_prefix``$obj_id`"}
{$smarty.capture.$capture_name nofilter}
{/if}
{capture name="product_amount_`$obj_id`"}
{hook name="products:product_amount"}
{if $show_product_amount && $product.is_edp != "Y" && $settings.General.inventory_tracking !== "YesNo::NO"|enum}
{$is_tracking_product = $settings.General.default_tracking !== "ProductTracking::DO_NOT_TRACK"|enum && $product.tracking !== "ProductTracking::DO_NOT_TRACK"|enum || $product.tracking !== "ProductTracking::DO_NOT_TRACK"|enum}
<div class="cm-reload-{$obj_prefix}{$obj_id} stock-wrap" id="product_amount_update_{$obj_prefix}{$obj_id}">
<input type="hidden" name="appearance[show_product_amount]" value="{$show_product_amount}" />
{if !$product.hide_stock_info}
{if $settings.Appearance.in_stock_field == "Y"}
{if $is_tracking_product}
{if ($product_amount > 0 && $product_amount >= $product.min_qty) || $details_page}
{if (
$product_amount > 0
&& $product_amount >= $product.min_qty
|| $product.out_of_stock_actions == "OutOfStockActions::BUY_IN_ADVANCE"|enum
)
}
<div class="ty-control-group product-list-field">
{if $show_amount_label}
<label class="ty-control-group__label">{__("availability")}:</label>
{/if}
<span id="qty_in_stock_{$obj_prefix}{$obj_id}" class="ty-qty-in-stock ty-control-group__item">
{if $product_amount > 0}
{$product_amount} {__("items")}
{else}
{__("on_backorder")}
{/if}
</span>
</div>
{elseif $allow_negative_amount !== "YesNo::YES"|enum}
<div class="ty-control-group product-list-field">
{if $show_amount_label}
<label class="ty-control-group__label">{__("in_stock")}:</label>
{/if}
<span class="ty-qty-out-of-stock ty-control-group__item">{$out_of_stock_text}</span>
</div>
{/if}
{/if}
{/if}
{else}
{if (
$product_amount > 0
&& $product_amount >= $product.min_qty
|| $product.tracking == "ProductTracking::DO_NOT_TRACK"|enum
)
&& $is_tracking_product
&& $allow_negative_amount !== "YesNo::YES"|enum
|| $is_tracking_product
&& (
$allow_negative_amount === "YesNo::YES"|enum
|| $product.out_of_stock_actions == "OutOfStockActions::BUY_IN_ADVANCE"|enum
)
}
<div class="ty-control-group product-list-field">
{if $show_amount_label}
<label class="ty-control-group__label">{__("availability")}:</label>
{/if}
<span class="ty-qty-in-stock ty-control-group__item" id="in_stock_info_{$obj_prefix}{$obj_id}">
{if $product_amount > 0}
{__("in_stock")}
{else}
{__("on_backorder")}
{/if}
</span>
</div>
{elseif $details_page
&& (
$product_amount <= 0
|| $product_amount < $product.min_qty
)
&& $is_tracking_product
&& $allow_negative_amount !== "YesNo::YES"|enum
}
<div class="ty-control-group product-list-field">
{if $show_amount_label}
<label class="ty-control-group__label">{__("availability")}:</label>
{/if}
<span class="ty-qty-out-of-stock ty-control-group__item" id="out_of_stock_info_{$obj_prefix}{$obj_id}">{$out_of_stock_text}</span>
</div>
{/if}
{/if}
{/if}
<!--product_amount_update_{$obj_prefix}{$obj_id}--></div>
{/if}
{/hook}
{/capture}
{if $no_capture}
{$capture_name = "product_amount_`$obj_id`"}
{$smarty.capture.$capture_name nofilter}
{/if}
{capture name="product_options_`$obj_id`"}
{if $show_product_options}
<div class="cm-reload-{$obj_prefix}{$obj_id} js-product-options-{$obj_prefix}{$obj_id}" id="product_options_update_{$obj_prefix}{$obj_id}">
<input type="hidden" name="appearance[show_product_options]" value="{$show_product_options}" />
{hook name="products:product_option_content"}
{if $disable_ids}
{$_disable_ids = "`$disable_ids``$obj_id`"}
{else}
{$_disable_ids = ""}
{/if}
{include file="views/products/components/product_options.tpl" id=$obj_id product_options=$product.product_options name="product_data" capture_options_vs_qty=$capture_options_vs_qty disable_ids=$_disable_ids}
{/hook}
<!--product_options_update_{$obj_prefix}{$obj_id}--></div>
{/if}
{/capture}
{if $no_capture}
{$capture_name = "product_options_`$obj_id`"}
{$smarty.capture.$capture_name nofilter}
{/if}
{capture name="advanced_options_`$obj_id`"}
{if $show_product_options}
<div class="cm-reload-{$obj_prefix}{$obj_id}" id="advanced_options_update_{$obj_prefix}{$obj_id}">
{include file="views/companies/components/product_company_data.tpl" company_name=$product.company_name company_id=$product.company_id}
{hook name="products:options_advanced"}
{/hook}
<!--advanced_options_update_{$obj_prefix}{$obj_id}--></div>
{/if}
{/capture}
{if $no_capture}
{$capture_name = "advanced_options_`$obj_id`"}
{$smarty.capture.$capture_name nofilter}
{/if}
{capture name="qty_`$obj_id`"}
{hook name="products:qty"}
<div class="cm-reload-{$obj_prefix}{$obj_id}" id="qty_update_{$obj_prefix}{$obj_id}">
<input type="hidden" name="appearance[show_qty]" value="{$show_qty}" />
<input type="hidden" name="appearance[capture_options_vs_qty]" value="{$capture_options_vs_qty}" />
{if !empty($product.selected_amount)}
{$default_amount = $product.selected_amount}
{elseif !empty($product.min_qty)}
{$default_amount = $product.min_qty}
{elseif !empty($product.qty_step)}
{$default_amount = $product.qty_step}
{else}
{$default_amount = "1"}
{/if}
{if $show_qty && $product.is_edp !== "Y" && $cart_button_exists == true && ($settings.Checkout.allow_anonymous_shopping == "allow_shopping" || $auth.user_id) && $product.avail_since <= $smarty.const.TIME || ($product.avail_since > $smarty.const.TIME && $product.out_of_stock_actions == "OutOfStockActions::BUY_IN_ADVANCE"|enum)}
<div class="ty-qty clearfix{if $settings.Appearance.quantity_changer == "Y"} changer{/if}" id="qty_{$obj_prefix}{$obj_id}">
{if !$hide_qty_label}<label class="ty-control-group__label" for="qty_count_{$obj_prefix}{$obj_id}">{$quantity_text|default:__("quantity")}:</label>{/if}
{if $product.qty_content}
<select name="product_data[{$obj_id}][amount]" id="qty_count_{$obj_prefix}{$obj_id}">
{$a_name = "product_amount_`$obj_prefix``$obj_id`"}
{$selected_amount = false}
{foreach $product.qty_content as $var}
<option value="{$var}" {if $product.selected_amount && ($product.selected_amount == $var || ($var@last && !$selected_amount))}{$selected_amount = true}selected="selected"{/if}>{$var}</option>
{/foreach}
</select>
{else}
<div class="ty-center ty-value-changer cm-value-changer">
{if $settings.Appearance.quantity_changer == "Y"}
<a class="cm-increase ty-value-changer__increase">+</a>
{/if}
<input {if $product.qty_step > 1}readonly="readonly"{/if} type="text" size="5" class="ty-value-changer__input cm-amount cm-value-decimal" id="qty_count_{$obj_prefix}{$obj_id}" name="product_data[{$obj_id}][amount]" value="{$default_amount}"{if $product.qty_step > 1} data-ca-step="{$product.qty_step}"{/if} data-ca-min-qty="{if $product.min_qty > 1}{$product.min_qty}{else}1{/if}" />
{if $settings.Appearance.quantity_changer == "Y"}
<a class="cm-decrease ty-value-changer__decrease">−</a>
{/if}
</div>
{/if}
</div>
{if $product.prices}
{include file="views/products/components/products_qty_discounts.tpl"}
{/if}
{elseif !$bulk_add}
<input type="hidden" name="product_data[{$obj_id}][amount]" value="{$default_amount}" />
{/if}
<!--qty_update_{$obj_prefix}{$obj_id}--></div>
{/hook}
{/capture}
{if $no_capture}
{$capture_name = "qty_`$obj_id`"}
{$smarty.capture.$capture_name nofilter}
{/if}
{capture name="min_qty_`$obj_id`"}
{hook name="products:qty_description"}
{if $min_qty && $product.min_qty}
<p class="ty-min-qty-description">{__("text_cart_min_qty", ["[product]" => $product.product, "[quantity]" => $product.min_qty]) nofilter}.</p>
{/if}
{/hook}
{/capture}
{if $no_capture}
{$capture_name = "min_qty_`$obj_id`"}
{$smarty.capture.$capture_name nofilter}
{/if}
{capture name="product_edp_`$obj_id`"}
{if $show_edp && $product.is_edp == "Y"}
<p class="ty-edp-description">{__("text_edp_product")}.</p>
<input type="hidden" name="product_data[{$obj_id}][is_edp]" value="Y" />
{/if}
{/capture}
{if $no_capture}
{$capture_name = "product_edp_`$obj_id`"}
{$smarty.capture.$capture_name nofilter}
{/if}
{capture name="form_close_`$obj_id`"}
{if !$hide_form}
</form>
{/if}
{/capture}
{if $no_capture}
{$capture_name = "form_close_`$obj_id`"}
{$smarty.capture.$capture_name nofilter}
{/if}
{foreach $images as $object_id => $image}
{$product_link = $image.link}
{hook name="products:list_images_block"}
<div class="cm-reload-{$image.obj_id}" id="{$object_id}">
{if $product_link}
<a href="{$product_link}">
<input type="hidden" value="{$image.link}" name="image[{$object_id}][link]" />
{/if}
<input type="hidden" value="{$image.obj_id},{$image.width},{$image.height},{$image.type}" name="image[{$object_id}][data]" />
{include file="common/image.tpl" image_width=$image.width image_height=$image.height obj_id=$object_id images=$product.main_pair}
{if $image.link}
</a>
{/if}
<!--{$object_id}--></div>
{/hook}
{/foreach}
{/hook}
{hook name="products:product_data"}{/hook}
[/details]
я так понимаю для переключения чего-то в контроллере не хватает
Готовый контроллер и кнопка — product_features.zip
В product_data мы указываем id блоков для обновления на лету:
<input type="hidden" name="result_ids" value="cart_status*,comp_list*,wish_list*,checkout*,account_info*" />
И в шаблоне кнопки указываем таргет блоков для обновления:
{$but_target_id = "comp_list*,account_info*"}
Например:
— кнопки на тизерах товаров (id=“account_info_129”)
— кнопки-счётчики в шапке (id=“comp_list_snap”)
Внимательно проверьте, чтобы указанные id блоков совпадали с теми, которые вы используете в своём шаблоне. Должно работать.
Коллеги, а в чем суть изсканий?
Сеошние фишки, чтобы “лишние” ссылки поубирать?
Ну не только, скорее унифицировать с “избранное”, ну и клиент захотел что б так работало “нажатие/второе нажатие”
Что то всё таки упускаю
В product_data мы указываем id блоков для обновления на лету:
<input type="hidden" name="result_ids" value="cart_status*,comp_list*,wish_list*,checkout*,account_info*,button_compare_*" />
в категории на разводящей всё работает
на странице товара, сделаны два блока(давно, не мной) в скрытом тоже отрабатывается
в нескрытом (текущем) не отрабатывает
на всякий случай иконки в шапке
У вас на кнопках id=“button_compare_”, у родительского блока id не указан, а data-target=“comparison_list”, поэтому и не работает.
Нужно либо дописать родителям кнопок id=“account_info_{pid}”, либо data-target изменить на “button_compare_*”.