Bonjour à vous, j'ai un problème avec le panier d'un de mes projets.
Je vous explique:

J'ai actuellement 2 produit dans mon panier qui est égale a 229,60€.
Cependant mon calcul final quand j'addition tout sa j'obtiens 230,60€

Sa c'est pour calculer le prix d'un produit grâce a sa quantité
Je vous met mon code ci-dessous:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
<?php $panier = $db->executeQuery('SELECT * FROM panier WHERE user_id = ? ORDER BY id DESC', array($userInfo[0]['id']));
                        foreach ($panier as $paniers) { 
 
                        $produits = $db->executeQuery('SELECT * FROM produit WHERE produit = ? ORDER BY id', array($paniers["produit_id"]));
                        $images = $db->executeQuery('SELECT * FROM produit_image WHERE produit_id = ? ORDER BY id limit 1', array($paniers["produit_id"]));
                        ?>
                                    <tr class="product-row">
                                        <td class="product-col">
                                            <figure class="product-image-container">
                                                <a href="./produit_voir?produit=<?php echo $produits[0]["produit"]; ?>" class="product-image">
                                                    <img src="./assets/boutique/<?php echo $images[0]["images"]; ?>" alt="product">
                                                </a>
                                            </figure>
                                            <h2 class="product-title">
                                                <p><span><?php echo $produits[0]["titre"]; ?></span><br>
                                    <span>Taille: <?php echo $paniers["taille"]; ?></span><br>
                                    <span>Couleur: <?php echo $paniers["couleur"]; ?></span><br>
                                    <span>Catégorie: <?php echo $produits[0]["categorie"]; ?></span><br>
                                    <span>Sous catégorie: <?php echo $produits[0]["sous_categorie"]; ?></span><br>
                                </p>
                                            </h2>
                                        </td>
                                        <td><?php echo $produits[0]["prix"]; ?>€</td>
                                        <td>
                                            <?php echo $paniers["quantiter"]; ?>
                                        </td>
                                        <td><?php 
                                    $montant = ($paniers["quantiter"] * $produits[0]["prix"]);
                                    $total = 0;
                                    $total = $montant + $total;
                                    $superTotal += $total;
                                    echo $total;
                                ?>€ <a href="./panier?id=<?php echo $paniers["id"]; ?>" title="Remove product" class="btn-remove"><span class="sr-only">Remove</span></a></td>
                                    </tr>
 
 
                                    <?php } ?>
Ensuite pour mon total sa donne sa :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 
<td><?php
                                    $panniers1 = $db->executeQuery('SELECT * FROM panier WHERE user_id = ?', array($userInfo[0]["id"]));
                                    if ($panniers1[0]['user_id'] == 0) 
                                    { ?>
 
                                            0.00€
 
                                    <?php } else { ?>
 
                                    <?php
                                           echo $superTotal; 
                                    ?>€
 
                                    <?php } ?></td>
Voila le screen de la page pour vous donner une idée de ce que sa donne : https://prnt.sc/sbdggy

J'espère que vous pourrais m'aidée.
Si vous voulez me contacter je suis joignable par email : bernard-dylan@outlook.fr
Ou sur discord : dylan_brnd#9682