doumuyu0837 2018-06-08 18:47
浏览 23
已采纳

Prestashop:如果产品库存缺货(允许订购),如何显示默认标签?

I'm on prestashop 1.6 and I need to show a label, near the quantity avaiable, that tells to the user that the product is avaiable, or when quantity is set to 0, ready to be ordered.

Prestashop does this already only if you set these two message, one by one, for each product in your store. I just need a default message for all the products.

I've located on product.tpl this code:

    <!-- availability or doesntExist -->
    <p {if !$PS_STOCK_MANAGEMENT || ($product->quantity <= 0 && !$product->available_later && $allow_oosp) || ($product->quantity > 0 && !$product->available_now) || !$product->available_for_order || $PS_CATALOG_MODE} style="display: none;"{/if}>
        {*<span id="availability_label">{l s='Availability:'}</span>*}
        <span id="availability_value" class="label{if $product->quantity <= 0 && !$allow_oosp} label-danger{elseif $product->quantity <= 0} label-warning{else} label-success{/if}">{if $product->quantity <= 0}{if $PS_STOCK_MANAGEMENT && $allow_oosp}{$product->available_later}{else}{l s='FANCULO'}{/if}{elseif $PS_STOCK_MANAGEMENT}{$product->available_now}{/if}</span>
    </p>

That I think do the job, but I really don't understand how to edit this to show a default value for each case, maybe taking advantage of the class label

thank you in advance

  • 写回答

1条回答 默认 最新

  • dongyouzhui1969 2018-06-11 12:16
    关注

    Try this code :

    <!-- availability or doesntExist -->
    <p id="availability_statut"{if !$PS_STOCK_MANAGEMENT || ($product->quantity <= 0 && !$product->available_later && $allow_oosp) || ($product->quantity > 0 && !$product->available_now) || !$product->available_for_order || $PS_CATALOG_MODE} style="display: none;"{/if}>
                    <span id="availability_value" class="label{if $product->quantity <= 0 && !$allow_oosp} label-danger{elseif $product->quantity <= 0} label-warning{else} label-success{/if}">
                        {if $product->quantity <= 0}
                            {if $PS_STOCK_MANAGEMENT && $allow_oosp}
                                {l s='product available later'}
                            {else}
                                {l s='This product is no longer in stock'}
                            {/if}
                        {elseif $PS_STOCK_MANAGEMENT}
                            {l s='available for order'}
                        {/if}
                    </span>
                </p>
    

    Cheers :)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 求解vmware的网络模式问题
  • ¥24 EFS加密后,在同一台电脑解密出错,证书界面找不到对应指纹的证书,未备份证书,求在原电脑解密的方法,可行即采纳
  • ¥15 springboot 3.0 实现Security 6.x版本集成
  • ¥15 PHP-8.1 镜像无法用dockerfile里的CMD命令启动 只能进入容器启动,如何解决?(操作系统-ubuntu)
  • ¥30 请帮我解决一下下面六个代码
  • ¥15 关于资源监视工具的e-care有知道的嘛
  • ¥35 MIMO天线稀疏阵列排布问题
  • ¥60 用visual studio编写程序,利用间接平差求解水准网
  • ¥15 Llama如何调用shell或者Python
  • ¥20 谁能帮我挨个解读这个php语言编的代码什么意思?