Hi,
I was not able to log on your FTP server but I think I found the problem.
change the code:
$results = $this->database->loadObjectList();
if(!empty($results)){
foreach($results as $variant){
foreach($element->characteristics as $char){
$char_ids = array();
foreach($char->values as $k => $val){
$char_ids[]=$k;
}
if(!in_array($variant->variant_characteristic_id,$char_ids)){
$this->database->setQuery('INSERT IGNORE INTO '.hikashop_table('variant').' (variant_characteristic_id,variant_product_id,ordering) VALUES ('.$char->default_id.','.$variant->variant_product_id.',0);');
$this->database->query();
}
}
}
}
to:
$links = $this->database->loadObjectList();
if(!empty($results)){
//for each variant, and for ech characteristic, if the link is missing between both, add one between the variant and the default value of the characteristic
foreach($results as $variant){
foreach($links as $link){
if($link->variant_product_id==$results->product_id){
foreach($element->characteristics as $char){
$found = false;
foreach($char->values as $k => $val){
if($k==$link->variant_characteristic_id){
$found = true;
}
}
if(!$found){
$this->database->setQuery('INSERT IGNORE INTO '.hikashop_table('variant').' (variant_characteristic_id,variant_product_id,ordering) VALUES ('.$char->default_id.','.$link->variant_product_id.',0);');
$this->database->query();
}
}
}
}
}
}
in the file administrator/components/com_hikashop/classes/product.php and that should fix the problem.
Let me know how it goes.