diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index 0e8f69958dc..215536ac43a 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -281,7 +281,9 @@ class ProductCombination { global $conf; - $sql = "SELECT rowid, fk_product_parent, fk_product_child, variation_price, variation_price_percentage, variation_weight FROM ".MAIN_DB_PREFIX."product_attribute_combination WHERE fk_product_parent = ".((int) $fk_product_parent)." AND entity IN (".getEntity('product').")"; + $sql = "SELECT rowid, fk_product_parent, fk_product_child, variation_price, variation_price_percentage, variation_ref_ext, variation_weight"; + $sql.= " FROM ".MAIN_DB_PREFIX."product_attribute_combination"; + $sql.= " WHERE fk_product_parent = ".((int) $fk_product_parent)." AND entity IN (".getEntity('product').")"; $query = $this->db->query($sql); @@ -489,10 +491,10 @@ class ProductCombination $child->price_autogen = $parent->price_autogen; $child->weight = $parent->weight; // Only when Parent Status are updated - if ($parent->oldcopy && ($parent->status != $parent->oldcopy->status)) { + if (!empty($parent->oldcopy) && ($parent->status != $parent->oldcopy->status)) { $child->status = $parent->status; } - if ($parent->oldcopy && ($parent->status_buy != $parent->oldcopy->status_buy)) { + if (!empty($parent->oldcopy) && ($parent->status_buy != $parent->oldcopy->status_buy)) { $child->status_buy = $parent->status_buy; } diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index b6ffd948bd6..f01e674c44a 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -69,7 +69,7 @@ if ($id > 0 || $ref) { $object->fetch($id, $ref); } -$selectedvariant = !empty($_SESSION['addvariant_'.$object->id]) ? $_SESSION['addvariant_'.$object->id] : 0; +$selectedvariant = !empty($_SESSION['addvariant_'.$object->id]) ? $_SESSION['addvariant_'.$object->id] : array(); // Security check if (empty($conf->variants->enabled)) { @@ -154,7 +154,7 @@ if (($action == 'add' || $action == 'create') && empty($massaction) && !GETPOST( $price_impact = price2num($price_impact); // for conf PRODUIT_MULTIPRICES - if ($conf->global->PRODUIT_MULTIPRICES) { + if (!empty($conf->global->PRODUIT_MULTIPRICES)) { $level_price_impact = array_map('price2num', $level_price_impact); } else { $level_price_impact = array(1 => $price_impact); @@ -279,7 +279,7 @@ if (($action == 'add' || $action == 'create') && empty($massaction) && !GETPOST( $prodcomb->variation_weight = price2num($weight_impact); // for conf PRODUIT_MULTIPRICES - if ($conf->global->PRODUIT_MULTIPRICES) { + if (!empty($conf->global->PRODUIT_MULTIPRICES)) { $level_price_impact = array_map('price2num', $level_price_impact); $prodcomb->variation_price = $level_price_impact[1]; @@ -292,7 +292,7 @@ if (($action == 'add' || $action == 'create') && empty($massaction) && !GETPOST( $prodcomb->variation_price_percentage = $price_impact_percent; } - if ($conf->global->PRODUIT_MULTIPRICES) { + if (!empty($conf->global->PRODUIT_MULTIPRICES)) { $prodcomb->combination_price_levels = array(); for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) { $productCombinationLevel = new ProductCombinationLevel($db);