Alex Florea Alex Florea - 2 months ago 13
Smarty Question

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

I want to check in theme (front) product.tpl file (PS 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.



{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'}">{$|escape:'html':'UTF-8'}</a>