我在prestashop 1.6上,我需要在数量可用的附近显示一个标签,告诉用户该产品是可用的,或者当数量设置为0时,准备订购。
只有当您为商店中的每件商品逐一设置这两条消息时,Prestashop才会执行此操作。我只需要所有产品的默认消息。
我位于 product.tpl 此代码:
<!-- 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>
我认为这样做,但我真的不明白如何编辑它以显示每个案例的默认值,也许利用类标签
提前谢谢
答案 0 :(得分:1)
试试这段代码:
<!-- 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>
干杯:)