var items_in_cart; var is_Pro = false; function addthis() { //get the main parts var sku = document.getElementById("sku").value; var cost = document.getElementById("cost").value; var qty = document.getElementById("quantity").value; var o = new Object(); o._sku = sku; o._cost = cost; o._product_quantity = qty; return addTocart(o); } function addone(sku, cost) { var qty = 1; var o = new Object(); o._sku = sku; o._cost = cost; o._product_quantity = qty; return addTocart(o); } function addTocart(o) { var product_quantity = o._product_quantity; var sku = o._sku; var cost = o._cost; var totalcost = cost * product_quantity; var args = { product_quantity : product_quantity, sku : sku, cost : cost} var retVal = "OK"; $.ajax({ type: "POST", url: localator + "cart/procarttotal.asp", async : false, data: {}, success: function(data){ totaldollars = data; } }); var OK = true; if (is_Pro) { var totally = (totaldollars * 1) + (totalcost * 1); if (totally > maxDollars) { retVal = "You have met your quota for purchases. This item cannot be added to your cart. "; OK = false; } } if (OK) { $.post(localator + "cart/add2cart.asp", args, function(data) { updatecart(); } ); } return retVal; } function addArrayTocart(arrayOfItems) { for(i=0 ; i < arrayOfItems.length-1; i++) { o = arrayOfItems[i]; product_id = o.product_id; product_quantity = o.product_quantity; estimated_tax = o.estimated_tax; customer_id = o.customer_id; customer_order_id = o.customer_order_id; description = o.description; sku = o.sku; cost = o.cost; family = o.family; var args = {product_id : product_id, product_quantity : product_quantity, estimated_tax : estimated_tax, customer_id : customer_id, sku : sku, family : family, cost : cost, customer_order_id : customer_order_id, description : o.description } $.ajax({url:localator + "cart/add2cart.asp", data:(args), async:false}); } i = arrayOfItems.length -1; o = arrayOfItems[i]; product_id = o.product_id; product_quantity = o.product_quantity; estimated_tax = o.estimated_tax; customer_id = o.customer_id; customer_order_id = o.customer_order_id; description = o.description; var args = {product_id : product_id, product_quantity : product_quantity, estimated_tax : estimated_tax, customer_id : customer_id, customer_order_id : customer_order_id, description : o.description } $.post(localator + "cart/add2cart.asp", args, function(data) { updatecart(); } ); return "OK"; } function updatecart() { $.post(localator + "cart/cartcount.asp", {}, function(data) { if (data == "0") { $("#cct").html(""); } else { $("#cct").html(" (" + data + ")"); } } ); } function emptycart() { $.post(localator + "cart/emptycart.asp", null, function(data){ window.location.reload()} ); } function removeitem(id) { $.post("/cart/removeitem.asp", { itemid : id }, function(data){ window.location.reload()} ); }