$(".prices .add_panier").click(function () { $pdt = $(this).parent().prev('td').find('select').attr('rel'); $qty = $(this).parent().prev('td').find('select').val(); $atr = $(this).attr('rel'); $des = $(this).attr('name'); $poids = $(this).attr('alt'); if ($poids == 'La boîte de Unite'){ $poids = '';} $.post('index.php?c=catalog&a=insert',{id:$pdt, qty:$qty, attr:$atr}, function (xml){ buildRightPanier(xml); $('#msg_popup').html('
You just added this product on your basket :
'); $('#msg_popup').append(''+$des+'
'+$poids+'
Continuer mes achatsVoir mon panier
'); $('#msg_popup').fadeIn(100); $('#msg_popup a#continueshippingpopup').click(function () { $('#msg_popup').fadeOut(1000); return false; }); }, "xml"); return false; }); function bindAddPanier() { $(".plusone_panier").click(function () { $pdt = $(this).attr('rel'); $atr = $(this).attr('target'); $.post('index.php?c=catalog&a=insert',{id:$pdt, attr:$atr, qty:1}, function (xml){ buildRightPanier(xml); $('#msg_popup').html('Votre produit à bien été retiré au panier.
'); $('#msg_popup').fadeIn(1); $('#msg_popup').fadeOut(1000); }, "xml"); return false; }); } function buildRightPanier(data){ var xmlData = $(data); $('#mf_panier').html(' '); $('#mf_panier_qty').html(' '); xmlData.find('produit').each(function () { var el= $(document.createElement('td')).appendTo($(document.createElement('tr')).appendTo('#mf_panier')); el.html($(this).find('quantite').text()+' x '+$(this).find('designation').text()+' '+$(this).find('poids').text()+''); }); //console.log(xmlData.find('produit').length); if(xmlData.find('produit').length>0){ $('#mf_panier_qty').html(''+xmlData.find('produit').length+' product(s) in my basket'); }else{ $('#mf_panier_qty').html('your basket is empty'); } bindAddPanier(); bindRemovePanier(); bindDeletePanier(); } bindAddPanier(); bindRemovePanier(); bindDeletePanier();