Skip to content

Commit 76b348d

Browse files
committed
MC-18847: Special Price & Regular Price Display Issues on Configurable Product
1 parent cc23756 commit 76b348d

File tree

3 files changed

+11
-55
lines changed

3 files changed

+11
-55
lines changed

app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/LinkedProductSelectBuilderComposite.php

Lines changed: 0 additions & 45 deletions
This file was deleted.

app/code/Magento/ConfigurableProduct/Pricing/Render/FinalPriceBox.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,21 @@
1717
use Magento\Framework\Pricing\SaleableInterface;
1818
use Magento\Framework\View\Element\Template\Context;
1919

20+
/**
21+
* Class for final_price box rendering
22+
*/
2023
class FinalPriceBox extends \Magento\Catalog\Pricing\Render\FinalPriceBox
2124
{
2225
/**
2326
* @var LowestPriceOptionsProviderInterface
2427
*/
2528
private $lowestPriceOptionsProvider;
2629

30+
/**
31+
* @var ConfigurableOptionsProviderInterface
32+
*/
33+
private $configurableOptionsProvider;
34+
2735
/**
2836
* @param Context $context
2937
* @param SaleableInterface $saleableItem
@@ -34,7 +42,6 @@ class FinalPriceBox extends \Magento\Catalog\Pricing\Render\FinalPriceBox
3442
* @param LowestPriceOptionsProviderInterface $lowestPriceOptionsProvider
3543
* @param SalableResolverInterface|null $salableResolver
3644
* @param MinimalPriceCalculatorInterface|null $minimalPriceCalculator
37-
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
3845
*/
3946
public function __construct(
4047
Context $context,
@@ -56,6 +63,7 @@ public function __construct(
5663
$salableResolver,
5764
$minimalPriceCalculator
5865
);
66+
$this->configurableOptionsProvider = $configurableOptionsProvider;
5967
$this->lowestPriceOptionsProvider = $lowestPriceOptionsProvider ?:
6068
ObjectManager::getInstance()->get(LowestPriceOptionsProviderInterface::class);
6169
}
@@ -68,7 +76,7 @@ public function __construct(
6876
public function hasSpecialPrice()
6977
{
7078
$product = $this->getSaleableItem();
71-
foreach ($this->lowestPriceOptionsProvider->getProducts($product) as $subProduct) {
79+
foreach ($this->configurableOptionsProvider->getProducts($product) as $subProduct) {
7280
$regularPrice = $subProduct->getPriceInfo()->getPrice(RegularPrice::PRICE_CODE)->getValue();
7381
$finalPrice = $subProduct->getPriceInfo()->getPrice(FinalPrice::PRICE_CODE)->getValue();
7482
if ($finalPrice < $regularPrice) {

app/code/Magento/ConfigurableProduct/etc/di.xml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -205,13 +205,6 @@
205205
<argument name="productIndexer" xsi:type="object">Magento\Catalog\Model\Indexer\Product\Full</argument>
206206
</arguments>
207207
</type>
208-
<virtualType name="LinkedProductSelectBuilderByIndexMinPrice" type="Magento\ConfigurableProduct\Model\ResourceModel\Product\LinkedProductSelectBuilderComposite">
209-
<arguments>
210-
<argument name="linkedProductSelectBuilder" xsi:type="array">
211-
<item name="indexPrice" xsi:type="object">Magento\Catalog\Model\ResourceModel\Product\Indexer\LinkedProductSelectBuilderByIndexPrice</item>
212-
</argument>
213-
</arguments>
214-
</virtualType>
215208
<type name="Magento\ConfigurableProduct\Pricing\Price\LowestPriceOptionsProvider">
216209
<arguments>
217210
<argument name="linkedProductSelectBuilder" xsi:type="object">Magento\ConfigurableProduct\Model\ResourceModel\Product\LinkedProductSelectBuilder</argument>
@@ -220,7 +213,7 @@
220213
<type name="Magento\ConfigurableProduct\Model\ResourceModel\Product\LinkedProductSelectBuilder">
221214
<arguments>
222215
<argument name="baseSelectProcessor" xsi:type="object">Magento\ConfigurableProduct\Model\ResourceModel\Product\StockStatusBaseSelectProcessor</argument>
223-
<argument name="linkedProductSelectBuilder" xsi:type="object">LinkedProductSelectBuilderByIndexMinPrice</argument>
216+
<argument name="linkedProductSelectBuilder" xsi:type="object">Magento\Catalog\Model\ResourceModel\Product\Indexer\LinkedProductSelectBuilderByIndexPrice</argument>
224217
</arguments>
225218
</type>
226219
<type name="Magento\Catalog\Model\Product\Pricing\Renderer\SalableResolver">

0 commit comments

Comments
 (0)