您能告诉我如何在任何页面上的产品名称下显示SKU吗? 我试图从product.tpl复制这部分代码,但它没有显示任何内容:(
在产品页面(product.tpl)上我使用:
for (int i = 0; i <= sheet.getLastRowNum (); ++i) {
row=(Row) sheet.getRow(i);
Iterator<Cell> cells = row.cellIterator();
while (cells.hasNext())
{ .....
我试图复制这部分:
{if $product->online_only}
<p class="online_only">{l s='Online only'}</p>
{/if}
<div class="clearfix product-header-cust">
<h1 itemprop="name" style="float: left;">{$product->name|escape:'html':'UTF-8'}</h1>
<p id="reduction_percent" style="float: left;" {if !$product->specificPrice || $product->specificPrice.reduction_type != 'percentage'} style="display:none;"{/if}>
<span id="reduction_percent_display" class="reduction_percent_display_cust">
{if $product->specificPrice && $product->specificPrice.reduction_type == 'percentage'}-{$product->specificPrice.reduction*100}%{/if}
</span>
</p>
</div>
<p id="product_reference"{if empty($product->reference) || !$product->reference}"{/if}>
<label>{l s='Model'} </label>
<span class="editable undertitle" itemprop="sku">{if !isset($groups)}{$product->reference|escape:'html':'UTF-8'}{/if}</span>
</p>
在此(product_list.tpl)下:
<p id="product_reference"{if empty($product->reference) || !$product->reference}"{/if}>
<label>{l s='Model'} </label>
<span class="editable undertitle" itemprop="sku">{if !isset($groups)}{$product->reference|escape:'html':'UTF-8'}{/if}</span>
</p>
所以看起来像:
<h5 itemprop="name" class="product-list-name">
{if isset($product.pack_quantity) && $product.pack_quantity}{$product.pack_quantity|intval|cat:' x '}{/if}
<a class="product-name" href="{$product.link|escape:'html':'UTF-8'}" title="{$product.name|escape:'html':'UTF-8'}" itemprop="url" >
{$product.name|truncate:45:'...'|escape:'html':'UTF-8'}
</a>
</h5>
但它没有显示......
答案 0 :(得分:2)
尝试:
{if isset($product.reference) && $product.reference}
<p id="product_reference">
<label>{l s='Model'} </label>
<span class="editable undertitle" itemprop="sku"> {$product.reference|escape:'html':'UTF-8'}</span>
</p>
{/if}
此致