Mangento 1.7.0.2 Customer Options Change Product Price to 0

I upgraded from Mangento 1.4.0.0 to 1.7.0.2 (manually upgrading each version via SSH, no force upgrade commands). Once I set up 1.7.0.2 with my new theme I noticed something strange. Every product that had a customer option kept changing the product price to zero when the option was selected. Since the site is a clothing store, the majority of the products contain custom options for the purpose of size or color selection. For example a Brand X t-shirt available in colors blue or white and in size S, M, or L.

I read dozens of forums, posts and knowledge base articles about this issue. Many people are experiencing it but very few have the answer, especially for 1.7.0.2.

This is the actual article I used to solve the problem:

http://www.magentodeveloperleedsuk.co.uk/magento-development/

However, I could not find the line of code in line 141, for me it ended up being around line 126. Also I could not search the document by copy and pasting this example because the code was broken up differentially when I opened in Coda 2 than it is displayed in this article.

Here’s the instructions I followed to fix the issue:

Custom Options Change Price to Zero in Magento 1.7

After an upgrade to the latest version of Magento – time of writing 1.7, we noticed that the custom options selection was changing the price to zeros instead of updating them.

Turned out there was a bug in the options.phtml file of the current theme – and suprisingly on the base/default too.

To fix the problem

Locate the file: in app/design/[your package]/[your_theme]/template/catalog/product/view/options.phtml on around line 141

Then change

if (this.config[optionId][selectOption.value]) {
   price += parseFloat(this.config[optionId][selectOption.value]);
}

To

if (this.config[optionId][selectOption.value]) {
   price += parseFloat(this.config[optionId][selectOption.value].priceValue);
}

Alternatively:

If your theme has this line instead

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

Change it to:

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

Someone also posted this solution on Magento Forum http://www.magentocommerce.com/boards/viewthread/280283/P15/

Overall this was an easy fix, but I’m really surprised at how difficult it was for me to hunt down a real solution given that millions of online stores run on Magento. With that said, I’m even more supervised at how many developers have run into this same issue. If you have run into a problem with having your custom options change your product price to zero feel free to comment and we’ll do what we can to help you out. Thanks!