Search code examples
smartyprestashopprestashop-1.6

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


I want to check in theme (front) product.tpl file (PS 1.6.1.4) if state if product is Standard product or Pack of existing products

{if $product_type == Product::PTYPE_PACK} not working....

I want to return boolean.


Solution

  • use:

    {if $packItems|@count > 0}
    

    an example of using you can find it in product.tpl in the theme folder. used in this way:

        {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}