From 1b4ba7e61e043356d26b9fc246adf18b8bdb4c97 Mon Sep 17 00:00:00 2001 From: Mike Miles Date: Mon, 17 Jul 2017 10:32:20 -0400 Subject: [PATCH] fix validation of custom attributes --- src/Elements/ProductElement.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Elements/ProductElement.php b/src/Elements/ProductElement.php index 08073b8..7b102a8 100644 --- a/src/Elements/ProductElement.php +++ b/src/Elements/ProductElement.php @@ -319,8 +319,12 @@ private function generateCustomAttributesXMLArray(array $custom_attributes) { foreach ($custom_attributes as $attribute_id => $attribute_values) { // Loop through all values for this attribute. foreach ($attribute_values as $value) { - // Add basic element with value and id attribute. - $element['#children'][] = $this->generateElementXMLArray('Attribute', $value, ['id' => $attribute_id]); + // Add basic element with id attribute. + $attribute = $this->generateElementXMLArray('Attribute', FALSE, ['id' => $attribute_id]); + // Add Value as child of attribute. + $attribute['#children'][] = $this->generateElementXMLArray('Value', $value); + // Add to Attributes array. + $element['#children'][] = $attribute; } } }