From dce93197d7535a3290d0562b453934120410cfd7 Mon Sep 17 00:00:00 2001 From: "gael.langlais" Date: Fri, 22 May 2020 17:58:24 +0200 Subject: [PATCH] FIX #13908 keep child label if modified by user --- .../variants/class/ProductCombination.class.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index f19c81960db..c3cb5f77a5f 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -326,11 +326,16 @@ class ProductCombination $child = new Product($this->db); $child->fetch($this->fk_product_child); - $child->price_autogen = $parent->price_autogen; - $child->weight = $parent->weight + $this->variation_weight; - $child->weight_units = $parent->weight_units; - $varlabel = $this->getCombinationLabel($this->fk_product_child); - $child->label = $parent->label.$varlabel; + $child->price_autogen = $parent->price_autogen; + $child->weight = $parent->weight + $this->variation_weight; + $child->weight_units = $parent->weight_units; + + // Don't update the child label if the user modified it. + if ($child->label == $parent->label) { + // This will trigger only at variant creation time + $varlabel = $this->getCombinationLabel($this->fk_product_child); + $child->label = $parent->label.$varlabel;; + } if ($child->update($child->id, $user) > 0) { $new_vat = $parent->tva_tx;