Alex Florea Alex Florea - 1 year ago 226
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.

Answer Source


{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>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download