From 98929f2dbac85245debf9f05670f3ba5947dbfea Mon Sep 17 00:00:00 2001 From: BadPixxel Date: Tue, 2 Nov 2021 14:16:55 +0100 Subject: [PATCH 1/2] FIX: Status propagation from Parent Product toSell or toBuy Status propagation should be done only when parent is updated. Otherwise, any modification made on the parent will overwrite the specific configuration made at the child level. --- htdocs/variants/class/ProductCombination.class.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index b7fc3d620f5..4245f2039c9 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -488,8 +488,14 @@ class ProductCombination $child->price_autogen = $parent->price_autogen; $child->weight = $parent->weight; - $child->status = $parent->status; - + // Only when Parent Status are updated + if ($parent->oldcopy && ($parent->status != $parent->oldcopy->status)) { + $child->status = $parent->status; + } + if ($parent->oldcopy && ($parent->status_buy != $parent->oldcopy->status_buy)) { + $child->status_buy = $parent->status_buy; + } + if ($this->variation_weight) { // If we must add a delta on weight $child->weight = ($child->weight ? $child->weight : 0) + $this->variation_weight; } From 5c10cd5ba9df55220a1f218da5333ec444e01b61 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 2 Nov 2021 13:20:41 +0000 Subject: [PATCH 2/2] Fixing style errors. --- htdocs/variants/class/ProductCombination.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index 4245f2039c9..e1fab396cb8 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -490,12 +490,12 @@ class ProductCombination $child->weight = $parent->weight; // Only when Parent Status are updated if ($parent->oldcopy && ($parent->status != $parent->oldcopy->status)) { - $child->status = $parent->status; - } + $child->status = $parent->status; + } if ($parent->oldcopy && ($parent->status_buy != $parent->oldcopy->status_buy)) { - $child->status_buy = $parent->status_buy; - } - + $child->status_buy = $parent->status_buy; + } + if ($this->variation_weight) { // If we must add a delta on weight $child->weight = ($child->weight ? $child->weight : 0) + $this->variation_weight; }