From b4cb3083c8322a3a3b4b8482430af29f305b7042 Mon Sep 17 00:00:00 2001 From: merdan Date: Thu, 14 Apr 2022 11:21:40 +0500 Subject: [PATCH] remove admin_locale --- .../Http/Controllers/IntegrationController.php | 3 +++ .../Shop/src/Repositories/ProductRepository.php | 15 ++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/packages/Sarga/API/Http/Controllers/IntegrationController.php b/packages/Sarga/API/Http/Controllers/IntegrationController.php index 542be68de..29f743313 100644 --- a/packages/Sarga/API/Http/Controllers/IntegrationController.php +++ b/packages/Sarga/API/Http/Controllers/IntegrationController.php @@ -35,6 +35,9 @@ class IntegrationController extends Controller try { $data = json_decode(request()->getContent(),true); + if(!$data){ + return response()->json(['message'=>'data not found'],405); + } } catch (\Exception $e){ Log::error($e->getMessage()); diff --git a/packages/Sarga/Shop/src/Repositories/ProductRepository.php b/packages/Sarga/Shop/src/Repositories/ProductRepository.php index d399edd23..508c0ec05 100644 --- a/packages/Sarga/Shop/src/Repositories/ProductRepository.php +++ b/packages/Sarga/Shop/src/Repositories/ProductRepository.php @@ -315,6 +315,7 @@ class ProductRepository extends WProductRepository //create product $parentProduct = $this->getModel()->create($product); + $desc = implode(array_map(fn($value): string => '

' . $value['description'] . '

', $data['descriptions'])); $main_attributes = [ 'sku' => $parentProduct->sku, 'product_number' => $data['product_number'], @@ -324,8 +325,8 @@ class ProductRepository extends WProductRepository 'status' => 1, 'visible_individually' => 1, 'url_key' => $parentProduct->sku, -// 'short_description' => $data['url_key'], - 'description' => implode(array_map(fn($value): string => '

' . $value['description'] . '

', $data['descriptions'])) + 'short_description' => $desc, + 'description' => $desc ]; $this->assignAttributes($parentProduct, array_merge($main_attributes, $this->calculatePrice($data['price']))); @@ -370,7 +371,8 @@ class ProductRepository extends WProductRepository 'visible_individually' => 1, 'url_key' => $variant->sku, 'source' => $colorVariant['url_key'], - 'description' => $description + 'description' => $description, + 'short_description' => $description ]; $attributes[] = $this->calculatePrice($sizeVariant['price']); $this->assignAttributes($variant, array_merge($attributes,$this->calculatePrice($sizeVariant['price']))); @@ -392,7 +394,8 @@ class ProductRepository extends WProductRepository 'visible_individually' => 1, 'url_key' => $variant->sku, 'source' => $colorVariant['url_key'], - 'description' => $description + 'description' => $description, + 'short_description' => $description ]; $this->assignAttributes($variant, array_merge($attributes,$this->calculatePrice($colorVariant['price']))); @@ -406,6 +409,7 @@ class ProductRepository extends WProductRepository if($variant = $this->createVariant($parentProduct, "{$data['product_group_id']}-{$data['product_number']}-{$sizeVariant['itemNumber']}")){ $this->assignImages($variant, $data['images']); + $desc = implode(array_map(fn($value): string => '

' . $value['description'] . '

', $data['descriptions'])); $attributes = [ 'sku' => $variant->sku, 'size' => $this->getAttributeOptionId('size', $sizeVariant['attributeValue']), @@ -419,7 +423,8 @@ class ProductRepository extends WProductRepository 'visible_individually' => 1, 'url_key' => $variant->sku, 'source' => $data['url_key'], - 'description' => implode(array_map(fn($value): string => '

' . $value['description'] . '

', $data['descriptions'])) + 'description' => $desc, + 'short_description' => $desc ]; if (!empty($data['color'])) {