Ltim
1
Добрый день! Помогите пожалуйста! Счетчик не работает, смотрю cart_content.tpl
{* MODIFIER *}
{if $settings.abt__device == "desktop"}
<div class="desktop-cart_displays">
{/if}
{* MODIFIER *}
{assign var="result_ids" value="cart*,checkout*"}
{* MODIFIED *}
{hook name="checkout:layout_content"}
{* MODIFIED *}
<div id="checkout_form_wrapper">
<form name="checkout_form" class="cm-check-changes cm-ajax cm-ajax-full-render" action="{""|fn_url}" method="post" enctype="multipart/form-data" id="checkout_form">
<input type="hidden" name="redirect_mode" value="cart" />
<input type="hidden" name="result_ids" value="{$result_ids}" />
<h1 class="ty-mainbox-title">{__("cart_contents")}</h1>
{* MODIFIER *}
{if $settings.abt__device == "mobile"}
<div class="buttons-container ty-cart-content__top-buttons clearfix">
<div class="ty-float-left ty-cart-content__left-buttons">
{hook name="checkout:cart_content_top_left_buttons"}
{include file="buttons/continue_shopping.tpl" but_href=$continue_url|fn_url }
{/hook}
</div>
<div class="ty-float-right ty-cart-content__right-buttons">
{hook name="checkout:cart_content_top_right_buttons"}
{include file="buttons/update_cart.tpl"
but_id="button_cart"
but_meta="ty-btn--recalculate-cart hidden hidden-phone hidden-tablet"
but_name="dispatch[checkout.update]"
}
{if $payment_methods}
{include file="buttons/proceed_to_checkout.tpl"}
{/if}
{/hook}
</div>
</div>
{/if}
{include file="views/checkout/components/cart_items.tpl" disable_ids="button_cart"}
</form>
<!--checkout_form_wrapper--></div>
{include file="views/checkout/components/checkout_totals.tpl" location="cart"}
{* MODIFIER *}
{if $settings.abt__device == "mobile"}
<div class="buttons-container ty-cart-content__bottom-buttons clearfix">
<div class="ty-float-left ty-cart-content__left-buttons">
{hook name="checkout:cart_content_bottom_left_buttons"}
{include file="buttons/continue_shopping.tpl" but_href=$continue_url|fn_url}
{include file="buttons/clear_cart.tpl" but_href="checkout.clear" but_role="text" but_meta="cm-confirm ty-cart-content__clear-button"}
{/hook}
</div>
<div class="ty-float-right ty-cart-content__right-buttons">
{hook name="checkout:cart_content_bottom_right_buttons"}
{if $payment_methods}
{assign var="link_href" value="checkout.checkout"}
{include file="buttons/proceed_to_checkout.tpl"}
{/if}
{/hook}
</div>
</div>
{if $checkout_add_buttons}
<div class="ty-cart-content__payment-methods payment-methods" id="payment-methods">
<span class="ty-cart-content__payment-methods-title payment-metgods-or">{__("or_use")}</span>
<table class="ty-cart-content__payment-methods-block">
<tr>
{foreach from=$checkout_add_buttons item="checkout_add_button"}
<td class="ty-cart-content__payment-methods-item">{$checkout_add_button nofilter}</td>
{/foreach}
</tr>
</table>
<!--payment-methods--></div>
{/if}
{/if}
{* MODIFIER *}
{/hook}
{if $settings.abt_device == "desktop"}
</div>
{/if}
Ltim
2
Так же cart_items.tpl
{$default_minimal_qty = 1}
{capture name="cartbox"}
{if $runtime.mode == "checkout"}
{if $cart.coupons|floatval}<input type="hidden" name="c_id" value="" />{/if}
{hook name="checkout:form_data"}
{/hook}
{/if}
<div id="cart_items">
<table class="ty-cart-content ty-table">
{assign var="prods" value=false}
{* <thead>*}
{* <tr>*}
{* <th class="ty-cart-content__title ty-left">{__("product")}</th>*}
{* <th class="ty-cart-content__title ty-left"> </th>*}
{* <th class="ty-cart-content__title ty-right">{__("unit_price")}</th>*}
{* <th class="ty-cart-content__title quantity-cell">{__("quantity")}</th>*}
{* <th class="ty-cart-content__title ty-right">{__("total_price")}</th>*}
{* </tr>*}
{* </thead>*}
<tbody>
{if $cart_products}
{foreach from=$cart_products item="product" key="key" name="cart_products"}
{assign var="obj_id" value=$product.object_id|default:$key}
{hook name="checkout:items_list"}
{if !$cart.products.$key.extra.parent}
{* MODIFIER *}
{if $settings.abt__device == "desktop"}
<tr style="position: relative; display: grid !important;
grid-template-columns: 20% 52% 12% 12%;
background: #FFFDFF;
border-radius: 16px;">
{else}
<tr style="position: relative; display: flex !important; background: #FFFDFF;
border-radius: 16px;">
{/if}
{* MODIFIER *}
<td class="ty-cart-content__product-elem ty-cart-content__image-block">
{if $runtime.mode == "cart" || $show_images}
<div class="ty-cart-content__image cm-reload-{$obj_id}" id="product_image_update_{$obj_id}">
{hook name="checkout:product_icon"}
<a href="{"products.view?product_id=`$product.product_id`"|fn_url}">
{include file="common/image.tpl" obj_id=$key images=$product.main_pair image_width=$settings.Thumbnails.product_cart_thumbnail_width image_height=$settings.Thumbnails.product_cart_thumbnail_height}</a>
{/hook}
{* MODIFIER *}
{if $settings.abt__device == "mobile"}
<span class="ty-cart-content__product-elem ty-cart-content__price cm-reload-{$obj_id}" id="price_display_update_{$obj_id}">
{include file="common/price.tpl" value=$product.display_price span_id="product_price_`$key`" class="ty-sub-price"}
<!--price_display_update_{$obj_id}-->
</span>
{/if}
{* MODIFIER *}
<!--product_image_update_{$obj_id}--></div>
{/if}
</td>
<td class="ty-cart-content__product-elem ty-cart-content__description" style="width: 100%; padding: 16px;">
{strip}
<a href="{"products.view?product_id=`$product.product_id`"|fn_url}" class="ty-cart-content__product-title">
{$product.product nofilter}
</a>
{if !$product.exclude_from_calculate}
<a class="{$ajax_class} ty-cart-content__product-delete ty-delete-big" href="{"checkout.delete?cart_id=`$key`&redirect_mode=`$runtime.mode`"|fn_url}" data-ca-target-id="cart_items,checkout_totals,cart_status*,checkout_steps,checkout_cart" title="{__("remove")}"> {include_ext file="common/icon.tpl" class="ty-icon-cancel-circle ty-delete-big__icon"}</a>
{/if}
{/strip}
{hook name="products:product_additional_info"}
<div class="ty-cart-content__sku ty-sku cm-hidden-wrapper{if !$product.product_code} hidden{/if}" id="sku_{$key}">
{__("sku")}: <span class="cm-reload-{$obj_id}" id="product_code_update_{$obj_id}">{$product.product_code}<!--product_code_update_{$obj_id}--></span>
</div>
{hook name="checkout:product_options"}
{if $product.product_options}
<div class="cm-reload-{$obj_id} ty-cart-content__options" id="options_update_{$obj_id}">
<input type="hidden" name="no_cache" value="no_cache" />
{include file="views/products/components/product_options.tpl" product_options=$product.product_options product=$product name="cart_products" id=$key location="cart" disable_ids=$disable_ids form_name="checkout_form"}
<!--options_update_{$obj_id}--></div>
{/if}
{/hook}
{/hook}
{assign var="name" value="product_options_$key"}
{capture name=$name}
{capture name="product_info_update"}
{hook name="checkout:product_info"}
{if $product.exclude_from_calculate}
<strong><span class="price">{__("free")}</span></strong>
{elseif $product.discount|floatval || ($product.taxes && $settings.Checkout.tax_calculation != "subtotal")}
{if $product.discount|floatval}
{assign var="price_info_title" value=__("discount")}
{else}
{assign var="price_info_title" value=__("taxes")}
{/if}
<p><a data-ca-target-id="discount_{$key}" class="cm-dialog-opener cm-dialog-auto-size" rel="nofollow">{$price_info_title}</a></p>
<div class="ty-group-block hidden" id="discount_{$key}" title="{$price_info_title}">
<table class="ty-cart-content__more-info ty-table">
<thead>
<tr>
<th class="ty-cart-content__more-info-title">{__("price")}</th>
<th class="ty-cart-content__more-info-title">{__("quantity")}</th>
{if $product.discount|floatval}<th class="ty-cart-content__more-info-title">{__("discount")}</th>{/if}
{if $product.taxes && $settings.Checkout.tax_calculation != "subtotal"}<th>{__("tax")}</th>{/if}
<th class="ty-cart-content__more-info-title">{__("subtotal")}</th>
</tr>
</thead>
<tbody>
<tr>
<td>{include file="common/price.tpl" value=$product.original_price span_id="original_price_`$key`" class="none"}</td>
<td class="ty-center">{$product.amount}</td>
{if $product.discount|floatval}<td>{include file="common/price.tpl" value=$product.discount span_id="discount_subtotal_`$key`" class="none"}</td>{/if}
{if $product.taxes && $settings.Checkout.tax_calculation != "subtotal"}<td>{include file="common/price.tpl" value=$product.tax_summary.total span_id="tax_subtotal_`$key`" class="none"}</td>{/if}
<td>{include file="common/price.tpl" span_id="product_subtotal_2_`$key`" value=$product.display_subtotal class="none"}</td>
</tr>
</tbody>
</table>
</div>
{/if}
{include file="views/companies/components/product_company_data.tpl" company_name=$product.company_name company_id=$product.company_id}
{/hook}
{/capture}
{if $smarty.capture.product_info_update|trim}
<div class="cm-reload-{$obj_id}" id="product_info_update_{$obj_id}">
{$smarty.capture.product_info_update nofilter}
<!--product_info_update_{$obj_id}--></div>
{/if}
{/capture}
{* MODIFIER *}
{* {if $settings.abt__device != "desktop"}*}
{* {if $smarty.capture.$name|trim}*}
{* <div id="options_{$key}" class="ty-product-options ty-group-block">*}
{* <div class="ty-group-block__arrow">*}
{* <span class="ty-caret-info"><span class="ty-caret-outer"></span><span class="ty-caret-inner"></span></span>*}
{* </div>*}
{* <bdi>{$smarty.capture.$name nofilter}</bdi>*}
{* </div>*}
{* {/if}*}
{* {/if}*}
{* MODIFIER *}
{* MODIFIFER *}
{if $settings.abt_device == "mobile"}
<div class="ty-cart-content__product-elem ty-cart-content__qty {if $product.is_edp == "Y" || $product.exclude_from_calculate} quantity-disabled{/if}">
{if $use_ajax == true && $cart.amount != 1}
{assign var="ajax_class" value="cm-ajax"}
{/if}
<div class="quantity cm-reload-{$obj_id}{if $settings.Appearance.quantity_changer == "Y"} changer{/if}" id="quantity_update_{$obj_id}">
<input type="hidden" name="cart_products[{$key}][product_id]" value="{$product.product_id}" />
{if $product.exclude_from_calculate}<input type="hidden" name="cart_products[{$key}][extra][exclude_from_calculate]" value="{$product.exclude_from_calculate}" />{/if}
<label for="amount_{$key}"></label>
{if $product.is_edp == "Y" || $product.exclude_from_calculate}
{$product.amount}
{else}
{if $settings.Appearance.quantity_changer == "Y"}
<div class="ty-center ty-value-changer cm-value-changer">
<a class="cm-increase ty-value-changer__increase">+</a>
{/if}
<input type="text" size="3" id="amount_{$key}" name="cart_products[{$key}][amount]" value="{$product.amount}" class="ty-value-changer__input cm-amount"{if $product.qty_step > 1} data-ca-step="{$product.qty_step}"{/if} data-ca-min-qty="{if !$product.min_qty}{$default_minimal_qty}{else}{$product.min_qty}{/if}" />
{if $settings.Appearance.quantity_changer == "Y"}
<a class="cm-decrease ty-value-changer__decrease">−</a>
</div>
{/if}
{/if}
{if $product.is_edp == "Y" || $product.exclude_from_calculate}
<input type="hidden" name="cart_products[{$key}][amount]" value="{$product.amount}" />
{/if}
{if $product.is_edp == "Y"}
<input type="hidden" name="cart_products[{$key}][is_edp]" value="Y" />
{/if}
<!--quantity_update_{$obj_id}--></div>
</div>
{/if}
{* MODIFIER *}
</td>
{* MODIFIER *}
{if $settings.abt__device == "desktop"}
<td class="ty-cart-content__product-elem price_on-elem">
<span class="ty-cart-content__product-elem ty-cart-content__price cm-reload-{$obj_id}" id="price_display_update_{$obj_id}">
{include file="common/price.tpl" value=$product.display_price span_id="product_price_`$key`" class="ty-sub-price"}
<!--price_display_update_{$obj_id}--></span>
</td>
<td class="ty-cart-content__product-elem prod_feature">
<div class="ty-cart-content__product-elem ty-cart-content__qty {if $product.is_edp == "Y" || $product.exclude_from_calculate} quantity-disabled{/if}">
{if $use_ajax == true && $cart.amount != 1}
{assign var="ajax_class" value="cm-ajax"}
{/if}
<div class="quantity cm-reload-{$obj_id}{if $settings.Appearance.quantity_changer == "Y"} changer{/if}" id="quantity_update_{$obj_id}">
<input type="hidden" name="cart_products[{$key}][product_id]" value="{$product.product_id}" />
{if $product.exclude_from_calculate}<input type="hidden" name="cart_products[{$key}][extra][exclude_from_calculate]" value="{$product.exclude_from_calculate}" />{/if}
<label for="amount_{$key}"></label>
{if $product.is_edp == "Y" || $product.exclude_from_calculate}
{$product.amount}
{else}
{if $settings.Appearance.quantity_changer == "Y"}
<div class="ty-center ty-value-changer cm-value-changer">
<a class="cm-increase ty-value-changer__increase">+</a>
{/if}
<input type="text" size="3" id="amount_{$key}" name="cart_products[{$key}][amount]" value="{$product.amount}" class="ty-value-changer__input cm-amount"{if $product.qty_step > 1} data-ca-step="{$product.qty_step}"{/if} data-ca-min-qty="{if !$product.min_qty}{$default_minimal_qty}{else}{$product.min_qty}{/if}" />
{if $settings.Appearance.quantity_changer == "Y"}
<a class="cm-decrease ty-value-changer__decrease">−</a>
</div>
{/if}
{/if}
{if $product.is_edp == "Y" || $product.exclude_from_calculate}
<input type="hidden" name="cart_products[{$key}][amount]" value="{$product.amount}" />
{/if}
{if $product.is_edp == "Y"}
<input type="hidden" name="cart_products[{$key}][is_edp]" value="Y" />
{/if}
<!--quantity_update_{$obj_id}--></div>
</div>
</td>
{/if}
{* {if $settings.abt__device == "mobile"}*}
{* <td class="ty-cart-content__product-elem ty-cart-content__price cm-reload-{$obj_id}" id="price_subtotal_update_{$obj_id}">*}
{* {include file="common/price.tpl" value=$product.display_subtotal span_id="product_subtotal_`$key`" class="price"}*}
{* {if $product.zero_price_action == "A"}*}
{* <input type="hidden" name="cart_products[{$key}][price]" value="{$product.base_price}" />*}
{* {/if}*}
{* <!--price_subtotal_update_{$obj_id}--></td>*}
{* {/if}*}
{* MODIFIER *}
</tr>
{/if}
{/hook}
{/foreach}
{/if}
{hook name="checkout:extra_list"}
{/hook}
</tbody>
</table>
<!--cart_items--></div>
{/capture}
{include file="common/mainbox_cart.tpl" title=__("cart_items") content=$smarty.capture.cartbox}
Ltim
3
А все отбой
пропустил хук update_cart.tpl
1 лайк
Ума не приложу куда в данном коде
<div id="sw_dropdown_{$dropdown_id}" class="ty-dropdown-box__title cm-combination">
<a href="{"checkout.cart"|fn_url}">
{hook name="checkout:dropdown_title"}
{$additional_class = ($smarty.session.cart.products|count) ? "filled" : "empty"}
{include_ext file="common/icon.tpl"
class="ty-icon-moon-commerce ty-minicart__icon `$additional_class`"
}<span style="position: relative;color: white;">{$smarty.session.cart.amount}</span>
<span class="ty-minicart-title{if !$smarty.session.cart.amount} empty-cart{/if} ty-hand">
<span class="ty-block ty-minicart-title__header ty-uppercase">{__("my_cart")}</span>
<span class="ty-block">
{if $smarty.session.cart.amount}
{$smarty.session.cart.amount} {__("items")} {__("for")} {include file="common/price.tpl" value=$smarty.session.cart.display_subtotal}
{else}
{__("cart_is_empty")}
{/if}
</span>
</span>
{/hook}
</a>
</div>
вставить отображение кол-ва товаров на кнопке конзина
<span style="position: relative;color: white;">{$smarty.session.cart.amount}</span>
неужели в include_ext file="common/icon.tpl"
???
Ltim
5
Не совсем понял вопрос. Кнопка добавления в корзину или badge который отображает сколько товаров в корзине?
Ltim
7
badge уже есть
{if $smarty.session.cart.amount}
{$smarty.session.cart.amount} {__("items")} {__("for")} {include file="common/price.tpl" value=$smarty.session.cart.display_subtotal}
{else}
{__("cart_is_empty")}
{/if}
Ltim
8
{if $smarty.session.cart.amount}
<i class="ut2-icon-use_icon_cart filled"><span class="ty-minicart-count">{$smarty.session.cart.amount}</span></i><span>{__("cart")}<i class="ut2-icon-outline-expand_more"></i></span>
{else}
<i class="ut2-icon-use_icon_cart empty"><span class="ty-minicart-count ty-hand empty">0</span></i><span>{__("cart")}<i class="ut2-icon-outline-expand_more"></i></span>
{/if}
Примерно так можно сделать
1 лайк