Created
December 4, 2012 19:14
-
-
Save dpdexter/4207649 to your computer and use it in GitHub Desktop.
BrilliantRetail - Change product display price when options are selected.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{exp:brilliant_retail:js} | |
var price,newPrice,qty,opt,adj; | |
$(function(){ | |
price = parseInt($('p.price').html().replace('$',''))*1; | |
$('select','.product-options') | |
.change(function(){ | |
qty = $('option:selected','#qty_select').val(); | |
newPrice = price; | |
$('select','.product-options').each(function(){ | |
opt = $(this).find('option:selected').text(); | |
mat = opt.match(/\$\d+.\d+/); | |
if(mat){ | |
adj = mat[0].replace("$",""); | |
adj = adj * 1; | |
newPrice += adj; | |
} | |
}); | |
var num = parseFloat(qty*newPrice).toFixed(2); | |
$('p.price').html('$'+num); | |
}); | |
}); | |
{/exp:brilliant_retail:js} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment