您能告诉我如何在任何页面上显示产品名称下的SKU吗? 我试图复制从product.tpl这部分代码,但它说明不了什么:(Presta - 在任何页面上显示产品名称下的SKU
在产品页面(product.tpl)我使用:
{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>
,我试图复制这一部分:
<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):
<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>
所以它看起来像:
<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>
<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>
但它说明不了什么......
请编辑与相关的代码和文件名后。 –
我做到了,现在应该更容易理解:) – joryl