0

By default, on a simple product with tier pricing, each tier price 'percent saved' is calculated based on the 'Item Price'.

Before

I want to recalculate the 'percent saved' to display/calculate the percent saved based on the 'Manufacturer's Suggested Retail Price'

After

On this file: app\design\frontend\base\default\template\catalog\product\view\tierprices.phtml This is the line of code that displays the tier price percent saved:

<span class="percent tier-<?php echo $_index;?>"><?php echo $_price['savePercent']?></span>

NEW FOUND INFO:

I found this file: app\code\core\Mage\Catalog\Block\Product

Which shows the formula which calculates the 'savePercent':

$price['savePercent'] = ceil(100 - ((100 / $productPrice) * $price['price']));

I have been trying to add:

$_msrpPrice = $this->helper('core')->currency($_product->getMsrp(),true,true)

Then replace 'productPrice' with '_msrpPrice' or 'msrpPrice' but it breaks the page.

Can anyone point me to:

1) Where can I modify this formula to display the % save off of the 'Manufacturer's Suggested Retail Price'

2) Hopefully give me the variable to replace or even a script I can add?

Thank you in advance.

0

Figured it out.

1) Create a local version of the price.html at: app\code\local\Mage\Catalog\Block\Product\Price.php

2) Change this code:

$price['savePercent'] = ceil(100 - ((100 / $productPrice) * $price['price']));

TO (you can make your own notes):

// MONJ: set originalPrice variable equal to products MSRP. If MSRP is equal or less than zero, use the product price as originalPrice.
$originalPrice = $product->getMsrp();
if ($originalPrice <= 0.00) {
$originalPrice = $productPrice;
}

// MONJ: Calculate percent saved off MSRP
$price['savePercent'] = ceil(100 - ((100 / $originalPrice) * $price['price']));

Hope this helps someone.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.