Ben fiyatlarını hesaplamak için jQuery kullanıyorum. İşte benim JavaScript küçük bir parçası olduğunu:
// Prices: radio
var curLam = "gloss";
$("input[name=lamination]").click(function(){
var gloss = 5;
var matt = 6;
if ($(this).val() == 'gloss' && curLam != 'gloss'){
$('#prices span').text(parseInt($('#prices span').text()) + gloss - matt);
curLam = 'gloss';
console.log('1');
}
if ($(this).val() == 'matt' && curLam != 'matt'){
$('#prices span').text(parseInt($('#prices span').text()) - gloss + matt);
curLam = 'matt';
console.log('2');
}
$("#prices span").each(function(){
var $priceValue = $(this);
} )
});
Bu, bir mat veya parlak kaplama seçilmiş olup olmadığını görmek için denetler ve sonra prices div etiketi içindeki span içine fiyatını ekler.
Sonra benim alışveriş sepeti için PHP aktarılabilir bir değişken içine bu fiyat değer atamak için bilmek gerekir.