@@ -177,20 +177,7 @@ public function store(Request $request)
177177 Log::info ('VariationAttribute (size) processed ' , ['id ' => $ attrVariation ->id , 'attribute_value_id ' => $ attributeValue ['id ' ]]);
178178
179179 // Gestion des prix de gros pour cette VariationAttribute spécifique
180- if (isset ($ attributeValue ['is_wholesale ' ]) && $ attributeValue ['is_wholesale ' ] &&
181- isset ($ attributeValue ['wholesale_prices ' ]) && is_array ($ attributeValue ['wholesale_prices ' ])) {
182-
183- // Supprime les anciens prix de gros pour éviter les doublons si vous utilisez updateOrCreate
184- $ attrVariation ->wholesalePrices ()->delete ();
185-
186- foreach ($ attributeValue ['wholesale_prices ' ] as $ wholesalePriceData ) {
187- $ attrVariation ->wholesalePrices ()->create ([ // Lie les prix de gros à VariationAttribute
188- 'min_quantity ' => $ wholesalePriceData ['min_quantity ' ],
189- 'wholesale_price ' => $ wholesalePriceData ['wholesale_price ' ],
190- ]);
191- Log::info ('Attribute variation wholesale price saved ' , ['attr_variation_id ' => $ attrVariation ->id , 'min_quantity ' => $ wholesalePriceData ['min_quantity ' ]]);
192- }
193- }
180+
194181 }
195182 }
196183
@@ -209,20 +196,7 @@ public function store(Request $request)
209196 Log::info ('VariationAttribute (shoe size) processed ' , ['id ' => $ attrVariation ->id , 'attribute_value_id ' => $ attributeValue ['id ' ]]);
210197
211198 // Gestion des prix de gros pour cette VariationAttribute spécifique
212- if (isset ($ attributeValue ['is_wholesale ' ]) && $ attributeValue ['is_wholesale ' ] &&
213- isset ($ attributeValue ['wholesale_prices ' ]) && is_array ($ attributeValue ['wholesale_prices ' ])) {
214-
215- // Supprime les anciens prix de gros pour éviter les doublons si vous utilisez updateOrCreate
216- $ attrVariation ->wholesalePrices ()->delete ();
217-
218- foreach ($ attributeValue ['wholesale_prices ' ] as $ wholesalePriceData ) {
219- $ attrVariation ->wholesalePrices ()->create ([ // Lie les prix de gros à VariationAttribute
220- 'min_quantity ' => $ wholesalePriceData ['min_quantity ' ],
221- 'wholesale_price ' => $ wholesalePriceData ['wholesale_price ' ],
222- ]);
223- Log::info ('Attribute variation wholesale price saved ' , ['attr_variation_id ' => $ attrVariation ->id , 'min_quantity ' => $ wholesalePriceData ['min_quantity ' ]]);
224- }
225- }
199+
226200 }
227201 }
228202 }
0 commit comments