48 lines
2.2 KiB
Smarty
48 lines
2.2 KiB
Smarty
{$gifts = $body->getPurchaseState()->getCustomData('gift')}
|
|
{$selected_products = []}
|
|
{foreach $gifts as $discountId => $selectedGifts}
|
|
{$tmp_selected = array_filter(array_column($selectedGifts, 'id_product'))}
|
|
{if $tmp_selected}
|
|
{$selected_products = array_merge($selected_products, $tmp_selected)}
|
|
{/if}
|
|
{/foreach}
|
|
|
|
{if $selected_products}
|
|
{foreach $body->getPurchaseState()->getDiscountHandlers() as $handler}
|
|
{$data = $handler->getData()}
|
|
{* Pokud jsou varianty, `id_product` je id produktu a `gift` je id varianty.
|
|
Bez variant je jen `gift` = id produktu. *}
|
|
{$gift = $data['id_product']|default:$data['gift']}
|
|
{if $gift and in_array($gift, $selected_products)}
|
|
{$vars = $handler->getVars()}
|
|
{$product = $vars['products'][$gift]}
|
|
|
|
{if $product}
|
|
{$product->fetchImages(4)}
|
|
<div class="product">
|
|
<div class="image img-overlay">
|
|
<a href="{url s=product IDproduct=$product.id}" title="{t}Zobrazit zboží{/t}">
|
|
{$photo_dimensions = $cfg.Photo.types['product_cart'].size}
|
|
<img src="{get_photo photo=$product.image size='product_cart'}" alt="{$product.title}"
|
|
class="img-responsive" width="{$photo_dimensions[0]}" height="{$photo_dimensions[1]}">
|
|
</a>
|
|
</div>
|
|
<div class="title">
|
|
<a href="{url s=product IDproduct=$product.id TITLE=$product.title}"
|
|
title="{t}Zobrazit produkt{/t}">
|
|
<strong>{$product.title}</strong>
|
|
</a>
|
|
<span class="variation">{$vars.title|default:"{t}Dárek zdarma{/t}"}</span>
|
|
</div>
|
|
<div class="price">
|
|
<p class="price-total price-total-summary">
|
|
<strong>{if $vars.price && $vars.price->getPriceWithVat()->isZero() and !$tpl_vars.gift_show_price}{t}zdarma{/t}{else}{$vars.price|format_price}{/if}</strong>
|
|
</p>
|
|
<p class="pieces-summary"> </p>
|
|
</div>
|
|
</div>
|
|
{/if}
|
|
{/if}
|
|
{/foreach}
|
|
{/if}
|