Quantcast
Channel: See World » javascript
Viewing all articles
Browse latest Browse all 5

Magento – Get Product View Price By JavaScript

0
0
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 = [...]

Viewing all articles
Browse latest Browse all 5

Latest Images

Trending Articles





Latest Images