Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit a48f3cc

Browse files
author
Dmytro Voskoboinikov
committed
MAGETWO-72582: Configurable product displays the price of "out of stock" configuration
1 parent a6f5172 commit a48f3cc

File tree

4 files changed

+17
-12
lines changed

4 files changed

+17
-12
lines changed

app/code/Magento/Catalog/view/base/templates/product/price/configured_price.phtml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
7+
// @codingStandardsIgnoreFile
8+
69
?>
10+
711
<?php
812
/** @var \Magento\Catalog\Pricing\Render\FinalPriceBox $block */
913
/** @var \Magento\Catalog\Pricing\Price\ConfiguredPrice $configuredPrice */
@@ -14,11 +18,13 @@ $priceLabel = ($block->getPriceLabel() !== null)
1418
: '';
1519
?>
1620
<p class="price-as-configured">
17-
<?= /* @escapeNotVerified */ $block->renderAmount($configuredPrice->getAmount(), [
18-
'display_label' => $priceLabel,
19-
'price_id' => $block->getPriceId('product-price-'),
20-
'price_type' => 'finalPrice',
21-
'include_container' => true,
22-
'schema' => $schema
23-
]); ?>
21+
<?php if($configuredPrice->getAmount()->getValue() !== null): ?>
22+
<?= /* @noEscape */ $block->renderAmount($configuredPrice->getAmount(), [
23+
'display_label' => $priceLabel,
24+
'price_id' => $block->getPriceId('product-price-'),
25+
'price_type' => 'finalPrice',
26+
'include_container' => true,
27+
'schema' => $schema
28+
]); ?>
29+
<?php endif; ?>
2430
</p>

app/code/Magento/ConfigurableProduct/Pricing/Price/ConfigurablePriceResolver.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ public function __construct(
5555

5656
/**
5757
* @param \Magento\Framework\Pricing\SaleableInterface|\Magento\Catalog\Model\Product $product
58-
* @return float
59-
* @throws \Magento\Framework\Exception\LocalizedException
58+
* @return float|null
6059
*/
6160
public function resolvePrice(\Magento\Framework\Pricing\SaleableInterface $product)
6261
{
@@ -67,6 +66,6 @@ public function resolvePrice(\Magento\Framework\Pricing\SaleableInterface $produ
6766
$price = $price ? min($price, $productPrice) : $productPrice;
6867
}
6968

70-
return (float)$price;
69+
return $price === null ? null : (float)$price;
7170
}
7271
}

app/code/Magento/ConfigurableProduct/view/base/templates/product/price/final_price.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ $schema = ($block->getZone() == 'item_view') ? true : false;
3838
'skip_adjustments' => true
3939
]); ?>
4040
</span>
41-
<?php else: ?>
41+
<?php elseif($finalPriceModel->getAmount()->getValue() !== null): ?>
4242
<?php /* @escapeNotVerified */ echo $block->renderAmount($finalPriceModel->getAmount(), [
4343
'price_id' => $block->getPriceId('product-price-' . $idSuffix),
4444
'price_type' => 'finalPrice',

app/code/Magento/Wishlist/Pricing/ConfiguredPrice/ConfigurableProduct.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function getValue()
2626
$product = $customOption ? $customOption->getProduct() : $this->getProduct();
2727
$price = $product->getPriceInfo()->getPrice(self::PRICE_CODE)->getValue();
2828

29-
return max(0, $price);
29+
return $price === null ? null : max(0, $price);
3030
}
3131

3232
/**

0 commit comments

Comments
 (0)