/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
*/
$(function() {
    $(".shop_btn").click(function() {
    var id = $(this).siblings().get(3).value ;
    $.post("/shop/add/js/" , { 'product':id },
      function(data){
          $("#detail_qnt_" + id).html("Quantity: " + data.quantity);
      }, "json");
    return false;
	});
    
});

function delItem(id){ 
  //alert(id + " hello");
  $.post("/shop/del/", {'id':id }, 
  function( data ){
      $("#productrow_"+id).remove();
      try {
           document.getElementById("total_quantity").innerHTML =  "Quantity: " + data.total_quantity.quantity;
           document.getElementById("total_cost").innerHTML =  "Total: ZAR " + data.total_cost;
           document.getElementById("cart_total").innerHTML =  "Total: ZAR " + data.total_cost;

        } catch (e) {
            alert(e)
        }
  }, "json"  );
  
  return false;
}
