Skip to content

Commit 16985e1

Browse files
author
Yu Tang
committed
MAGETWO-32412: Return additional EAV attributes
- Allow array type custom attributes to be set
1 parent 7fa0e61 commit 16985e1

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

app/code/Magento/Weee/Model/Attribute/Backend/Weee/Tax.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public function afterSave($object)
135135
}
136136

137137
foreach ($taxes as $tax) {
138-
if (empty($tax['price']) || empty($tax['country']) || !empty($tax['delete'])) {
138+
if ((empty($tax['price']) && empty($tax['value'])) || empty($tax['country']) || !empty($tax['delete'])) {
139139
continue;
140140
}
141141

@@ -145,7 +145,7 @@ public function afterSave($object)
145145
$data['website_id'] = $tax['website_id'];
146146
$data['country'] = $tax['country'];
147147
$data['state'] = $state;
148-
$data['value'] = $tax['price'];
148+
$data['value'] = !empty($tax['price']) ? $tax['price'] : $tax['value'];
149149
$data['attribute_id'] = $this->getAttribute()->getId();
150150

151151
$this->_attributeTax->insertProductData($object, $data);

lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,10 @@ protected function convertCustomAttributeValue($customAttributesValueArray, $dat
199199
if (is_array($customAttributeValue)) {
200200
//If type for AttributeValue's value as array is mixed, further processing is not possible
201201
if ($type === TypeProcessor::ANY_TYPE) {
202-
continue;
202+
$attributeValue = $customAttributeValue;
203+
} else {
204+
$attributeValue = $this->_createDataObjectForTypeAndArrayValue($type, $customAttributeValue);
203205
}
204-
205-
$attributeValue = $this->_createDataObjectForTypeAndArrayValue($type, $customAttributeValue);
206206
} else {
207207
$attributeValue = $this->_convertValue($customAttributeValue, $type);
208208
}

0 commit comments

Comments
 (0)