1 pièce(s) jointe(s)
Calculer un total général équivalent au prix - la remise
Bonjour à tous,
J'essaie de faire un TOTAL = PRIX - REMISE
J'ai fait le code suivant mais apparemment il y a un hic car je n'obtiens en résultat TOTAL que le montant du prix, la remise n'est pas prise en compte.
quelqu'un peut-il m'aider ?
Avec mes remerciements
voici la photo de ce que donne mon panier pour le moment
Pièce jointe 182476
Code:
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
|
if (isset($_SESSION['panier'])){
$nbreArticles = count($_SESSION['panier']['id_produit']);
$affichage_panier = '<h1>Votre panier</h1>
<table>
<tr><th colspan="9">Votre panier</th>
</tr>
<tr>
<th>Salle</th><th>Photo</th>
<th>Ville</th><th>Capacité</th>
<th>Date arrivée</th>
<th>Date départ</th>
<th>Prix HT</th>
<th>Remises</th>
<th>Supprimer un article</th>
</tr>';
for($i=0;$i<$nbreArticles;$i++){
$affichage_panier .= '<tr><td>' . $_SESSION['panier']['titre'][$i] . '</td>
<td><img src="' . $_SESSION['panier']['photo'][$i] . '" id="miniature_article" alt=""></td>
<td>' . $_SESSION['panier']['ville'][$i] . '</td>
<td>' . $_SESSION['panier']['capacite'][$i] . '</td>
<td>' . $_SESSION['panier']['date_arrivee'][$i] . '</td>
<td>' . $_SESSION['panier']['date_depart'][$i] . '</td>
<td>' . $_SESSION['panier']['prix'][$i] . ' </td>
<td>' . $_SESSION['panier']['reduction'][$i] . ' </td>
<td><a href="panier.php?action=supprimer_article&id_articleASupprimer=' . $i . '"><img src="styles/icones/supp.png" alt="supprimer un article"></a></td>
</tr>';
}
$remise = $_SESSION['panier']['reduction'][$i];
$montantTotal = montantTotal() - $remise;
$affichage_panier .= '<tr><th colspan="6">TOTAL :</th><th colspan="2">' . $montantTotal . ' </th><th></th></tr>
</table> |