0
votes

I have the following code for the "Percentage Off" of a product

located next to the Price shown on each product page /template/catalog/product/price.phtml

<span class="per_mk" id="percent-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
<?php
$msrp_mk = $_product->getMsrp();
if ($_price < $msrp_mk) { 
$_savePercent = 100 - round(($_price / $msrp_mk)*100); }
if ($_price < $msrp_mk) { echo $this->__('Percentage Off:'); echo $_savePercent;} ?>%
</span>

The "Percentage Off: #%" works correctly when you first load the page. The only issue is when a user selects a new option (small, med, large, ect) the Price will change, but the "Percentage Off: #%" stays the same.

I looked into /catalog/product/view/type/options/configurable.phtml where Product.Config = Class.create(); but I don't know what to edit/add.

I've read that you can do some jQuery voodoo and update those values yourself. I have over 10,000 products and I'm not sure how I would go about doing this.

Any help would be much appreciated! (currently using magento 1.7)

1

1 Answers

0
votes

pass product id through ajax and get its price and msrp and do your calculation in php and return percentageoff to ajax, then set the price ..

Hope this is what you need..tell if not.