From 0fd80bf5034141dd8887691253a529c00d7aa4e7 Mon Sep 17 00:00:00 2001 From: merdan Date: Mon, 30 May 2022 14:35:54 +0500 Subject: [PATCH] management integration start --- .../Sarga/API/Http/Resources/Catalog/ProductVariant.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/Sarga/API/Http/Resources/Catalog/ProductVariant.php b/packages/Sarga/API/Http/Resources/Catalog/ProductVariant.php index 8130e055a..5194bc4b6 100644 --- a/packages/Sarga/API/Http/Resources/Catalog/ProductVariant.php +++ b/packages/Sarga/API/Http/Resources/Catalog/ProductVariant.php @@ -53,20 +53,22 @@ class ProductVariant extends JsonResource private function super_attributes(){ if(is_countable($this->attributes)){ return $this->attributes->map(function($item, $key){ + $option = $item->options()->where('id',$this->{$item->code})->first(); return [ 'code' => $item->id, 'value' => $this->{$item->code}, 'name' => $item->name??$item->admin_name, - 'label' => $item->options->where('id',$this->{$item->code})->first()->admin_name + 'label' => $option->admin_name, ]; })->toArray(); }else{ $item = $this->attributes; + $option = $item->options()->where('id',$this->{$item->code})->first(); return [ 'code' => $item->id, 'value' => $this->{$item->code}, 'name' => $item->name??$item->admin_name, - 'label' => $item->options->where('id',$this->{$item->code})->first()->admin_name + 'label' => $option->admin_name, ]; }