Alexandru Florea
Alexandru Florea

Reputation: 556

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.

Upvotes: 0

Views: 1554

Answers (2)

Serge P
Serge P

Reputation: 1863

in addition, there is in a products object:

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

for non-pack products

Upvotes: -1

Matteo Enna
Matteo Enna

Reputation: 1301

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}

Upvotes: 2

Related Questions