Skip to content

Commit cf70c6d

Browse files
author
Michail Slabko
committed
MAGETWO-42486: [GITHUB] Adding product configurations shows wrong currency #1737
1 parent e9b656a commit cf70c6d

File tree

2 files changed

+11
-5
lines changed
  • app/code/Magento
    • Catalog/Ui/Component/Listing/Columns
    • ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config

2 files changed

+11
-5
lines changed

app/code/Magento/Catalog/Ui/Component/Listing/Columns/Price.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,12 @@ public function prepareDataSource(array $dataSource)
5353
$store = $this->storeManager->getStore(
5454
$this->context->getFilterParam('store_id', \Magento\Store\Model\Store::DEFAULT_STORE_ID)
5555
);
56-
$currencyCode = $store->getCurrentCurrencyCode();
57-
$currencyRate = $store->getCurrentCurrencyRate();
58-
$currency = $this->localeCurrency->getCurrency($currencyCode);
56+
$currency = $this->localeCurrency->getCurrency($store->getBaseCurrencyCode());
5957

6058
$fieldName = $this->getData('name');
6159
foreach ($dataSource['data']['items'] as & $item) {
6260
if (isset($item[$fieldName])) {
63-
$item[$fieldName] = $currency->toCurrency(sprintf("%f", $item[$fieldName] * $currencyRate));
61+
$item[$fieldName] = $currency->toCurrency(sprintf("%f", $item[$fieldName]));
6462
}
6563
}
6664
}

app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config/Matrix.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ class Matrix extends \Magento\Backend\Block\Template
5454
/** @var null|array */
5555
private $productAttributes;
5656

57+
58+
/**
59+
* @var \Magento\Framework\Locale\CurrencyInterface
60+
*/
61+
protected $localeCurrency;
62+
5763
/**
5864
* @param \Magento\Backend\Block\Template\Context $context
5965
* @param \Magento\ConfigurableProduct\Model\Product\Type\Configurable $configurableType
@@ -72,6 +78,7 @@ public function __construct(
7278
\Magento\ConfigurableProduct\Model\Product\Type\VariationMatrix $variationMatrix,
7379
ProductRepositoryInterface $productRepository,
7480
\Magento\Catalog\Helper\Image $image,
81+
\Magento\Framework\Locale\CurrencyInterface $localeCurrency,
7582
array $data = []
7683
) {
7784
parent::__construct($context, $data);
@@ -80,6 +87,7 @@ public function __construct(
8087
$this->stockRegistry = $stockRegistry;
8188
$this->variationMatrix = $variationMatrix;
8289
$this->productRepository = $productRepository;
90+
$this->localeCurrency = $localeCurrency;
8391
$this->image = $image;
8492
}
8593

@@ -88,7 +96,7 @@ public function __construct(
8896
*/
8997
public function getCurrencySymbol()
9098
{
91-
return $this->_storeManager->getStore()->getCurrentCurrency()->getCurrencySymbol();
99+
return $this->localeCurrency->getCurrency($this->_storeManager->getStore()->getBaseCurrencyCode())->getSymbol();
92100
}
93101

94102
/**

0 commit comments

Comments
 (0)