Jump to content

Programatically add combinations


MrBaseball34

Recommended Posts

  • 2 weeks later...

Hey,

try this:

 

public function addCombination()
{
$attributes = Attribute::getAttributes($id_lang);

$this->product = new Product($product_id, true, self::$cookie->id_lang);	

// list of attribute ids..
$combinationAttributes[] = $attributes[0]['id_attribute'];
$combinationAttributes[] = $attributes[1]['id_attribute'];
if(!$this->product->productAttributeExists($combinationAttributes))
{
	$price = 1;
	$weight = 100;
	$ecotax = 7;
	$unit_price_impact;
	$quantity = 1;
	$reference = "";
	$supplier_reference = "";
	$ean13 = "";
	$default = false;

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

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

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