1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| TypeResa = request.Form("TypeResa")
DateStage = request.Form("DateStage")
STAGE_ID = request.Form("STAGE_ID")
Libelle = request.Form("Libelle")
Prix = request.Form("Prix")
NbCommande = request.Form("NbCommande")
Redirection = request.Form("Redirect")
'fonction qui permet de recuperer l'indice d'un article dans le panier si il existe(cela va permettre par la suite d'incrementer la quantité à cet article si il a déja été commandé et ainsi d'éviter d'avoir 2 lignes dans le tableau correspondant à un même article)
function RecupIndiceArticleExist()
for i=0 to Ubound(TabPanier)
if TabPanier(i)(0)=STAGE_ID then
Indice=i
Exit function
End if
Next
RecupIndiceArticleExist=Indice
End function
' Initialisation du panier
dim TabPanier
if not isarray(session("Panier")) then 'le panier n'existe pas
' creation du tableau avec les affectations des valeurs
TabPanier=array(array(TypeResa,DateStage,STAGE_ID,Libelle,Prix,NbCommande))
else 'le tableau est déja créé
dim Indice
TabPanier=session("Panier")
RecupIndiceArticleExist()
if Indice<>"" then ' c a d que l'article existe dans le panier : récupération de l'indice
TabPanier(Indice)(2)=TabPanier(Indice)(2)+NbCommande
Else ' article n'est pas dans le panier création d'une nouvelle ligne
Indice=Ubound(TabPanier)+1'on determine le prochain index
redim preserve TabPanier(Indice)'on redimentionne le tableau
TabPanier(Indice)= array(TypeResa,DateStage,STAGE_ID,Libelle,Prix,NbCommande)'on affecte les valeurs
End if
End if
'mémorisation
Session("Panier") = TabPanier 'on stock le tableau |
Partager