87 lines
3.9 KiB
Smarty
87 lines
3.9 KiB
Smarty
{extends "focus/focus.base.tpl"}
|
|
|
|
{block "focus-title"}{t}Dostupnost na prodejnách{/t}{/block}
|
|
|
|
{block "focus-content"}
|
|
{if $smarty.request.show_availability}
|
|
<div data-reload="show_product_availability">
|
|
{if $variation_in_column}
|
|
{* varianta když je více skladů než variant *}
|
|
<table data-availability-table>
|
|
{if $body.product.variations.variations or $body.product.variationId}
|
|
<tr>
|
|
<th> </th>
|
|
{if $body.product.variationId}
|
|
<th>{$body.product.variationTitle}</th>
|
|
{else}
|
|
{foreach $body.product.variations.variations as $variation}
|
|
<th>{$variation.title}</th>
|
|
{/foreach}
|
|
{/if}
|
|
</tr>
|
|
{/if}
|
|
|
|
{foreach $productInStore.stores as $key => $store}
|
|
<tr class="row-{if $store.in_store > 0}instore{else}notinstore{/if}">
|
|
<th>{$store.name}</th>
|
|
<td class="delivery-{if $store.in_store > 0}0{else}-1{/if}">{if $store.in_store<0}0{else}{$store.in_store}{/if} {$body.product.unit.short_name|default:"ks"}</td>
|
|
</tr>
|
|
{/foreach}
|
|
|
|
</table>
|
|
{else}
|
|
{* varianta pro míň skladů *}
|
|
{function stores_in_store_amounts}
|
|
{foreach $stores as $key => $store}
|
|
{$store_in_store = $productInStore["store{$key}_in_store"]}
|
|
<td class="delivery-{if $store_in_store > 0}0{else}-1{/if}">{if $store_in_store<0}0{else}{$store_in_store}{/if} {$body.product.unit.short_name|default:"ks"}</td>
|
|
{/foreach}
|
|
{/function}
|
|
|
|
<table data-availability-table>
|
|
<tr>
|
|
{if $body.product.variations.variations}
|
|
<th> </th>
|
|
{/if}
|
|
{foreach $stores as $store}
|
|
<th>{$store}</th>
|
|
{/foreach}
|
|
</tr>
|
|
{if !$body.product.variations.variations and !$body.product.variationId}
|
|
{$productInStore = $storesInStore->getProductInStoreAmounts($body.product.id, $null)}
|
|
{if $productInStore|count}
|
|
<tr>
|
|
{stores_in_store_amounts productInStore=$productInStore}
|
|
</tr>
|
|
{/if}
|
|
{elseif $body.product.variationId}
|
|
{$productInStore = $storesInStore->getProductInStoreAmounts($body.product.id, $body.product.variationId)}
|
|
{if $productInStore|count}
|
|
<tr>
|
|
{stores_in_store_amounts productInStore=$productInStore}
|
|
</tr>
|
|
{/if}
|
|
{else}
|
|
{foreach $body.product.variations.variations as $variation}
|
|
{$productInStore = $storesInStore->getProductInStoreAmounts($body.product.id, $variation.id)}
|
|
{if $productInStore|count}
|
|
<tr data-variation-id="{$variation.id}">
|
|
<th class="product-availability-variation-title">{$variation.title}</th>
|
|
{stores_in_store_amounts productInStore=$productInStore}
|
|
</tr>
|
|
{/if}
|
|
{/foreach}
|
|
{/if}
|
|
</table>
|
|
{/if}
|
|
</div>
|
|
{else}
|
|
{$url = "{path('kupshop_content_product_variationdeliverytime', ['idp' => $body.product.id])}"}
|
|
{if $body.product.variationId}
|
|
{$url = "{path('kupshop_content_product_variationdeliverytime_1', ['idp' => $body.product.id, 'idv' => $body.product.variationId])}"}
|
|
{/if}
|
|
<a href="{$url}?show_availability=1" data-ondemand-content>Načíst</a>
|
|
<div data-reload="show_product_availability"></div>
|
|
{/if}
|
|
{/block}
|