Skip to content

Commit

Permalink
ENGCOM-4767: Magento Catalog - fix custom option type text price conv…
Browse files Browse the repository at this point in the history
…ersion for mu… #22016
  • Loading branch information
sidolov authored May 6, 2019
2 parents bb80daa + d2df041 commit d1b24f1
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions app/code/Magento/Catalog/Model/ResourceModel/Product/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
namespace Magento\Catalog\Model\ResourceModel\Product;

use Magento\Catalog\Api\Data\ProductInterface;
use Magento\Store\Model\ScopeInterface;

/**
* Catalog product custom option resource model
Expand Down Expand Up @@ -154,21 +155,25 @@ protected function _saveValuePrices(\Magento\Framework\Model\AbstractModel $obje

$scope = (int)$this->_config->getValue(
\Magento\Store\Model\Store::XML_PATH_PRICE_SCOPE,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
ScopeInterface::SCOPE_STORE
);

if ($object->getStoreId() != '0' && $scope == \Magento\Store\Model\Store::PRICE_SCOPE_WEBSITE) {
$baseCurrency = $this->_config->getValue(
$website = $this->_storeManager->getStore($object->getStoreId())->getWebsite();

$websiteBaseCurrency = $this->_config->getValue(
\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE,
'default'
ScopeInterface::SCOPE_WEBSITE,
$website
);

$storeIds = $this->_storeManager->getStore($object->getStoreId())->getWebsite()->getStoreIds();
$storeIds = $website->getStoreIds();
if (is_array($storeIds)) {
foreach ($storeIds as $storeId) {
if ($object->getPriceType() == 'fixed') {
$storeCurrency = $this->_storeManager->getStore($storeId)->getBaseCurrencyCode();
$rate = $this->_currencyFactory->create()->load($baseCurrency)->getRate($storeCurrency);
$rate = $this->_currencyFactory->create()->load($websiteBaseCurrency)
->getRate($storeCurrency);
if (!$rate) {
$rate = 1;
}
Expand Down

0 comments on commit d1b24f1

Please sign in to comment.