Add code

Tuesday 5 January 2016

Custom Options Set Price to "0" in Magento 1.7 – The Fix

I’m working on a side project with Magento… There is a bug in 1.7 where when you use custom options, and your theme doesn’t include it’s own options.phtml file, the price will set to $0 (zero) when a user selects the price.

A bunch of forum posts have people talking about the problem. Basically it’s a silly bug in the javascript in options.phtml.

Basically, if your theme doesn’t have that options file in it’s theme directory, then magento looks like it defaults to the base‘s folder and includes the “default” options.phtml.
Here is the fix. I hope Magento includes it in the next Magento release!

Line 123 of options.phtml in
app/design/frontend/base/default/template/catalog/product/view/
Right now is
price += parseFloat(config[optionId][element.getValue()]);

Should be

price += parseFloat(config[optionId][element.getValue()].price);

Basically the code was trying to convert a javascript Object to a float. Making the price 0.

No comments:

Post a Comment

Magento : 404 error is showing admin page

Hello, Sometimes we may get the error on admin page once done with the Magento installation. In that scenario, we have to do the following: ...