0byt3m1n1
Path:
/
home
/
kassiope
/
www
/
achat
/
modeles
/
[
Home
]
File: historique_rapide_details.php
<?php $recprod = mysql_query_override("select c.nom_".$lg." as catname, c.id as catid, co.nom_".$lg." as colorname, co.id as colorid, p.* from gaia_produits p left join gaia_produits_couleurs pco on p.id = pco.produit_id left join gaia_produits_categories pc on p.id = pc.produit_id left join gaia_couleurs co on co.id = pco.couleur_id left join gaia_categories c on pc.categorie_id = c.id order by c.position, c.nom_fr, p.position "); $defcat = ''; $cpt=0; $alltails = ''; $k=0; if(isset($_GET['del'])) { $key = array_search($_GET['del'], $_SESSION['cats']); unset($_SESSION['cats'][$key]); } if(isset($_POST['curcat']) && !in_array($_POST['curcat'], $_SESSION['cats'])) $_SESSION['cats'][] = $_POST['curcat']; echo '<form name="formId" method="post" id="formId" action="'.$wwwroot.'achat/achats_rapides.php">'; echo '<input type="text" name="curcat" id="curcat" value="" />'; echo '<section class="points"> <div class="container"> <div class="row commande-header"> <div class="col-xl-9 col-lg-8 col-12"> <h1>Commande rapide</h1> </div> '.(($last>0)?' <div class="col-xl-3 col-lg-4 col-12"> <a href="'.$wwwroot.'achat/historique_commandes.php?mode=recommande&token='.md5($last).'" class="btn-cta">repasser ma dernière commande</a> </div>':'').' <div class="col-12"><h2>'.$_SESSION['utilisateur']['societe'].'</h2></div> </div> <div class="row j-between"> <!-- tableau commande --> <div class="col-xl-8 col-12"> <div class="row">'; if(!isset($_SESSION['cats']) || empty($_SESSION['cats'])) : echo '<div class="col-12">Cliquez sur le bouton "Ajouter une catégorie" pour commencer.</div>'; else : $cpt=1; foreach($_SESSION['cats'] as $cat) : $thecat = get_categorie($cat); $c = array(); recup_id($cat, $c); $c = array_reverse($c); $name = array(); foreach($c as $v) : $r = get_categorie($v); $name[]= $r['nom_'.$lg]; endforeach; echo '<table class="table table-hover"> <thead> <tr> <th colspan="2" scope="col" class="col-md-6 col-12"><a href="'.$wwwroot.'achat/achats_rapides.php?del='.$cat.'"><i class="fas fa-times"></i> </a> '.implode(' | ',$name).'</th> <th scope="col" class="col-2 table-orange">P.U. HT</th> <th scope="col" class="col-md-2 col-4 table-orange">Quantité</th> <th scope="col" class="col-2 table-orange">Total HT<button type="button" class="btn-table"><span class="chevron top '.((count($_SESSION['cats'])!=$cpt)?'chevrondown':'').'"></span></button></th> </tr> </thead> <tbody class="tablecat" '.((count($_SESSION['cats'])!=$cpt)?'style="display:none"':'').'> <!-------------------------------------------------->'; $recprods = mysql_query_override("select * from gaia_produits p, gaia_produits_categories pc where pc.categorie_id = '".$cat."' and pc.produit_id = p.id and p.etat =1 and p.on_pack = 0"); while($prod = mysql_fetch_array_override($recprods)) : $mark = get_label($prod['id'], 20); $conditionnement = get_label($prod['id'], 1); $imga1 = first_img($prod['image1'], $prod['id']); $img1 = (!empty($imga1)) ?"<img class=\"img-fluid\" loading=\"lazy\" src=\"$repertoire_upload/".$imga1."\" alt=\"".$prod['nom_'.$_SESSION['langue'].'']."\" />" : "<img class=\"img-fluid\" src=\"$wwwroot/images/min_nopict.jpg\" alt=\"photo non disponible\" border=\"0\">"; $sqlStock = "SELECT stock, couleur_id, taille_id FROM gaia_stocks_temp WHERE produit_id = '".$prod['id']."'"; /* Ici on ne recherche que les produits dont le stock est > 0 */ $resStock = mysql_query_override($sqlStock); if (mysql_num_rows_override($resStock) == 0) { $sqlStock = "SELECT stock, couleur_id, taille_id FROM gaia_stocks WHERE produit_id = '".$prod['id']."'"; /* Ici on ne recherche que les produits dont le stock est > 0 */ $resStock = mysql_query_override($sqlStock); } $Stock = mysql_fetch_array_override($resStock); if($Stock['stock']>0) { echo ' <tr> <td>' . $img1 . '</td> <td class="infos-cd-table"> ' . (($mark) ? '<h4>' . $mark['nom_' . $_SESSION['langue']] . '</h4>' : '') . ' <p>' . $prod['nom_' . $lg] . (($conditionnement)?' x'.$conditionnement['value']:'') . '</p> </td> <td>' . affiche_prix_list($prod['id']) . '</td> <td class="qty-cd"> <div class="input-group input-quantity"> <input type="hidden" name="prod[]" value="' . $prod['id'] . '" /> <input type="hidden" name="stock[]" value="' . $Stock['stock'] . '" /> <input type="button" value="-" class="button-minus" data-field="qte' . $prod['id'] . '" onclick="moins(\'qte' . $prod['id'] . '\', 0); xajax_change_prix(\'' . $prod['id'] . '\', document.getElementById(\'price' . $prod['id'] . '\').value, document.getElementById(\'qte' . $prod['id'] . '\').value)"> <input type="text" readonly step="1" min="0" value="0" id="qte' . $prod['id'] . '" name="qte[]" class="text-center quantity-field"> <input type="button" value="+" class="button-plus" data-field="qte' . $prod['id'] . '" onclick="plus(\'qte' . $prod['id'] . '\',\'' . $Stock['stock'] . '\'); xajax_change_prix(\'' . $prod['id'] . '\', document.getElementById(\'price' . $prod['id'] . '\').value, document.getElementById(\'qte' . $prod['id'] . '\').value)"> </div> </td> <td> <p><div id="totalprice' . $prod['id'] . '">0 €</div></p> </td> </tr>'; } endwhile; echo ' <!--------------------------------------------------> </tbody> </table>'; $cpt++; endforeach; endif; ?> </div> <!-- Ajouter une catégorie --> <div class="col-12 add-cat show-cat"> <span class="btn-cta opencta">Ajouter une categorie</span> <button class="btn-cta" type="submit" onclick="this.form.action='<?php echo $wwwroot; ?>achat/caddie_ajout_multi.php'" value="Submit">Ajouter au panier</button> </div> <div class="col-12 add-cat2"> <div class="row"> <div class="col-auto"> <select name="cat" id="catg" onchange="xajax_chargecat(this.value, 'souscat')"> <option value="" selected>Choisir une catégorie</option> <?php $reccat = mysql_query_override("select * from gaia_categories where etat = 1 and parent_id = 0 order by position, nom_".$lg); while($cat = mysql_fetch_array_override($reccat)) echo '<option value="'.$cat['id'].'">'.$cat['nom_'.$lg].'</option>'; ?> </select> </div> <div class="col-auto" id="souscat"></div> <div class="col-auto" id="soussouscat"></div> </div> <div class="row"> <div class="col-12"> <button type="submit" value="Submit">Voir les produits</button> <button type="button" class="cancel-cat">Annuler</button> </div> </div> </div> </div> <?php print_cart(); echo '</div></div></section>'; /* echo '<table cellspacing="0" cellpadding="0" width="100%" border="0" class="achatrapide">'; $rectail = mysql_query_override("select * from gaia_tailles where nom_".$lg." != '' order by position"); $nbtail = mysql_num_rows_override($rectail); while($pt = mysql_fetch_array_override($rectail)){ $alltails .= '<td class="menutail">'.stripslashes($pt['nom_'.$lg]).'</td>'; } $alltails .= '<td class="empty"></td><td class="menutail">TOTAL HT</td>'; while($prods = mysql_fetch_array_override($recprod)) { if($defcat<>$prods['catid']) : echo '<tr><td class="empty"></td></tr>'; echo '<tr>'; echo '<td nowrap>'; echo '<h2>'.$prods['catname'].'</h2>'; $defcat = $prods['catid']; echo '</td>'; echo '<td class="empty"></td>'; echo $alltails; echo '</tr>'; endif; echo '<tr class="ligneprod">'; echo '<td nowrap>'; echo '<div class="mx-0 row prodrapide">'; $imga1 = first_img($prods['image1'], $prods['id']); echo '<div class="rapideimg text-center"><img src="upload/'.$imga1.'" class="img-fluid p-1" /></div>'; echo '<div class="rapidetxt py-2"><b>'.$prods['nom_'.$lg].'<br />'.$prods['colorname'].'</b>'.fprix($prods['prix_revendeur']).'€ '.UNIT_PRICE2.'</div>'; echo '</div>'; echo '</td>'; echo '<td class="empty"></td>'; $rectail = mysql_query_override("select * from gaia_tailles where nom_".$lg." != '' order by position"); while($pt = mysql_fetch_array_override($rectail)){ $recs = mysql_query_override("select * from gaia_stocks where produit_id = '".$prods['id']."' and couleur_id = '".$prods['colorid']."' and taille_id = '".$pt['id']."'"); if(mysql_num_rows_override($recs)>0) { $stock = mysql_fetch_array_override($recs); $stock['stock'] = (($stock['stock']<=0)?0:$stock['stock']); echo '<td nowrap class="contenttail s"> <input type="hidden" name="ligne['.$k.']" value="'.$cpt.'" /> <input type="hidden" name="prodid['.$k.']" value="'.$prods['id'].'" /> <input type="hidden" name="color['.$k.']" value="'.$prods['colorid'].'" /> <input type="hidden" name="size['.$k.']" value="'.$pt['id'].'" /> <input type="hidden" name="stock['.$k.']" value="'.$stock['stock'].'" /> <input type="hidden" name="prix_'.$cpt.'" value="'.$prods['prix_revendeur'].'" /> <input type="hidden" name="prodid_'.$cpt.'" value="'.$prods['id'].'" /> <input type="text" name="qte_'.$cpt.'_'.$pt['id'].'" value="" '.(($stock['stock']<=0)?'readonly':'').' placeholder="00" onkeyup="if(this.value>'.($stock['stock']).') this.value='.($stock['stock']).';xajax_change_prix(xajax.getFormValues(\'focusform\'), \''.$cpt.'\');" /> </td>'; $k++; } else echo '<td class="contenttail"> - </td>'; } echo '<td class="empty"></td>'; echo '<td nowrap class="contenttail s"><input type="text" name="total_'.$cpt.'" id="total_'.$cpt.'" value="" placeholder="- €" readonly /></td>'; echo '</tr>'; $cpt++; } echo '<tr><td class="empty big"></td></tr>'; echo '<tr class="ligneprod">'; echo '<td colspan="'.($nbtail+2).'" align="right"><button class="proceedbtn">'.ADD_CART.'</button></td>'; echo '<td class="empty"></td>'; echo '<td nowrap class="contenttail s"><input type="text" name="total" id="total" value="" placeholder="- €" readonly /></td>'; echo '</tr>'; echo '</table>'; */ echo '</form>';