aviaPL
aviaPL

Reputation: 99

How to check if product has attribute in Prestashop 1.6

Simple question but I don't know what is wrong. I want to check if product has attributes or combinations. If i write:

{$product->id_product_attribute|@print_r}

I have no results. What is wrong ?

Upvotes: 0

Views: 1446

Answers (1)

ProEvilz
ProEvilz

Reputation: 5455

You can check whether a product has attributes with the following:

$product->hasAttributes() is used in php files

and

$product.id_product_attribute == 0 or >0 is used in tpl files.

A great resource for finding things of this nature is to look through Prestashop's Github repo for 1.6 E.G. in this instance, the Product.php class.

Upvotes: 1

Related Questions