From f57e0c67200d6efde74ade6f404cb0e1fda49d90 Mon Sep 17 00:00:00 2001 From: jitendra Date: Mon, 1 Oct 2018 12:07:32 +0530 Subject: [PATCH] Configurable option on cart page --- packages/Webkul/Checkout/src/Cart.php | 7 +++++-- packages/Webkul/Shipping/composer.json | 2 +- .../Shop/src/Resources/views/checkout/cart/index.blade.php | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/Webkul/Checkout/src/Cart.php b/packages/Webkul/Checkout/src/Cart.php index ec1c41953..67f4a1f54 100644 --- a/packages/Webkul/Checkout/src/Cart.php +++ b/packages/Webkul/Checkout/src/Cart.php @@ -368,10 +368,10 @@ class Cart { } if($data['is_configurable'] == "true") { - $this->canAddOrUpdate($parent->child->id, $parent->quantity); - $parent = $cart->items()->create($itemData['parent']); + $this->canAddOrUpdate($parent->child->id, $parent->quantity); + $itemData['child']['parent_id'] = $parent->id; $cart->items()->create($itemData['child']); @@ -503,7 +503,10 @@ class Cart { $data = []; foreach($item->product->super_attributes as $attribute) { + dd($item->child); + dd($attribute->options); $option = $attribute->options()->where('id', $item->child->{$attribute->code})->first(); + $data['attributes'][$attribute->code] = [ 'attribute_name' => $attribute->name, 'option_label' => $option->label, diff --git a/packages/Webkul/Shipping/composer.json b/packages/Webkul/Shipping/composer.json index 7e3676e4f..f894797bb 100644 --- a/packages/Webkul/Shipping/composer.json +++ b/packages/Webkul/Shipping/composer.json @@ -17,7 +17,7 @@ "extra": { "laravel": { "providers": [ - "Webkul\\Cart\\Providers\\ShippingServiceProvider" + "Webkul\\Shipping\\Providers\\ShippingServiceProvider" ], "aliases": {} } diff --git a/packages/Webkul/Shop/src/Resources/views/checkout/cart/index.blade.php b/packages/Webkul/Shop/src/Resources/views/checkout/cart/index.blade.php index 18ae5c9e1..d1b9239d9 100644 --- a/packages/Webkul/Shop/src/Resources/views/checkout/cart/index.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/checkout/cart/index.blade.php @@ -49,11 +49,11 @@ @if ($product->type == 'configurable')
- {{-- @foreach (cart::getItemAttributeOptionDetails($item) as $key => $option) + @foreach (cart::getItemAttributeOptionDetails($item) as $key => $option) {{ (!$key ? '' : ' , ') . $option['attribute_name'] . ' : ' . $option['option_label'] }} - @endforeach --}} + @endforeach
@endif