119 lines
5.1 KiB
Smarty
119 lines
5.1 KiB
Smarty
<div data-variations="variations-ajax">
|
|
{if $body.product.variations.labels|count == 1}
|
|
<div class="product-variations-header">
|
|
<p class="title " data-variation-error="title">
|
|
{t}Vyberte:{/t} {foreach $body.product.variations.labels as $index => $label}{$label.label|lcfirst}{/foreach}
|
|
</p>
|
|
{block "sizetable-link"}
|
|
{if $sizeTables}
|
|
<a href="#sizetable" data-scrollto>
|
|
{t}Jakou velikost?{/t}
|
|
</a>
|
|
{/if}
|
|
{/block}
|
|
</div>
|
|
{else}
|
|
{foreach $body.product.variations.labels as $label}
|
|
<div class="product-variations-header">
|
|
<p class="title " data-variation-error="title">
|
|
{t}Vyberte:{/t} {$label.label}
|
|
</p>
|
|
</div>
|
|
<div class="product-variations">
|
|
{foreach $label.values as $id => $value}
|
|
<input name="IDLabel_{$label.id}" type="radio" value="{$id}" id="lab_{$label.id}_{$id}">
|
|
<label for="lab_{$label.id}_{$id}" class="product-variation">
|
|
<span class="variation-title">{$value}</span>
|
|
</label>
|
|
{/foreach}
|
|
</div>
|
|
{/foreach}
|
|
{/if}
|
|
|
|
<script>
|
|
wpj.variations = {ldelim}{rdelim};
|
|
</script>
|
|
|
|
<div class="product-variations" {if $body.product.variations.labels|count > 1}style="display: none;"{/if}>
|
|
{foreach $body.product.variations.variations as $variation}
|
|
{* varianta je vyprodana a v adminu je vypnute zobrazovani vyprodanych produktu *}
|
|
{if $variation.delivery_time_index != 0 and $dbcfg.prod_show_not_in_store == "N"}
|
|
{continue}
|
|
{/if}
|
|
|
|
{* varianta je vyprodana a v adminu je vypnute zobrazovani vyprodanych produktu *}
|
|
{if $variation.delivery_time_index != 0 and $dbcfg.prod_show_not_in_store == "N"}
|
|
{continue}
|
|
{/if}
|
|
|
|
{$soldout = true}
|
|
|
|
{if $variation.delivery_time_index == 0}
|
|
{* varianta je skladem *}
|
|
{$soldout = false}
|
|
{elseif $dbcfg.order_not_in_store == 'N' }
|
|
{* varianta není skladem a je zakázáno kupování vyprodaných prod. v adminu *}
|
|
{* $soldout je true *}
|
|
{elseif $cfg.Products.allowSoldoutToCart[$variation.delivery_time_index] or
|
|
($cfg.Products.allowSoldoutToCart[1] and $variation.delivery_time_index > 0)}
|
|
{* delivery_time_index varianty je povoleny v configu *}
|
|
{$soldout = false}
|
|
{/if}
|
|
|
|
{block "variation-datascript"}
|
|
|
|
{calc_product_discount product=$body.product variation=$variation assign='discount'}
|
|
<script>{* @formatter:off *}
|
|
wpj.variations[{$variation.id}] = {
|
|
{if $variation.price.B2B_discount}
|
|
price: "{$variation.price.B2B_price_with_vat|format_price}",
|
|
{else}
|
|
price: "{$variation.productPrice|format_price}",
|
|
{/if}
|
|
priceNoVat: "{$variation.productPrice->getPriceWithoutVat()|format_price}",
|
|
deliveryTime: "{$variation.delivery_time}",
|
|
deliveryTimeIndex: "{$variation.delivery_time_index}",
|
|
{if $discount.priceOriginal}
|
|
priceCommon: "{$discount.priceOriginal|format_price}",
|
|
flag: "-{$discount.discount->asFloat()|round} %",
|
|
{/if}
|
|
{ifmodule BONUS_PROGRAM}
|
|
{if $variation.bonus_points->isPositive()}
|
|
bonusPoints: "{$variation.bonus_points->asFloat()}",
|
|
{/if}
|
|
{/ifmodule}
|
|
{ifmodule WATCHDOG}
|
|
{get_product_info type='is_watchdog' id_variation=$variation.id product=$body.product assign='is_watchdog'}
|
|
watchdog: {if $soldout}true{else}false{/if},
|
|
deleteWatchdog: "/launch.php?s=watchdog&IDp={$body.product.id}&IDv={$variation.id}&acn=delete", {* todo jak to generovat neescapovane? *}
|
|
{if $is_watchdog}
|
|
watchdogActive: true,
|
|
{/if}
|
|
{/ifmodule}
|
|
{if $body.product.variations.labels|count > 1}
|
|
combinations: {
|
|
{foreach $variation.combinations as $comb}
|
|
{$comb.id_label}: {$comb.id_value},
|
|
{/foreach}
|
|
}
|
|
{/if}
|
|
}
|
|
;{* @formatter:on *}
|
|
</script>
|
|
{/block}
|
|
<input name="IDvariation" type="radio" value="{$variation.id}" id="var_{$variation.id}"
|
|
{if $soldout and !findModule('watchdog')} disabled
|
|
{elseif $precheck_single and $body.product.variations.variations|count == 1}checked{/if}
|
|
>
|
|
<label for="var_{$variation.id}"
|
|
class="product-variation {if $soldout}soldout {if findModule('watchdog')}watchdog{else}disable{/if}{/if}">
|
|
<span class="variation-title">
|
|
{foreach $variation.combinations as $index => $comb}
|
|
{$body.product.variations.labels[$comb.id_label].values[$comb.id_value]}
|
|
{/foreach}
|
|
</span>
|
|
</label>
|
|
{/foreach}
|
|
</div>
|
|
</div>
|