var product,
numberof,
quantity,
price,
localStorageProd;
function storeProdStorage( product , numberof, quantity, price ) {
var itemsArray = [];
newItem = {
product : product ,
numberof : numberof ,
quantity : quantity ,
price : price
};
if (localStorage["prodbank"] != null) {
var localStorageContentObject = JSON.parse(localStorage["prodbank"]);
itemsArray.push(localStorageContentObject);
for( var i = 0; i < itemsArray.length ; i++ ) {
if(itemsArray[i].product == product) {
itemsArray[i].quantity = quantity;
itemsArray[i].price = price;
localStorage.setItem('prodbank', JSON.stringify(itemsArray[i]));
} else {
itemsArray.push(newItem);
localStorage.setItem('prodbank', JSON.stringify(itemsArray));
}
}
} else {
localStorage.setItem('prodbank', JSON.stringify(newItem));
}
}
$(function() {
$(".quantity-slider").slider({
range: "min",
value: 50,
min: 50,
max: 1000,
step: 50,
slide: function(e,ui) {
var quant = $('.quantity').html(commaSeparateNumber((ui.value) *10));
var price = $('.price').html(ui.value);
if($('.price').html() == "50" ) {
$('.quantity').html(250);
}
product = $(".pricing-title").html();
numberof = $(".pricing-code .form-section h3").contents().get(0).nodeValue;
quantity = $(".pricing-code .form-section h3 .quantity").eq(0).html();
price = $(".pricing-code .form-section h3 .price").eq(0).html();
storeProdStorage(product , numberof, quantity, price );
}
});
$('.quantity').html(($( ".quantity-slider" ).slider("value"))*5);
});
var product,
numberof,