diff --git a/app/code/Ometria/AbandonedCarts/etc/module.xml b/app/code/Ometria/AbandonedCarts/etc/module.xml index 18c634a..87198ae 100755 --- a/app/code/Ometria/AbandonedCarts/etc/module.xml +++ b/app/code/Ometria/AbandonedCarts/etc/module.xml @@ -1,4 +1,4 @@ - + diff --git a/app/code/Ometria/Api/Controller/V1/Products.php b/app/code/Ometria/Api/Controller/V1/Products.php index ace3725..3e2dbdc 100755 --- a/app/code/Ometria/Api/Controller/V1/Products.php +++ b/app/code/Ometria/Api/Controller/V1/Products.php @@ -262,16 +262,14 @@ protected function serializeItem($item) ->addFieldToFilter('attribute_code', $attribute['attribute_code']) ->getFirstItem(); - $key = 'value'; - - if (in_array($full_attribute->getFrontendInput(), ['select', 'multiselect'])) { - $key = 'id'; - } + $inputType = $fullAttribute->getFrontendInput(); + $type = $inputType == 'multiselect' ? '&' . $attribute['attribute_code'] : $attribute['attribute_code']; + $valueIdx = in_array($inputType, ['select', 'multiselect']) ? 'id' : 'value'; $tmp['attributes'][] = [ - 'type' => $attribute['attribute_code'], - $key => $attribute['value'], - 'label' => $full_attribute->getFrontendLabel() + 'type' => $type, + $valueIdx => $attribute['value'], + 'label' => $fullAttribute->getFrontendLabel() ]; } diff --git a/app/code/Ometria/Api/Controller/V2/Products.php b/app/code/Ometria/Api/Controller/V2/Products.php index 04b3ef6..dcd8ca5 100644 --- a/app/code/Ometria/Api/Controller/V2/Products.php +++ b/app/code/Ometria/Api/Controller/V2/Products.php @@ -389,12 +389,14 @@ private function getAttributes(ProductInterface $product) continue; } - $valueIdx = in_array($attributeData['input'], ['select', 'multiselect']) ? 'id' : 'value'; + $inputType = $attributeData['input']; + $type = $inputType == 'multiselect' ? '&' . $attribute->getAttributeCode() : $attribute->getAttributeCode(); + $valueIdx = in_array($inputType, ['select', 'multiselect']) ? 'id' : 'value'; $attributes[] = [ - 'type' => $attribute->getAttributeCode(), + 'type' => $type, $valueIdx => $attribute->getValue(), - 'label' => $attributeData['label'] + 'label' => $attributeData['label'] ]; } diff --git a/app/code/Ometria/Api/etc/module.xml b/app/code/Ometria/Api/etc/module.xml index 0f4faf0..bc97d1d 100755 --- a/app/code/Ometria/Api/etc/module.xml +++ b/app/code/Ometria/Api/etc/module.xml @@ -1,4 +1,4 @@ - + diff --git a/app/code/Ometria/Core/etc/module.xml b/app/code/Ometria/Core/etc/module.xml index ed2aabc..49c646d 100755 --- a/app/code/Ometria/Core/etc/module.xml +++ b/app/code/Ometria/Core/etc/module.xml @@ -1,4 +1,4 @@ - + diff --git a/composer.json b/composer.json index a49320c..5f86c06 100755 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "ometria/magento2", "type": "magento2-module", - "version": "2.4.0", + "version": "2.5.0", "description": "Dev composer package for Ometria Extension", "authors": [ {