$(document).ready(function() { // fade in all display: none "Merken"-Links $(".addtocartclick").fadeIn("slow"); $("#shopping_cart_place").append("
"); timestamp = 0; updateShoppingCart(); $(".addtocartclick").click(function() { var art_id = (this.id).match(/\d+$/); var art_additionals = ''; var art_attribute_value = 0; var art_quantity = 1;//$("#art_quantity_"+art_id).val(); //alert(art_id); if ( $('#shopping_cart_place').is(':hidden') ) { $("#shopping_cart_place").fadeIn("slow"); } alert("Der Artikel wurde der Merkliste hinzugefügt"); if($("#art_attribute_value_"+art_id).length >= 1) { art_attribute_value = $("#art_attribute_value_"+art_id+" :selected").text(); //$('#hersteller :selected').text(); } //alert($("#art_attribute_value_"+art_id).length); //alert(art_attribute_value); if($("#art_quantity_"+art_id).length > 1) { art_quantity = $("#art_quantity_"+art_id).val(); } //alert(art_quantity); // todo //$("#shopping_cart_place").highlightFade({start:'#FEF1AB',speed:1000,end:'#fff'}); $.post("", { ajax: "1", art_id: art_id, products_id: art_id, art_quantity: art_quantity, art_attribute_value: art_attribute_value, art_additionals: art_additionals, action: "add_item", time: timestamp }, function(xml) { $("#shopping_cart_items").empty(); //alert(xml); //alert(this.id); //alert(this.id); addToCart(xml); //todo: //$("#cart_product_pos_" +art_id).highlightFade({start:'#66FF66',speed:1000,end:'#fff'}); }); return false; }); }); function addToCart(xml) { var total_sum=0; if($("status",xml).text() == "2") return; timestamp = $("time",xml).text(); count_pos = $("positions",xml).text(); //alert(timestamp); //alert(count_pos); // $("#shopping_cart_place").fadeIn("slow"); // restore samstag // $("#shopping_cart_wallpaper").fadeIn("slow"); // ZEILE MERKLISTE $("shopping_cart",xml).each(function(id) { var message; message = $("shopping_cart",xml).get(id); $("#shopping_cart_items").prepend(" » product_info.php?products_id="+$("art_id",message).text()+"\">" +$("art_name",message).text()+ "

cart_del.gif\" alt=\"entfernen\">"); }); if(count_pos==0) { $("#shopping_cart").hide(); // restore samstag //$("#shopping_cart").hide(); //$("#shopping_cart_footer").html("

Bisher sind keine Artikel auf Ihrer Merkliste - Nutzen Sie diese einfache Merkliste!

"); } else { $("#shopping_cart_place").fadeIn("slow"); //$("#shopping_cart_place").prepend("

Merkliste:

"); //$("#shopping_cart_footer").html( "> Aktualisieren"); // + $("total",xml).text() + "€ } //$("#shopping_cart_items").prepend( "Merkliste"); } function updateShoppingCart() { //$("#shopping_cart_place").hide(); $.post("", { time: timestamp, ajax: "1" } , function(xml) { $("#shopping_cart_items").empty(); if (!xml) { return false;} addToCart(xml); // ...füllt die liste mit zeilen count_pos = $("positions",xml).text(); //alert(count_pos); //alert(xml); if(count_pos==0) { $("#shopping_cart_place").hide(); } }); } function delete_from_cart(art_id) { $("#cart_tr_" + art_id).animate({ opacity: 'hide' }, "fast"); $.post("", { art_id: art_id, action: "delete_item" }, function(xml) { count_pos = $("positions",xml).text(); //alert(count_pos); //alert(xml); if(count_pos==0) { $("#shopping_cart_place").hide(); } }); } function item_minus(id) { var art_id = id; var art_attribute_value = $("#art_attribute_value_"+art_id).val(); var art_quantity = $("#art_quantity_"+art_id).val(); //$("#cart_tr_" + art_id).animate({ opacity: 'hide' }, "fast"); //alert() $.post("", { ajax: "1", art_id: art_id, art_attribute_value: art_attribute_value, action: "item_minus", time: timestamp }, function(xml) { count_pos = $("positions",xml).text(); if(count_pos==0) { $("#shopping_cart_place").hide(); } //alert(xml); $("#shopping_cart_items").empty(); updateShoppingCart(); //addToCart(xml); }); } function item_plus(id) { var art_id = id; var art_attribute_value = $("#art_attribute_value_"+art_id).val(); var art_quantity = $("#art_quantity_"+art_id).val(); //$("#cart_tr_" + art_id).animate({ opacity: 'hide' }, "fast"); //alert() $.post("", { ajax: "1", art_id: art_id, art_attribute_value: art_attribute_value, action: "item_plus", time: timestamp }, function(xml) { //count_pos = $("positions",xml).text(); //if(count_pos==0) //{ // $("#shopping_cart_place").hide(); //} //alert(xml); $("#shopping_cart_items").empty(); updateShoppingCart(); //addToCart(xml); }); }