2016-09-06 156 views
2

首先,我必须说,我是新来的Prestashop,到目前为止,我爱的可用功能。不过,我陷入了一些我觉得应该很容易的事情。我必须对smarty模板引擎的工作原理感到遗憾。的Prestashop产品list.tpl自定义添加到购物车款

其难以解释与实际出发看到它的整个问题。在我们的新网站www.eliquidonline.co.uk我正在研究产品上市模板,并希望改变展示价格和广告到购物车区域的外观和感觉。

我设计的外观,而一个产品,都有出售,所以我可以价格,折扣等ammount的前添加,但现在我已经采取了产品的折扣销售这个领域不会显示。你可以看到自己使用上面的链接。

代码中,我至今是:

{if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))} 
       <div class="pricecontainwrapper"> 
       <div class="addpricetag">{if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)} 
         {hook h="displayProductPriceBlock" product=$product type='before_price'} 
         <span class="smalltext">Was </span><span class="smallstrike">{if $product.price_without_reduction > 0 && isset($product.specific_prices) && $product.specific_prices && isset($product.specific_prices.reduction) && $product.specific_prices.reduction > 0} 
          {hook h="displayProductPriceBlock" product=$product type="old_price"}{displayWtPrice p=$product.price_without_reduction}</span><div class="pricetag">{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</div></div><a href="{$product.link|escape:'html':'UTF-8'}" title="{l s='View'}"><div class="addcartpricebutron">Add To cart</div></a> 

       </div> 
       {hook h="displayProductPriceBlock" id_product=$product.id_product type="old_price"} 
          {if $product.specific_prices.reduction_type == 'percentage'} 
         <div class="pricereduction">SALE -{$product.specific_prices.reduction * 100}% OFF</div> 

          {/if} 
         {/if} 
         {hook h="displayProductPriceBlock" product=$product type="price"} 
         {hook h="displayProductPriceBlock" product=$product type="unit_price"} 
         {hook h="displayProductPriceBlock" product=$product type='after_price'} 
        {/if} 
       </div> 
       {/if} 

现在我猜想之一,如果Smarty模板的报表不显示所有的代码,但不能找出原因。任何信息为什么会非常感激。

+0

究竟是什么问题?显然,如果你没有销售产品,它不会显示旧价格,折扣百分比等等,因为没有旧价格或折扣。 – TheDrot

回答

0

如果您的产品发售在产品管理页面。然后你可以访问变量on_sale

在foreach循环:

{foreach from=$products item=product name=products} 
    <!-- {$product.on_sale} code here --> 
{/foreach} 

您可以访问像{$product.on_sale}变量。像这样:

<div class='{if isset($product.on_sale) && $product.on_sale}your-special-discount-class{/if}'>

相关问题