Can you be a little more specific on the first part, for the code in product.js......do we replace code? or are we adding this code after code that is already there? I can’t find similar code on the line you provided, just need more specifics on what to do with the code you provided....
Thanks!
Chris
This seems to go here (example from one of Sean’s sites I found). But caused the price not to change when selecting radio button options so didn’t use!
Can’t believe this isn’t standard in Magento!
Don’t believe the hype!
I’ve been following this thread, I don’t think I’ve responded yet but I would like more specific information about what exactly is needed here, likely a solution can be provided.
Alright, I know you guys have been coming up with a variety of solutions, but they all involved editing core files, which I am not a huge fan of, so I whipped up a quick script to resolve the presentation issue on my end. Obviously, it isn’t philosophically pure since I just whipped it together in jquery. And, it would be more appropriate as a prototype script. Hopefully someone finds this helpful.
First, you’ll want to include jquery, if you haven’t already. I just use google’s cdn.
var optionsPrice = new Product.OptionsPrice(<?php echo $this->getJsonConfig() ?>);
I added the following:
// clear out the built in refresh Product.Config.prototype.reloadOptionLabels = function(element) { };
// quickly throw together a basic currency formatter function FormatCurrency(amount) { var i = parseFloat(amount); if(isNaN(i)) { i = 0.00; } var minus = ''; if(i < 0) { minus = '-'; } i = Math.abs(i); i = parseInt((i + .005) * 100); i = i / 100; s = new String(i); if(s.indexOf('.') < 0) { s += '.00'; } if(s.indexOf('.') == (s.length - 2)) { s += '0'; } s = minus + s; return s; }
// replace all prices with absolute prices function absoluteOptionPrices() { var price = jQuery('.price-box span span:last').html().split('$').pop();
jQuery('#product-options-wrapper option').each(function(i){ var name = jQuery(this).html(); var nodes = name.split('+$');
if (nodes[1] > 0) { var value = FormatCurrency(parseFloat(price) + parseFloat(nodes[1])); jQuery(this).html( nodes[0] + ' - $' + value); } }); }
// initialize everything jQuery(document).ready(function(){ var base_price = jQuery('.price-box span span:last').html();
I follow the solutions provided for calculation with Absolute value. But still not work for me in magento 1.3.1 version. I am working with bundle products and they has selection box for choosing options. By selecting the option the price should change and my requirement is to have one absolute value in which this optional price will add. just like http://www.duetinteriorcollections.com/index.php/for-the-table/tablecloths-and-table-runners/venice-hem.html discussed in this thread.
Can i get help for the step by step absolute value adding in such application?
I have an solution for “Step 3” for version 1.3.2.4.
1st)
Don’t change anything in the “Price.php”
2nd)
Go to “/htdocs/app/code/core/Mage/Catalog/Model/Product/Option/Type/Select.php” ----> Handles dropdown options
3rd)
- Got to Line 190.
- Comment all lines in the following elseif out.
- Paste following code after the comment:
First I copied the file app/code/core/Mage/Catalog/Block/Product/View/Options/Abstract.php
to app/code/local/Mage/Catalog/Block/Product/View/Options/Abstract.php
Create the directories if needed, this will keep the modified Abstract.php during upgrade.
Easy to do a diff between the two after an upgrade to see if anything is changed in the core one.