Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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());
}
}