//////////////////////////////////////////////////////////////////////////// // // © PMP CONCEPT 2006 :: BOUTIQUE/COMMANDE RAPIDE // //////////////////////////////////////////////////////////////////////////// // Nom du fichier du procesus de commande var CommandeService = "/en/commanderefservice"; var BoutiqueService = "/en/boutiqueservice"; var Bouton = "/en/bouton"; var zero = '\"0.00\" \"€\"'; var formatDecimal = "."; var formatCentaine = "'"; function loadCommandeRapide() { document.getElementById('commandeRapide').innerHTML = ajaxSupporte(CommandeService+ "_load_0_0"); } // gestion des articles dans le panier function loadArticle( articleRef) { reponse = ajaxSupporte(CommandeService+ "_loadArticle_" + articleRef + "_0"); if(reponse == 1) { loadCommandeRapide(); } else { document.getElementById('desc_nouveau_article').innerHTML = reponse; } } function supprimeArticle(index) { reponse = ajaxSupporte(CommandeService+ "_supprArticle_0_"+index); if(reponse == 1) { loadCommandeRapide(); } else { document.getElementById('desc_nouveau_article').innerHTML = reponse; } } // calcul du prix article function prixQtt(index, selObj ) { var qtt = selObj.options[selObj.selectedIndex].value reponse = ajaxSupporte(CommandeService+ "_modifQtt_0_" + index + "@" + qtt); if(reponse == 1) loadCommandeRapide(); } function modifPot(index, val) { reponse = ajaxSupporte(CommandeService+ "_modifPot_0_" + index + "@"+val); if(reponse == 1) loadCommandeRapide(); } function ajoutPanier() { //récupère toutes les lignes var lignes = DomMgr.getElementsByMaskId('totalPrixArticle[%i]','input'); if(lignes.length > 0) { for(i=0; i < lignes.length; i++) { refArticle = document.getElementById('articleRef['+i+']').value; nomArticle = document.getElementById('article_nom['+i+']').innerHTML; qtt = document.getElementById('choixQtt['+i+']').options[document.getElementById('choixQtt['+i+']').selectedIndex].value //articleDansPanier('add', refArticle, nomArticle, qtt); texte = ajaxSupporte(BoutiqueService+ "_add_" + refArticle + "@" + qtt + "_" + encodeURI(nomArticle)) } ajaxSupporte(CommandeService + "_videCommande_0_0"); window.location.href = '/en/panier.php'; } } // on verif que le navigateur supporte AJAX var xhr_object; function ajaxSupporte(fichier) { // Mozilla if(window.XMLHttpRequest){ xhr_object = new XMLHttpRequest( ); } else if (window.ActiveXObject){ xhr_object = new ActiveXObject("Msxml2.XMLHTTP"); if (! xhr_object){ xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); } } //the request could still be null if neither ActiveXObject... if (!xhr_object){ alert('Your browser does not support XMLHTTPRequest... objects.'); return false; } xhr_object.open('GET', fichier, false); xhr_object.send(null); if(xhr_object.readyState == 4) { if(xhr_object.status == 200) { return(xhr_object.responseText); } else { alert('ERREUR ' + xhr_object.status + '\nA problem has occurred.'); return(false); } } else return(false); }