在价格为0的prestashop 1.7的产品上显示“立即下载”

问题描述

ps 1.7

我有一个虚拟商店,当价格为零时,我想将“添加到购物车”按钮更改为“立即下载”。我的意思是,对于免费产品,将“添加到购物车”按钮更改为“下载”

我在product.tpl中使用了它:

        {if $product->price <= 0}
        {l s='Download Now'}
        {else}
        {l s='Add to cart' d='Shop.Theme.Actions'}
        {/if}

但没有用, 那么我该如何解决呢?

解决方法

此问题解决了:

    <div class="add">
      <button
        class="btn btn-primary add-to-cart"
        data-button-action="add-to-cart"
        type="submit"
        {if !$product.add_to_cart_url}
          disabled
        {/if}
      >
        <i class="material-icons shopping-cart">&#xE547;</i>
        {if $product.price_amount <= 0}
          {l s='Download now'}
        {else}
          {l s='Add to cart' d='Shop.Theme.Actions'}
        {/if}
      </button>
    </div>

原始线程: https://www.prestashop.com/forums/topic/1034864-display-download-now-on-products-that-have-0-price/