list-thumbs.html добавить характеристики
пытаюсь изменить код под собственные нужды. но не могу вывести характеристики товаров
вот измененный код list-thumbs.html
<!-- products thumbnail list view -->
{if !empty($sorting)}
<!-- sorting -->
{$sort_fields = [
'name' => '[`Name`]',
'price' => '[`Price`]',
'total_sales' => '[`Bestsellers`]',
'rating' => '[`Customer rating`]',
'create_datetime'=>'[`Date added`]',
'stock' => '[`In stock`]']}
{if !isset($active_sort)}
{$active_sort = $wa->get('sort', 'create_datetime')}
{/if}
<ul class="menu-h sorting">
<li>[`Sort by`]:</li>
{if !empty($category) && !$category.sort_products}
<li{if !$active_sort} class="selected"{/if}>[`New & Popular`]</li>
{/if}
{foreach $sort_fields as $sort => $name}
<li{if $active_sort == $sort} class="selected"{/if}>{$wa->shop->sortUrl($sort, $name)}</li>
{if $wa->get('sort') == $sort}{$wa->title( $wa->title()|cat:' — '|cat:$name)}{/if}
{/foreach}
</ul>
{/if}
<!-- начало вывода блоков -->
{foreach $products as $p}
{$available = $wa->shop->settings('ignore_stock_count') || $p.count === null || $p.count > 0}
<div style="border: thick ridge #FFFFFF; padding: 1px; margin: 1px; width: 300px; height: 300px; background-color: #C0C0C0; float: left;">
<div style="width: 150px; display: inline-block;float: left;">
{$badge_html = $wa->shop->badgeHtml($p.badge)}
{if $badge_html}
<div class="corner top right">{$badge_html}</div>
{/if}
{$wa->shop->productImgHtml($p, '200', ['itemprop' => 'image', 'alt' => $p.name, 'default' => "`$wa_theme_url`img/dummy200.png"])}
<h5 itemprop="name">
{$p.name}
</h5>
<!--{if $p.summary}<span itemprop="description">{$p.summary}</span>{/if} --> <!-- тут мы не выводим описание товара в превьювере-->
</div>
<div style="width: 150px; display: inline-block;float: left;">
<!-- product features -->
{if $product.features}
<table class="features" id="product-features">
{foreach $product.features as $f_code => $f_value}
<tr{if $features[$f_code].type == 'divider'} class="divider"{/if}>
<td class="name">
{$features[$f_code].name|escape}
</td>
<td class="value" itemprop="{$f_code|escape}">
{if is_array($f_value)}
{if $features[$f_code].type == 'color'}
{implode('<br /> ', $f_value)}
{else}
{implode(', ', $f_value)}
{/if}
{else}
{$f_value}
{/if}
</td>
</tr>
{/foreach}
</table>
{else}не нашли характеристик елзе добавил для отладки. а в чем проблема так и не понял
{/if}
</div>
<div style="width: 150px; bottom:0;">
{if $p.compare_price > 0}<span class="compare-at-price nowrap"> {shop_currency($p.compare_price)} </span>{/if}
{if $available}
<form class="purchase addtocart2" {if $p.sku_count > 1}data-url="{$p.frontend_url}?cart=1"{/if} method="post" action="{$wa->getUrl('/frontendCart/add')}">
<span class="price nowrap" itemprop="price">{shop_currency_html($p.price)}</span>
<input type="hidden" name="product_id" value="{$p.id}">
<input type="submit" value="Купить">
<span class="added2cart" style="display: none;">{sprintf('[`%s is now <strong>in your shopping cart</strong>`]', $p.name, $wa->getUrl('shop/frontend/cart'))}</span>
</form>
<link itemprop="availability" href="http://schema.org/InStock" />
{else}
<span class="price nowrap" itemprop="price">{shop_currency_html($p.price)}</span>
<div class="out-of-stock"><strong>{if $wa->shop->settings('ignore_stock_count')}[`Pre-order only`]{else}[`Out of stock`]{/if}</strong></div>
<link itemprop="availability" href="http://schema.org/OutOfStock" />
{/if}
</div>
</div>
{/foreach}
<!-- конец вывода блоков-->
{if isset($pages_count) && $pages_count > 1}
<div class="block lazyloading-paging">
{wa_pagination total=$pages_count attrs=['class' => "menu-h"]}
</div>
{/if}
=======================
в чем ошибка ребят?
вот измененный код list-thumbs.html
<!-- products thumbnail list view -->
{if !empty($sorting)}
<!-- sorting -->
{$sort_fields = [
'name' => '[`Name`]',
'price' => '[`Price`]',
'total_sales' => '[`Bestsellers`]',
'rating' => '[`Customer rating`]',
'create_datetime'=>'[`Date added`]',
'stock' => '[`In stock`]']}
{if !isset($active_sort)}
{$active_sort = $wa->get('sort', 'create_datetime')}
{/if}
<ul class="menu-h sorting">
<li>[`Sort by`]:</li>
{if !empty($category) && !$category.sort_products}
<li{if !$active_sort} class="selected"{/if}>[`New & Popular`]</li>
{/if}
{foreach $sort_fields as $sort => $name}
<li{if $active_sort == $sort} class="selected"{/if}>{$wa->shop->sortUrl($sort, $name)}</li>
{if $wa->get('sort') == $sort}{$wa->title( $wa->title()|cat:' — '|cat:$name)}{/if}
{/foreach}
</ul>
{/if}
<!-- начало вывода блоков -->
{foreach $products as $p}
{$available = $wa->shop->settings('ignore_stock_count') || $p.count === null || $p.count > 0}
<div style="border: thick ridge #FFFFFF; padding: 1px; margin: 1px; width: 300px; height: 300px; background-color: #C0C0C0; float: left;">
<div style="width: 150px; display: inline-block;float: left;">
{$badge_html = $wa->shop->badgeHtml($p.badge)}
{if $badge_html}
<div class="corner top right">{$badge_html}</div>
{/if}
{$wa->shop->productImgHtml($p, '200', ['itemprop' => 'image', 'alt' => $p.name, 'default' => "`$wa_theme_url`img/dummy200.png"])}
<h5 itemprop="name">
{$p.name}
</h5>
<!--{if $p.summary}<span itemprop="description">{$p.summary}</span>{/if} --> <!-- тут мы не выводим описание товара в превьювере-->
</div>
<div style="width: 150px; display: inline-block;float: left;">
<!-- product features -->
{if $product.features}
<table class="features" id="product-features">
{foreach $product.features as $f_code => $f_value}
<tr{if $features[$f_code].type == 'divider'} class="divider"{/if}>
<td class="name">
{$features[$f_code].name|escape}
</td>
<td class="value" itemprop="{$f_code|escape}">
{if is_array($f_value)}
{if $features[$f_code].type == 'color'}
{implode('<br /> ', $f_value)}
{else}
{implode(', ', $f_value)}
{/if}
{else}
{$f_value}
{/if}
</td>
</tr>
{/foreach}
</table>
{else}не нашли характеристик елзе добавил для отладки. а в чем проблема так и не понял
{/if}
</div>
<div style="width: 150px; bottom:0;">
{if $p.compare_price > 0}<span class="compare-at-price nowrap"> {shop_currency($p.compare_price)} </span>{/if}
{if $available}
<form class="purchase addtocart2" {if $p.sku_count > 1}data-url="{$p.frontend_url}?cart=1"{/if} method="post" action="{$wa->getUrl('/frontendCart/add')}">
<span class="price nowrap" itemprop="price">{shop_currency_html($p.price)}</span>
<input type="hidden" name="product_id" value="{$p.id}">
<input type="submit" value="Купить">
<span class="added2cart" style="display: none;">{sprintf('[`%s is now <strong>in your shopping cart</strong>`]', $p.name, $wa->getUrl('shop/frontend/cart'))}</span>
</form>
<link itemprop="availability" href="http://schema.org/InStock" />
{else}
<span class="price nowrap" itemprop="price">{shop_currency_html($p.price)}</span>
<div class="out-of-stock"><strong>{if $wa->shop->settings('ignore_stock_count')}[`Pre-order only`]{else}[`Out of stock`]{/if}</strong></div>
<link itemprop="availability" href="http://schema.org/OutOfStock" />
{/if}
</div>
</div>
{/foreach}
<!-- конец вывода блоков-->
{if isset($pages_count) && $pages_count > 1}
<div class="block lazyloading-paging">
{wa_pagination total=$pages_count attrs=['class' => "menu-h"]}
</div>
{/if}
=======================
в чем ошибка ребят?
4 ответа
', $f_value)} {else} {implode(', ', $f_value)} {/if} {else} {$f_value} {/if}
но только аккуратно используйте этот код... почитайте комментарии особенно последние
Добавить ответ