Prestashop 1.6。如何检查产品是否在 .tpl 中打包?

Prestashop 1.6. How to check if product isPack in .tpl?

我要查看主题(前面)product.tpl文件(PS1.6.1.4) if state if product is Standard product or Pack of existing products

{if $product_type == Product::PTYPE_PACK} 不工作....

我要 return boolean.

使用:

{if $packItems|@count > 0}

您可以在主题文件夹的 product.tpl 中找到使用示例。 以这种方式使用:

    {if $packItems|@count > 0}
            <div class="short_description_pack">
            <h3>{l s='Pack content'}</h3>
                    {foreach from=$packItems item=packItem}

                    <div class="pack_content">
                            {$packItem.pack_quantity} x <a href="{$link->getProductLink($packItem.id_product, $packItem.link_rewrite, $packItem.category)|escape:'html':'UTF-8'}">{$packItem.name|escape:'html':'UTF-8'}</a>
                            <p>{$packItem.description_short}</p>
                    </div>
                    {/foreach}
            </div>
    {/if}

此外,在产品对象中有:

$product->id_pack_product_attribute = null 
$product->cache_is_pack = 0

对于非包装产品