Skip to content

Commit 1e0ba0c

Browse files
committed
MAGETWO-61127: [Backport] Catalog broken when all child products of configurable are disabled 2.0.11
1 parent 927a239 commit 1e0ba0c

File tree

1 file changed

+11
-9
lines changed
  • app/code/Magento/Catalog/Block/Product

1 file changed

+11
-9
lines changed

app/code/Magento/Catalog/Block/Product/View.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -232,26 +232,28 @@ public function getJsonConfig()
232232
foreach ($tierPricesList as $tierPrice) {
233233
$tierPrices[] = $this->priceCurrency->convert($tierPrice['price']->getValue());
234234
}
235+
$regularPriceAmount = $product->getPriceInfo()->getPrice('regular_price')->getAmount();
236+
$finalPriceAmount = $product->getPriceInfo()->getPrice('final_price')->getAmount();
235237
$config = [
236238
'productId' => $product->getId(),
237239
'priceFormat' => $this->_localeFormat->getPriceFormat(),
238240
'prices' => [
239241
'oldPrice' => [
240-
'amount' => $this->priceCurrency->convert(
241-
$product->getPriceInfo()->getPrice('regular_price')->getAmount()->getValue()
242-
),
242+
'amount' => $regularPriceAmount
243+
? $this->priceCurrency->convert($regularPriceAmount->getValue())
244+
: null,
243245
'adjustments' => []
244246
],
245247
'basePrice' => [
246-
'amount' => $this->priceCurrency->convert(
247-
$product->getPriceInfo()->getPrice('final_price')->getAmount()->getBaseAmount()
248-
),
248+
'amount' => $finalPriceAmount
249+
? $this->priceCurrency->convert($finalPriceAmount->getBaseAmount())
250+
: null,
249251
'adjustments' => []
250252
],
251253
'finalPrice' => [
252-
'amount' => $this->priceCurrency->convert(
253-
$product->getPriceInfo()->getPrice('final_price')->getAmount()->getValue()
254-
),
254+
'amount' => $finalPriceAmount
255+
? $this->priceCurrency->convert($finalPriceAmount->getValue())
256+
: null,
255257
'adjustments' => []
256258
]
257259
],

0 commit comments

Comments
 (0)