Souljacker
Souljacker

Reputation: 595

Getting product's tags in Prestashop

I'm new to Prestashop and I'm really struggling with it. The lack of a good documentation is a really disadvantage ans sometimes I fell like trying Magento or something like that.

Anyway, I'm trying to make a product page display a info ONLY if that product is tagged with a certain tag. I've searched for about 3 hours all over internet but couldn't find anything that solved this issue.

How can I do it? Could any of you guys please gimme a direction?

BTW, I'm using 1.5

Thanks

Upvotes: 2

Views: 1864

Answers (2)

moein kh
moein kh

Reputation: 479

if you use prestashop 1.5 you need

   //this is your prooduct id that you get it from your url
   $id_product=Tools::getValue('id_product');
   //the you use it to return all of your tags of this product with this id product
   //but this return two array for example: array(array(tags))
   $productTags =Tag::getProductTags($id_product);
   //add this code return array(tags) ;
   $productTags=$productTags[intval(Context::getContext()->cookie->id_lang)];

Upvotes: 4

Alexander Simonchik
Alexander Simonchik

Reputation: 966

you can look inside the Product class. For example: Tag::getProductTags($id_product) function

Regards

Upvotes: 0

Related Questions