68 lines
3.0 KiB
PHP
Executable File
68 lines
3.0 KiB
PHP
Executable File
<?php
|
|
// $nomFicAppelant = basename(__FILE__);
|
|
// ---------------------------------------------------
|
|
// /panier deroulant
|
|
// ---------------------------------------------------
|
|
//$numeroDeMenu=10;
|
|
// ---------------------------------------------------
|
|
$mess='';
|
|
$mess2='';
|
|
|
|
// ---------------------------------------------------
|
|
// si pas connecté et panier non vide, l'utilisateur a un mail mailTmp de la session
|
|
// on ne veut pas remplacer idMail par mailTmp car sinon dans inscription on a pas le bon mail
|
|
// donc on utilise mailTech comme tampon
|
|
// ---------------------------------------------------
|
|
|
|
if ($idMail!='') {
|
|
$reqSelect="SELECT idCde FROM commande WHERE idMail='" .$idMail. "' AND etatCde='Pn' ";
|
|
if (isset($debug[2]) && $debug[2] == '1' ) { $debugMsg .= monDebug (2, ['reqSelect' => $reqSelect],'menuPanier.php');}
|
|
$resConn=$idPdo->query($reqSelect);
|
|
|
|
if ($resConn) {
|
|
$resPanierEnCours=$resConn->fetch(PDO::FETCH_ASSOC);
|
|
if ($resPanierEnCours) {
|
|
$reqSelect2="SELECT totTtcLigne, idPrd, qte FROM commandelignes WHERE idCde=" .$resPanierEnCours['idCde']. ";";
|
|
if (isset($debug[2]) && $debug[2] == '1' ) { $debugMsg .= monDebug (2, ['reqSelect2' => $reqSelect2],'menuPanier.php');}
|
|
$resConn2=$idPdo->query($reqSelect2);
|
|
$nbArtEncours=0;
|
|
if ($resConn2) {
|
|
while ($lignesTab=$resConn2->fetch(PDO::FETCH_ASSOC)) {
|
|
$totTtcLg=$lignesTab['totTtcLigne'];
|
|
$idPrdB=$lignesTab['idPrd'];
|
|
$qteB=$lignesTab['qte'];
|
|
// if ($nbArtEncours>=1) {echo '<br>';};
|
|
$nbArtEncours=$nbArtEncours+$qteB;
|
|
if (isset($debug[2]) && $debug[2] == '1' ) { $debugMsg .= monDebug (2, ['totTtcLg' => $totTtcLg],'');}
|
|
|
|
$reqSelect="SELECT nomPrd FROM produitslibelle WHERE idPrd='" .$idPrdB. "' AND idLg='" .$lg. "';";
|
|
if (isset($debug[2]) && $debug[2] == '1' ) { $debugMsg .= monDebug (2, ['reqSelect' => $reqSelect],'menuPanier.php');}
|
|
$resConn3=$idPdo->query($reqSelect);
|
|
if ($resConn3) {
|
|
$tableauNom=$resConn3->fetch(PDO::FETCH_ASSOC);
|
|
if (isset($tableauNom['nomPrd'])) {
|
|
$nomPrd=addslashes($tableauNom['nomPrd']) ;
|
|
if (isset($debug[2]) && $debug[2] == '1' ) { $debugMsg .= monDebug (2, ['nomPrd' => $nomPrd],'');}
|
|
}
|
|
}
|
|
if (isset($_SESSION['lg'])) {$lg=$_SESSION['lg'];} else $lg='FRA';
|
|
$totTtcLg=formatNB($totTtcLg,$lg);
|
|
if (isset($nomPrd)) $mess .= '<span class="sousMenuItem" style="display:inile-block; padding: 1px; white-space:break-spaces; max-width:98%; font-size:0.8rem; font-weight:normal"> ' .$nomPrd. ' : ' .$totTtcLg. ' €</span>';
|
|
}
|
|
|
|
if ($nbArtEncours!=0) {
|
|
$mess2 = $cdeMsg[22]. ' ' .$nbArtEncours .$mess;
|
|
echo '<script type="text/javascript" >';
|
|
echo 'document.getElementById(\'menuPnMsg\').innerHTML=\'' .$mess2. '\'; ';
|
|
echo '</script>';
|
|
}
|
|
// else
|
|
// if (isset($debug[2]) && $debug[2] == '1' ) {echo 'nada';}
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
if (isset($debug[2]) && $debug[2] == '1' ) { $debugMsg .= monDebug(1,['Erreur recupération du panier' => 'Oui'],'menuPanier.php');}
|
|
}
|
|
}
|
|
?>
|