Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#69: Fix for incorrect price rendering for configurable products #73

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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());
}
}