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.
Please share this page to others who experience the same issue.
Thanks for the info but I looked at the options.phtml file and that code isnt in there? Anything else I can do?
Thanks!
Yes I’m having the same issue as Kurt posted on 6/17. I don’t have this line in my options.phtml file in the base directory. On line 123 I have
if (element.type == ‘checkbox’ || element.type == ‘radio’) {
We’re running Magento version 1.7.0.0
Any help would be appreciated. Thanks!
Brian,
Do you have the line
price += parseFloat(config[optionId][element.getValue()]);
anywhere?
same issue. This code is not found in this file. Are you patching the community 1.702 version
Your code is incorrect it should be
price += parseFloat(config[optionId][element.getValue()].price);
Because the .price should be outside the square brackets.
Corrected, thanks!
Oh, that saved my day! Works with my mobile theme (Iphone theme from Aheadworks) on Magento CE 1.7.0.0
Thanks for this fix. It worked for me the first time on Magento 1.7.0.2
I’m experiencing the same issue as Kurt, Brian etc.
Did any of you guys, unable to match the code, find a solution?
Thanks,
-Martin
Same issue here, no such code in my Magento 1.7.0.2, nothing even close. anyone find a fix?
Thank you autor! Its works great now!!
Thank you a lot.
Tip: Copy options.phtml from base to your theme before changing it.
Hi, Sorry but this code doesn’t work for me, Might be I m doing something wrong.I hv ctaered one directory call bestseller under the template directory in my theme.so path for the bestseller.phtml is C:\wamp\www\magento\app\design\frontend\default\mycustom\template\bestseller\bestseller.phtml , is that right ???and I hv put that block part in my homepage content section.. and i hv changed to {{block type= core/template show_total=”12? template= bestseller/bestseller.phtml }}So what is the wrong here?I couldn’t see anything on my homepage..Plz help.
Thanks so much for this!!!
At first I couldn’t find the code you were referencing. I eventually found it in my theme directory app/design/frontend/mycustomtheme/template/catalog/product/view/options.phtml
When I added it to the
if (element.type == ‘checkbox’ || element.type == ‘radio’) {
condition, it wasn’t doing anything until I realized that I was using drop downs for my custom options. Once I added your line of code to the
if (element.options)
condition, a few lines down in the code, it worked like a charm.
Thanks!!!
Thanx……Alot…….
It works….
Hello. I do not have the options.html file in my theme folder
app/design/frontend/default/custom/template/catalog/product/view
The code listed above is not in my options.phtml in the base directory I do have this code anywhere in this file:
price += parseFloat(config[optionId][element.getValue()]);
On line 123 I have if (element.type == ‘checkbox’ || element.type == ‘radio’) {
Please help I need to get this store launched.
Hi,
base price = $1000
option 1 + $100
option 2 + 5%
_____________________________
= $1150 (instead of $1155);
How to calculate price based on total price or final price instead of base price?
Please help asap
Thanks
JageshMK
Thanks you so much for this !! 🙂
You can also try to put your code into
app/design/frontend/yourcustomtheme/template/catalog/product/view/options.phtml
Line no 143
price += parseFloat(this.config[optionId][selectOption.value].price);
Thank u for price += parseFloat(this.config[optionId][selectOption.value].price);
its worked well. and i need one more help. I want to get custom option value which entered by customer. how to get the value? pls guide me?
Hello,
This is not working for 1.7.0.2. Do you have solution for this version?
thanks in advance
Duranaa
Been looking for this fix for over 2.5 hours. This fixed it and Dan had my same issue with custom options as dropdowns. Thanks for everyone’s additions to allow me to solve my issue. I’m using the free mobile theme called black_yellow that has this bug of the price resulting to $0.00 when a custom options with a price was chosen.
Worked! Thanks for posting these, . I used Xeross and Dan’s fix. What’s your take on custom options vs configurable product type?
hello, friends, I want to know how to update custom option price , i want to add my custom value to product price like custom options does.
For those who don’t have the mentioned lines in the options.phtml (like me – are there really two different versions of Magento 1.7.0.2??), you can adjust the file js/varien/product.js.
In lines 693 and 694 you have the following code:
subPrice += parseFloat(el.price);
subPriceincludeTax += parseFloat(el.price);
Replace this with the following code:
if (!isNaN(parseFloat(el))) {
subPrice += parseFloat(el);
subPriceincludeTax += parseFloat(el);
} else {
subPrice += parseFloat(el.price);
subPriceincludeTax += parseFloat(el.price);
}
If you are using prices without tax and with tax, you might have to modify the lines before accordingly.
This didn’t work for me 🙁
thanks…its working……
Could it actually be the scpotions.phtml file? I can’t find the above-mentioned code in options.phtml, but I can find it in scptoptions.phtml.
I am also using the Simple Configurable Products extension, if that helps.
Thank you for posting!
i use advance product custom option but one proble create total price it should not show in decimal format so please send me any solution and also i can remove + price from dropdown list so how to is possible