Skip to content

Commit b1e0151

Browse files
author
Cristian Partica
committed
MAGETWO-35688: [FPT] Final price of Simple Product isn't recalculated after selecting options on product page
- fixed on page option calculation when tax included and display tax excluded - based on basePrice
1 parent 38f9431 commit b1e0151

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

app/code/Magento/Weee/Model/Observer.php

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@
1010
*/
1111
class Observer extends \Magento\Framework\Model\AbstractModel
1212
{
13+
/**
14+
* Tax data
15+
*
16+
* @var \Magento\Tax\Helper\Data
17+
*/
18+
protected $_taxData;
19+
1320
/**
1421
* @var \Magento\Catalog\Model\Product\Type
1522
*/
@@ -51,6 +58,7 @@ class Observer extends \Magento\Framework\Model\AbstractModel
5158
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
5259
*/
5360
public function __construct(
61+
\Magento\Tax\Helper\Data $taxData,
5462
\Magento\Framework\Model\Context $context,
5563
\Magento\Framework\Registry $registry,
5664
\Magento\Framework\View\LayoutInterface $layout,
@@ -62,6 +70,7 @@ public function __construct(
6270
\Magento\Framework\Data\Collection\Db $resourceCollection = null,
6371
array $data = []
6472
) {
73+
$this->_taxData = $taxData;
6574
$this->_layout = $layout;
6675
$this->_weeeTax = $weeeTax;
6776
$this->_productType = $productType;
@@ -209,17 +218,16 @@ public function getPriceConfiguration(\Magento\Framework\Event\Observer $observe
209218
if (is_array($priceConfig)) {
210219
foreach ($priceConfig as $keyConfigs => $configs) {
211220
if (is_array($configs)) {
212-
if (array_key_exists('prices', $configs)) {
213-
$priceConfig[$keyConfigs]['prices']['weeePrice'] = [
214-
'amount' => $configs['prices']['finalPrice']['amount'],
215-
];
216-
} else {
217-
foreach ($configs as $keyConfig => $config) {
218-
$priceConfig[$keyConfigs][$keyConfig]['prices']['weeePrice'] = [
219-
'amount' => $config['prices']['finalPrice']['amount'],
220-
];
221+
foreach ($configs as $keyConfig => $config) {
222+
$calcPrice='finalPrice';
223+
if ($this->_taxData->priceIncludesTax() && $this->_taxData->displayPriceExcludingTax()) {
224+
$calcPrice='basePrice';
221225
}
226+
$priceConfig[$keyConfigs][$keyConfig]['prices']['weeePrice']= [
227+
'amount' => $config['prices'][$calcPrice]['amount'],
228+
];
222229
}
230+
223231
}
224232
}
225233
}

0 commit comments

Comments
 (0)