Skip to content

Commit

Permalink
magepal#69: Fix for incorrect price rendering for configurable products
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Claeren committed Sep 6, 2021
1 parent e18f31c commit 02508ee
Showing 1 changed file with 3 additions and 22 deletions.
25 changes: 3 additions & 22 deletions Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,30 +259,11 @@ public function addCategoryElements($product, &$viewItem)
}

/**
* @param $product
* @param ProductInterface $product
* @return float
*/
public function getProductPrice($product)
public function getProductPrice(ProductInterface $product): float
{
$price = 0;

/** @var $product ProductInterface */
if ($product) {
$price = $product
->getPriceInfo()
->getPrice(FinalPrice::PRICE_CODE)
->getAmount()
->getBaseAmount() ?: 0;
}

if (!$price) {
if ($product->getTypeId() == Type::TYPE_SIMPLE) {
$price = $product->getPrice();
} else {
$price = $product->getFinalPrice();
}
}

return $this->formatPrice($price);
return $this->formatPrice($product->getFinalPrice());
}
}

0 comments on commit 02508ee

Please sign in to comment.