Skip to content

Commit

Permalink
[MYGMOD-68] Revert method getAttributeValueByParam() back to Base hel…
Browse files Browse the repository at this point in the history
…per. (#6)
  • Loading branch information
Ruslan Mavlyanov authored and luckyraul committed Nov 22, 2017
1 parent 2fd9fab commit 7f6c52d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
17 changes: 17 additions & 0 deletions Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,23 @@ public function getCode()
return $this->_code;
}

/**
* Fetch attribute code from $pathToParam and then get it from product
* @param $pathToParam config path like module/general/param
* @param $productId
*
* @return mixed attribute value
*/
public function getAttrValueByParam($pathToParam, $productId)
{
$attributeCode = $this->getConfig($pathToParam);
if (!$attributeCode || '0' == $attributeCode || 0 === $attributeCode) {
return $this->getConfig($pathToParam . '_default');
}

return $this->getAttributeValue($attributeCode, $productId);
}

public function getAttributeValue($attributeCode, $productId)
{
$product = $this->getProduct($productId);
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mygento/base",
"type": "magento2-module",
"version": "2.2.4",
"version": "2.2.5",
"license": "OSL-3.0",
"homepage": "https://github.com/mygento/base",
"description": "Mygento Base",
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Mygento_Base" setup_version="2.2.4"></module>
<module name="Mygento_Base" setup_version="2.2.5"></module>
</config>

0 comments on commit 7f6c52d

Please sign in to comment.