Skip to content

Commit 120ddcb

Browse files
Oleksii Lisovyiihor-sviziev
authored andcommitted
Magento Catalog - fix custom option type text price conversion for multi currency website
1 parent bd82ed4 commit 120ddcb

File tree

1 file changed

+9
-5
lines changed
  • app/code/Magento/Catalog/Model/ResourceModel/Product

1 file changed

+9
-5
lines changed

app/code/Magento/Catalog/Model/ResourceModel/Product/Option.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace Magento\Catalog\Model\ResourceModel\Product;
77

88
use Magento\Catalog\Api\Data\ProductInterface;
9+
use Magento\Store\Model\ScopeInterface;
910

1011
/**
1112
* Catalog product custom option resource model
@@ -154,21 +155,24 @@ protected function _saveValuePrices(\Magento\Framework\Model\AbstractModel $obje
154155

155156
$scope = (int)$this->_config->getValue(
156157
\Magento\Store\Model\Store::XML_PATH_PRICE_SCOPE,
157-
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
158+
ScopeInterface::SCOPE_STORE
158159
);
159160

160161
if ($object->getStoreId() != '0' && $scope == \Magento\Store\Model\Store::PRICE_SCOPE_WEBSITE) {
161-
$baseCurrency = $this->_config->getValue(
162+
$website = $this->_storeManager->getStore($object->getStoreId())->getWebsite();
163+
164+
$websiteBaseCurrency = $this->_config->getValue(
162165
\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE,
163-
'default'
166+
ScopeInterface::SCOPE_WEBSITE,
167+
$website
164168
);
165169

166-
$storeIds = $this->_storeManager->getStore($object->getStoreId())->getWebsite()->getStoreIds();
170+
$storeIds = $website->getStoreIds();
167171
if (is_array($storeIds)) {
168172
foreach ($storeIds as $storeId) {
169173
if ($object->getPriceType() == 'fixed') {
170174
$storeCurrency = $this->_storeManager->getStore($storeId)->getBaseCurrencyCode();
171-
$rate = $this->_currencyFactory->create()->load($baseCurrency)->getRate($storeCurrency);
175+
$rate = $this->_currencyFactory->create()->load($websiteBaseCurrency)->getRate($storeCurrency);
172176
if (!$rate) {
173177
$rate = 1;
174178
}

0 commit comments

Comments
 (0)