在Prestashop 1.7.6购物车上显示产品的可用性

问题描述 投票:0回答:1

我使用Prestashop 1.7.6我需要在购物车上的每个产品明细上显示产品的可用性。我要在cart-detailed-product-line.tpl和/或其他文件中添加什么?

prestashop prestashop-1.7
1个回答
0
投票

尝试使用:

{if (!$PS_CATALOG_MODE && $PS_STOCK_MANAGEMENT && ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}                                   
      {if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}
          <span itemprop="offers" itemscope itemtype="http://schema.org/Offer" class="availability">
              {if ($product.allow_oosp || $product.quantity > 0)}
                  <span class="{if $product.quantity <= 0 && !$product.allow_oosp}out-of-stock{else}available-now{/if}">
                      <link itemprop="availability" href="http://schema.org/InStock" />{if $product.quantity <= 0}{if $product.allow_oosp}{if isset($product.available_later) && $product.available_later}{$product.available_later}{else}{l s='In Stock'}{/if}{else}{l s='Out of stock'}{/if}{else}{if isset($product.available_now) && $product.available_now}{$product.available_now}{else}{l s='In Stock'}{/if}{/if}
                  </span>
              {elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}
                  <span class="available-dif">
                      <link itemprop="availability" href="http://schema.org/LimitedAvailability" />{l s='Product available with different options'}
                  </span>
              {else}
                  <span class="out-of-stock">
                      <link itemprop="availability" href="http://schema.org/OutOfStock" />{l s='Out of stock'}
                  </span>
              {/if}
          </span>
      {/if}
  {/if}

将其添加到要显示此信息的位置。

© www.soinside.com 2019 - 2024. All rights reserved.