Jump to content

How to check if the product has combinations in Prestashop 1.7


Recommended Posts

 

I create my first module. I check the product classe and I don't any method to check if the product has already combinations by id or by name. For now I have something like this:

$singleStock = $product->attributes()->stock->__toString();
$attrs = $product->attrs->attr[3]->__toString();

$product = new Product($checkUniqueID[0]['id_product']);

$this->addAttributesToProduct($product, $singleStock, $attrs);

 

This code add combinations, size of the clothes from XML to object product. I want to check if the product has already this combination. Thanks for any clue.

Link to comment
Share on other sites

  • 1 year later...

Hi, 
to those who stumble in this question, here's some way:
If you want to check if product has combination: use Product class hasAttributes() method, e.g. Product('id_product')->hasAttributes().
Regards

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...