Skip to content

Commit 8f3f6a0

Browse files
empiricompanyCopilotsreichel
authored
Fix wrong tier price displayed when some tier prices are higher than special price (OpenMage#5117)
* Skip tier prices >= final price Added a check to skip tier prices that are greater than or equal to the final price. * phpcsfix * rector rules * Update app/code/core/Mage/Catalog/Helper/Product/Type/Composite.php Co-authored-by: Copilot <[email protected]> * newline rector --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: Sven Reichel <[email protected]>
1 parent 3e6c4e3 commit 8f3f6a0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

app/code/core/Mage/Catalog/Helper/Product/Type/Composite.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,17 @@ public function prepareJsonProductConfig($product)
177177
$_tierPrices = [];
178178
$_tierPricesInclTax = [];
179179
foreach ($product->getTierPrice() as $tierPrice) {
180+
// Skip tier prices >= lower of final price or group price
181+
$comparePrice = $_finalPrice;
182+
$groupPrice = $product->getGroupPrice();
183+
if ($groupPrice !== null && $groupPrice < $comparePrice) {
184+
$comparePrice = $groupPrice;
185+
}
186+
187+
if ((float) $tierPrice['website_price'] >= $comparePrice) {
188+
continue;
189+
}
190+
180191
$_tierPrices[] = Mage::helper('core')->currency(
181192
Mage::helper('tax')->getPrice($product, (float) $tierPrice['website_price'], false) - $_priceExclTax,
182193
false,

0 commit comments

Comments
 (0)