97 lines
3.2 KiB
Smarty
97 lines
3.2 KiB
Smarty
{* Для того чтобы обернуть центральный блок в шаблон, отличный от index.tpl *}
|
||
{* Укажите нужный шаблон строкой ниже. Это работает и для других модулей *}
|
||
{$wrapper = 'index.tpl' scope=parent}
|
||
|
||
{* Заголовок страницы *}
|
||
|
||
|
||
{* Тело страницы *}
|
||
{$page->body}
|
||
|
||
{if $products}
|
||
<!-- Список товаров-->
|
||
<ul id="catalog">
|
||
|
||
{foreach $products as $product}
|
||
<!-- Товар-->
|
||
<li class="product">
|
||
|
||
<!-- Фото товара -->
|
||
{if $product->image}
|
||
<div class="image">
|
||
<a href="/products/{$product->url}/"><img src="{$product->image->filename|resize:200:200}" alt="{$product->name|escape}"/></a>
|
||
</div>
|
||
{/if}
|
||
<!-- Фото товара (The End) -->
|
||
|
||
<!-- Название товара -->
|
||
<h3><a product_id="{$product->id}" href="/products/{$product->url}/">{$product->name|escape}</a></h3>
|
||
<!-- Название товара (The End) -->
|
||
|
||
<!-- Описание товара -->
|
||
<div>{$product->annotation}</div>
|
||
<!-- Описание товара (The End) -->
|
||
|
||
{if $product->variants|count > 0}
|
||
<!-- Цена и заказ товара -->
|
||
<form class="cart" method="get" action="cart">
|
||
|
||
<!-- Выбор варианта товара -->
|
||
{* Не показывать выбор варианта, если он один и без названия *}
|
||
<select name="variant" {if $product->variants|count==1 && !$product->variant->name}style='display:none;'{/if}>
|
||
{foreach $product->variants as $v}
|
||
<option value="{$v->id}" {if $v->compare_price > 0}compare_price="{$v->compare_price|convert}"{/if} price="{$v->price|convert}">
|
||
{$v->name}
|
||
</option>
|
||
{/foreach}
|
||
</select>
|
||
<!-- Выбор варианта товара (The End) -->
|
||
|
||
<!-- Цена товара -->
|
||
<div class="price">
|
||
<strike>
|
||
{if $product->variant->compare_price > 0}
|
||
{$product->variant->compare_price|convert}
|
||
{/if}
|
||
</strike>
|
||
<span>{$product->variant->price|convert}</span>
|
||
<i>{$currency->sign|escape}</i>
|
||
</div>
|
||
<!-- Цена товара (The End) -->
|
||
|
||
<!-- В корзину -->
|
||
<input type="submit" class="add_to_cart" value="В корзину" added_text="Добавлено"/>
|
||
<!-- В корзину (The End) -->
|
||
|
||
</form>
|
||
<!-- Цена и заказ товара (The End)-->
|
||
{/if}
|
||
|
||
</li>
|
||
<!-- Товар (The End)-->
|
||
{/foreach}
|
||
|
||
</ul>
|
||
{/if}
|
||
<!--Каталог товаров (The End)-->
|
||
|
||
<!-- Аяксовая корзина -->
|
||
<script src="js/ajax-cart.js"></script>
|
||
|
||
<script>
|
||
{literal}
|
||
$(function() {
|
||
// Выбор вариантов
|
||
$('select[name=variant]').change(function() {
|
||
price = $(this).find('option:selected').attr('price');
|
||
compare_price = '';
|
||
if(typeof $(this).find('option:selected').attr('compare_price') == 'string')
|
||
compare_price = $(this).find('option:selected').attr('compare_price');
|
||
$(this).find('option:selected').attr('compare_price');
|
||
$(this).closest('form').find('span').html(price);
|
||
$(this).closest('form').find('strike').html(compare_price);
|
||
return false;
|
||
});
|
||
});
|
||
</script>
|
||
{/literal} |