1,use prototype overwriting Product.Options.prototype.reloadPrice
Product.Options.prototype.oldReloadPrice = Product.Options.prototype.reloadPrice;
Product.Options.prototype.reloadPrice = function(){
this.oldReloadPrice();
var currentPrice = howToGetThePrice();
doSomethingWithTheCurrentPrice(currentPrice);
};
2,use jQuery get the current price by cleaning the html inside an span
function getCurrentPrice(){
var ds = optionsPrice.priceFormat.decimalSymbol,
gs =optionsPrice.priceFormat.groupSymbol,
pf=optionsPrice.priceFormat.pattern;
var price = 0;
jQuery('#product-price-<?php echo $_product->getId() ?>_clone span')
.html()
.replace(new RegExp("\"+gs,'g'),'')
.replace(new RegExp("\"+ds,'g'),'.')
.sub(/([0-9.,]+)/,function(matches){
price = parseFloat(matches[1]);
});
return price;
}
3,Update element value with this code,you can update total price with qty.
$('totalPrice').innerHTML = currentPrice * $('qty').value
Related Posts
- Magento Use jQuery with Prototype
- Magento: the different between $_product->getData() and $_product->getAttributeName()
- How To Get Magento Product SKU
- Magento Get a Product’s Name instead Product ID
- Magento – Get the Total Price of items currently in the Cart
- Magento Converting Currency From One to Another
- Using jQuery in Magento
- How to create a shopping cart price rule using Magento methods?
- ThemeForest – RT-Theme 9 / Business Theme with Product Showcase (5 Colours)
- Find Windows Vista Product Key Number