2016-09-06 155 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}'>

相關問題