diff --git a/Model/Api/OrderInfo.php b/Model/Api/OrderInfo.php
index f59ef6e..ae70a5c 100644
--- a/Model/Api/OrderInfo.php
+++ b/Model/Api/OrderInfo.php
@@ -230,7 +230,7 @@ public function getOrderInfoReturnless($incrementId)
$orderInfo['order_products'][$orderItemKey]['bundle_children'][$key]['images'][1]['http_path'] = $this->getImageByProduct1($product);
$orderInfo['order_products'][$orderItemKey]['bundle_children'][$key]['url'] = $product->getProductUrl();
$orderInfo['order_products'][$orderItemKey]['bundle_children'][$key]['categories_ids'] = $product->getCategoryIds();
- $orderInfo['order_products'][$orderItemKey]['bundle_children'][$key]['u_brand'] = $product->getBrand();
+ $orderInfo['order_products'][$orderItemKey]['bundle_children'][$key]['u_brand'] = $this->getUBrand($product);
$eavAttributeCode = $this->config->getEanAttributeCode();
@@ -253,7 +253,7 @@ public function getOrderInfoReturnless($incrementId)
$orderInfo['order_products'][$orderItemKey]['images'][1]['http_path'] = $this->getImageByProduct1($product);
$orderInfo['order_products'][$orderItemKey]['url'] = $product->getProductUrl();
$orderInfo['order_products'][$orderItemKey]['categories_ids'] = $product->getCategoryIds();
- $orderInfo['order_products'][$orderItemKey]['u_brand'] = $product->getBrand();
+ $orderInfo['order_products'][$orderItemKey]['u_brand'] = $this->getUBrand($product);
$eavAttributeCode = $this->config->getEanAttributeCode();
@@ -350,6 +350,25 @@ public function getImageByProduct($product)
return $image;
}
+ /**
+ * Method returns variable for Product's Brand Attribute
+ *
+ * @param $product
+ * @return null
+ */
+ protected function getUBrand($product)
+ {
+ $brandAttributeCode = $this->config->getBrandAttributeCode();
+ $brandAttributeCode = !empty($brandAttributeCode) ? $brandAttributeCode : null;
+
+ $uBrand = null;
+ if (!empty($brandAttributeCode)) {
+ $uBrand = $product->getResource()->getAttribute($brandAttributeCode)->getFrontend()->getValue($product);
+ }
+
+ return $uBrand ? $uBrand : null;
+ }
+
/**
* @param $result
*/
diff --git a/Model/Config.php b/Model/Config.php
index 47327af..337a2d8 100644
--- a/Model/Config.php
+++ b/Model/Config.php
@@ -30,6 +30,11 @@ class Config
*/
const CONFIG_EAN_ATTRIBUTE_CODE = 'returnless_connector/general/u_upc';
+ /**
+ * const CONFIG_BRAND_ATTRIBUTE_CODE
+ */
+ const CONFIG_BRAND_ATTRIBUTE_CODE = 'returnless_connector/general/u_brand';
+
/**
* const CONFIG_SEPARATE_BUNDLE_PRODUCTS
*/
@@ -147,4 +152,19 @@ public function getSeparateBundle($store = null)
return $separateBundle;
}
+
+ /**
+ * @param null $store
+ * @return string
+ */
+ public function getBrandAttributeCode($store = null)
+ {
+ $brandttributeCode = (string)$this->scopeConfig->getValue(
+ self::CONFIG_BRAND_ATTRIBUTE_CODE,
+ ScopeInterface::SCOPE_STORE,
+ $store
+ );
+
+ return $brandttributeCode;
+ }
}
diff --git a/composer.json b/composer.json
index f3f4833..fa4be4b 100644
--- a/composer.json
+++ b/composer.json
@@ -17,5 +17,5 @@
"OSL-3.0",
"AFL-3.0"
],
- "version": "1.1.9"
+ "version": "1.2.0"
}
diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml
index 8868545..2949247 100644
--- a/etc/adminhtml/system.xml
+++ b/etc/adminhtml/system.xml
@@ -28,6 +28,10 @@
+
+
+
+
Magento\Config\Model\Config\Source\Yesno
diff --git a/etc/module.xml b/etc/module.xml
index 42251b8..c5bb8a7 100644
--- a/etc/module.xml
+++ b/etc/module.xml
@@ -1,6 +1,6 @@
-
+