From 4819166d75a023123906244ebb0b1297b329dd1d Mon Sep 17 00:00:00 2001 From: merdan Date: Wed, 13 Apr 2022 17:08:21 +0500 Subject: [PATCH] product update finish for tesrt --- .../Shop/src/Repositories/ProductRepository.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/packages/Sarga/Shop/src/Repositories/ProductRepository.php b/packages/Sarga/Shop/src/Repositories/ProductRepository.php index c74685f36..d678c786e 100644 --- a/packages/Sarga/Shop/src/Repositories/ProductRepository.php +++ b/packages/Sarga/Shop/src/Repositories/ProductRepository.php @@ -327,9 +327,8 @@ class ProductRepository extends WProductRepository // 'short_description' => $data['url_key'], 'description' => implode(array_map(fn($value): string => '

' . $value['description'] . '

', $data['descriptions'])) ]; - $main_attributes[] = $this->calculatePrice($data['price']); - $this->assignAttributes($parentProduct, $main_attributes); + $this->assignAttributes($parentProduct, array_merge($main_attributes, $this->calculatePrice($data['price']))); if (!empty($data['images'])) { $this->assignImages($parentProduct, $data['images']); @@ -374,7 +373,7 @@ class ProductRepository extends WProductRepository 'description' => $description ]; $attributes[] = $this->calculatePrice($sizeVariant['price']); - $this->assignAttributes($variant, $attributes); + $this->assignAttributes($variant, array_merge($attributes,$this->calculatePrice($sizeVariant['price']))); } } @@ -395,8 +394,8 @@ class ProductRepository extends WProductRepository 'source' => $colorVariant['url_key'], 'description' => $description ]; - $attributes[] = $this->calculatePrice($colorVariant['price']); - $this->assignAttributes($variant, $attributes); + + $this->assignAttributes($variant, array_merge($attributes,$this->calculatePrice($colorVariant['price']))); } } } @@ -423,13 +422,11 @@ class ProductRepository extends WProductRepository 'description' => implode(array_map(fn($value): string => '

' . $value['description'] . '

', $data['descriptions'])) ]; - $attributes[] =$this->calculatePrice($sizeVariant['pice']); - if (!empty($data['color'])) { $attributes['color'] = $this->getAttributeOptionId('color', $data['color']); } - $this->assignAttributes($variant, $attributes); + $this->assignAttributes($variant, array_merge($attributes,$this->calculatePrice($sizeVariant['pice']))); } } }