简体   繁体   English

prestashop product-list.tpl定制添加到购物车部分

[英]prestashop product-list.tpl custom add to cart section

Firstly i have to say i'm new to prestashop and so far i Love the features available. 首先,我必须说我是prestashop的新手,到目前为止,我喜欢可用的功能。 However i have got stuck on something which i feel should be easy. 但是我陷入了我觉得应该很容易的事情。 I must be missing something with how the smarty template engine works. 关于Smarty模板引擎的工作原理,我一定会有所遗漏。

its hard to explain the whole problem with out actually seeing it. 很难在没有实际看到的情况下解释整个问题。 at our new site www.eliquidonline.co.uk i'm working on the product listing template and wanted to change how thw look and feel of the show price and ad to cart area looked. 在我们的新网站www.eliquidonline.co.uk上,我正在研究产品列表模板,并希望更改显示价格和购物车区域的外观。

i designed the look whilst a product was on sale so i could add the before price, discount ammount etc. but now i have taken a product off sale this area does not display. 我在销售产品时设计外观,因此我可以添加之前的价格,折扣金额等。但是现在我已经关闭产品销售,此区域不显示。 You can see for yourself using the link above. 您可以使用上面的链接亲自查看。

The code i have so far is : 我到目前为止的代码是:

{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}

now i presume one of the if statements of the smarty template is not displaying all of the code but can't figure out why. 现在,我假设smarty模板的if语句之一不会显示所有代码,但无法弄清楚原因。 any info on why would be very much appreciated. 关于为什么的任何信息将不胜感激。

If your product is put on sale in the product admin page. 如果您的产品在产品管理页面上出售。 Then you could access the variable on_sale . 然后,您可以访问变量on_sale

Within the foreach loop: 在foreach循环中:

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

You can access the variable like {$product.on_sale} . 您可以访问{$product.on_sale}类的变量。 Like this: 像这样:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM