From 02508ee746f8bed271dbc4ab5e5d49f054b6a5fe Mon Sep 17 00:00:00 2001 From: Eric Claeren Date: Mon, 6 Sep 2021 14:02:05 +0200 Subject: [PATCH] #69: Fix for incorrect price rendering for configurable products --- Helper/Data.php | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/Helper/Data.php b/Helper/Data.php index 2f52d12..890d784 100755 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -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()); } }