From 5e9a247d6f1867bdfc2dec74301b3924c0e64aba Mon Sep 17 00:00:00 2001 From: namhoang2201 Date: Wed, 8 Jul 2020 17:35:34 +0700 Subject: [PATCH] fix bug return type of color value on configurable product, pwa default is swatch, native default is type text --- .../Simi/Simiconnector/Helper/Options/Configurable.php | 8 +++++--- app/code/Simi/Simiconnector/etc/adminhtml/system.xml | 10 +++++++++- app/code/Simi/Simiconnector/etc/config.xml | 5 ++++- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/app/code/Simi/Simiconnector/Helper/Options/Configurable.php b/app/code/Simi/Simiconnector/Helper/Options/Configurable.php index 579f6472..ee5bba8d 100755 --- a/app/code/Simi/Simiconnector/Helper/Options/Configurable.php +++ b/app/code/Simi/Simiconnector/Helper/Options/Configurable.php @@ -42,11 +42,13 @@ public function getOptions($product) is_array($option_data['products']) && count($option_data['products']) != 0 ) { + $isColorValueTypeText = $this->simiObjectManager->get('Magento\Framework\App\Config\ScopeConfigInterface') + ->getValue('siminiaconfig/color_options/is_color_type_text'); if($attribute_details['code'] === 'color') { $option_data['option_value'] = $this->getValueSwatch($option_data['id']); + $option_data['pwa_use_type_text'] = $isColorValueTypeText; } - if (isset($option_data['option_value']) && $option_data['option_value']) - $updatedOptions[] = $option_data; + $updatedOptions[] = $option_data; } } $attribute_details['options'] = $updatedOptions; @@ -76,4 +78,4 @@ private function getValueSwatch($id) { } return $value[$id]['value']; } -} +} \ No newline at end of file diff --git a/app/code/Simi/Simiconnector/etc/adminhtml/system.xml b/app/code/Simi/Simiconnector/etc/adminhtml/system.xml index 2a6a85ef..59cdc3d9 100755 --- a/app/code/Simi/Simiconnector/etc/adminhtml/system.xml +++ b/app/code/Simi/Simiconnector/etc/adminhtml/system.xml @@ -684,6 +684,14 @@ Magento\Config\Model\Config\Source\Yesno + + + + + Magento\Config\Model\Config\Source\Yesno + Default type is color swatch. + + - + \ No newline at end of file diff --git a/app/code/Simi/Simiconnector/etc/config.xml b/app/code/Simi/Simiconnector/etc/config.xml index 38d9bb48..6476ab14 100755 --- a/app/code/Simi/Simiconnector/etc/config.xml +++ b/app/code/Simi/Simiconnector/etc/config.xml @@ -105,6 +105,9 @@ Simicart https://www.simicart.com/pwa.html/ + + 0 + - + \ No newline at end of file