Jump to content

Assign images to combination with addCombinationEntity


JuliusB

Recommended Posts

Prestashop 1.6

Hello everyone,

I tried to create combination with homemade script. Problem is with the id_images use in addCombinationEntity method. I tried to send an array of image ID but no image is assign to the combination.

// created image id
echo (int)$image->id; // Display 2 for example
$id_image[] = (int)$image->id;

$id_product_attribute = $product->addCombinationEntity(15.5, 0, 0, 0, 0, 1, $id_image, "", 0, 0, false);

Combination is created but images are not assign to it. I tried to insert image ID directly into database with no result :


foreach($id_images as $image_id)
{
	Db::getInstance()->execute('INSERT INTO `ps_product_attribute_image` VALUES ('.$id_product_attribute.' '.$image_id.')');
}

 

Can someone help me please ? Thank you !

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...