Skip to content

Commit 52de5cd

Browse files
committed
MC-10973: Simple product with MAP assigned to configurable should displays the same way as products with special price
- Fix svc fails
1 parent 61d7334 commit 52de5cd

File tree

3 files changed

+28
-23
lines changed

3 files changed

+28
-23
lines changed

app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1446,22 +1446,4 @@ function($attr) {
14461446

14471447
return array_unique(array_merge($productAttributes, $requiredAttributes, $usedAttributes));
14481448
}
1449-
1450-
/**
1451-
* Returns msrp for children products
1452-
*
1453-
* @param \Magento\Catalog\Model\Product $product
1454-
* @return int
1455-
*/
1456-
public function getChildrenMsrp(\Magento\Catalog\Model\Product $product)
1457-
{
1458-
$prices = [];
1459-
foreach ($this->getUsedProducts($product) as $item) {
1460-
if ($item->getMsrp() !== null) {
1461-
$prices[] = $item->getMsrp();
1462-
}
1463-
}
1464-
return $prices ? max($prices) : 0;
1465-
}
1466-
14671449
}

app/code/Magento/Msrp/Helper/Data.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Magento\Store\Model\StoreManagerInterface;
1212
use Magento\Catalog\Model\Product;
1313
use Magento\Catalog\Api\ProductRepositoryInterface;
14+
use Magento\ConfigurableProduct\Model\Product\Type\Configurable;
1415

1516
/**
1617
* Msrp data helper
@@ -158,11 +159,19 @@ public function isMinimalPriceLessMsrp($product)
158159
$msrp = $product->getMsrp();
159160
$price = $product->getPriceInfo()->getPrice(\Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE);
160161
if ($msrp === null) {
161-
if ($product->getTypeId() !== \Magento\GroupedProduct\Model\Product\Type\Grouped::TYPE_CODE
162-
&& $product->getTypeId() !== \Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE) {
163-
return false;
164-
} else {
162+
if ($product->getTypeId() === \Magento\GroupedProduct\Model\Product\Type\Grouped::TYPE_CODE) {
165163
$msrp = $product->getTypeInstance()->getChildrenMsrp($product);
164+
} elseif ($product->getTypeId() === Configurable::TYPE_CODE) {
165+
$prices = [];
166+
foreach ($product->getTypeInstance()->getUsedProducts($product) as $item) {
167+
if ($item->getMsrp() !== null) {
168+
$prices[] = $item->getMsrp();
169+
}
170+
}
171+
172+
$msrp = $prices ? max($prices) : 0;
173+
} else {
174+
return false;
166175
}
167176
}
168177
if ($msrp) {

app/code/Magento/Msrp/view/base/templates/product/price/msrp.phtml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,21 @@ $priceType = $block->getPrice();
2020
/** @var $product \Magento\Catalog\Model\Product */
2121
$product = $block->getSaleableItem();
2222
$productId = $product->getId();
23-
$amount = $product->getMsrp() ?: $product->getTypeInstance()->getChildrenMsrp($product);
23+
24+
$amount = 0;
25+
if ($product->getMsrp()) {
26+
$amount = $product->getMsrp();
27+
} elseif ($product->getTypeId() === \Magento\GroupedProduct\Model\Product\Type\Grouped::TYPE_CODE) {
28+
$amount = $product->getTypeInstance()->getChildrenMsrp($product);
29+
} elseif ($product->getTypeId() === \Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE) {
30+
foreach ($product->getTypeInstance()->getUsedProducts($product) as $item) {
31+
if ($item->getMsrp() !== null) {
32+
$prices[] = $item->getMsrp();
33+
}
34+
}
35+
$amount = $prices ? max($prices) : 0;
36+
}
37+
2438
$msrpPrice = $block->renderAmount(
2539
$priceType->getCustomAmount($amount),
2640
[

0 commit comments

Comments
 (0)