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 :)

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

报告相同问题?

悬赏问题

  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题
  • ¥20 yolov5自定义Prune报错,如何解决?