Jump to content

Create Product attribute combination programmatically


gautamkakadiya

Recommended Posts

  • 3 weeks later...

You can use below code for create product combination. It may help you.

 

$id_product=14;
$id_language=1;

$product = new Product($id_product, true, $id_language);

// list of attribute value ids..
$combinationAttributes[] = 2;
$combinationAttributes[] = 5;

if(!$product->productAttributeExists($combinationAttributes))
{
$price = 1;
$weight = 100;
$ecotax = 7;
$unit_price_impact="";
$quantity = 1;
$reference = "";
$supplier_reference = "";
$ean13 = "";
$default = false;

$idProductAttribute = $product->addProductAttribute((float)$price, (float)$weight, $unit_price_impact, (float)$ecotax, (int)$quantity, "", strval($reference), strval($supplier_reference), strval($ean13), $default, NULL, NULL);
$product->addAttributeCombinaison($idProductAttribute, $combinationAttributes);
}

 

[spam-filter]bhargavlalo

  • Like 1
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...