【问题标题】:PRESTASHOP 1.7.6: Display the unit price on all pages of the website, not just on the product pagePRESTASHOP 1.7.6:在网站的所有页面上显示单价,而不仅仅是在产品页面上
【发布时间】:2020-11-17 16:36:59
【问题描述】:

我正在寻找可以让我在我网站的所有页面上显示产品单价的模块或其他模块。例如,我有我的新产品主页,我希望在我的产品价格和添加到购物车按钮之间显示单价。 因此,我已经在产品页面中显示了单价,prestashop 通过检查一个选项来本地执行此操作,但对于网站的其余部分则不执行此操作。 我已经尝试将此代码放入我的 tpl 文件中,但没有任何成功...

{block name='product_unit_price'}
   {if $displayUnitPrice}
      <p class="product-unit-price sub">{l s='(%unit_price%)' d='Shop.Theme.Catalog' sprintf=['%unit_price%' => $product.unit_price_full]}</p>
   {/if}
{/block}

我不是 prestashop tpl 文件和钩子方面的专家,我一定做错了。 我需要帮助,有人知道吗?

【问题讨论】:

    标签: templates hook prestashop-1.7 price


    【解决方案1】:

    我认为你可以编写一个连接到displayProductPriceBlock 钩子的 Prestashop 模块。

    我认为这可以帮助你,这个钩子用于以下模板:

    /themes/classic/templates/catalog/_partials/miniatures/product.tpl
    /themes/classic/templates/catalog/_partials/product-prices.tpl
    /themes/classic/templates/checkout/_partials/cart-summary-product-line.tpl
    /themes/classic/templates/checkout/_partials/order-confirmation-table.tpl
    

    如果我能提供帮助,请不要犹豫!

    【讨论】:

    • 是否可以只显示部分产品的单价?例如,如果我的一件商品在 presta 后台输入了单价,我是否可以检索此变量并仅在变量存在时显示价格?
    • 嗨,是的,有可能 :) 您可以在显示单价之前添加一个 if 语句来检查单价是否已填写
    猜你喜欢
    • 2019-12-04
    • 2021-02-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多