From 8202f58284a08ed4d107033f0359c8279bc7add9 Mon Sep 17 00:00:00 2001 From: jitendra Date: Fri, 31 May 2019 17:52:52 +0530 Subject: [PATCH] Issue #932 fixed --- packages/Webkul/Product/src/Helpers/ConfigurableOption.php | 3 +++ .../views/products/view/configurable-options.blade.php | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/Webkul/Product/src/Helpers/ConfigurableOption.php b/packages/Webkul/Product/src/Helpers/ConfigurableOption.php index f2f40310c..3ec316b67 100755 --- a/packages/Webkul/Product/src/Helpers/ConfigurableOption.php +++ b/packages/Webkul/Product/src/Helpers/ConfigurableOption.php @@ -135,6 +135,9 @@ class ConfigurableOption extends AbstractProduct $attributeValue = $product->{$productAttribute->code}; + if ($attributeValue == '' && $product instanceof \Webkul\Product\Models\ProductFlat) + $attributeValue = $product->product->{$productAttribute->code}; + $options[$productAttributeId][$attributeValue][] = $productId; $options['index'][$productId][$productAttributeId] = $attributeValue; diff --git a/packages/Webkul/Shop/src/Resources/views/products/view/configurable-options.blade.php b/packages/Webkul/Shop/src/Resources/views/products/view/configurable-options.blade.php index c237f7565..40bc27b8a 100755 --- a/packages/Webkul/Shop/src/Resources/views/products/view/configurable-options.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/products/view/configurable-options.blade.php @@ -138,7 +138,7 @@ this.resetChildren(attribute.nextAttribute); } else { - this.selectedProductId = attribute.options[attribute.selectedIndex].allowedProducts[0]; + this.selectedProductId = this.simpleProduct; } //buy now anchor href changer with options @@ -219,7 +219,7 @@ if (prevOption) { for (j = 0; j < options[i].products.length; j++) { - if (prevOption.products && prevOption.products.indexOf(options[i].products[j]) > -1) { + if (prevOption.allowedProducts && prevOption.allowedProducts.indexOf(options[i].products[j]) > -1) { allowedProducts.push(options[i].products[j]); } }