0byt3m1n1
Path:
/
home
/
kassiope
/
www
/
achat
/
[
Home
]
File: suggest.php
<? include("../configuration.inc.php"); if (!isset($_GET['catid'])) { $catid = 0;} else {$catid = intval($_GET['catid']);} $qid_c = recupere_sous_categorie($catid); $DOC_TITLE = "[GAIABOUTIK.FR]"; include("$repertoire_modele/haut.php"); echo "<div class=\"tetiere\">".OUR_SUGGEST."</div>"; $nb = 6; //nombre d'enregistrement par page if (!isset($_GET['start'])) {$start=0;} else {$start = intval($_REQUEST['start']);} $prix_min = - $_SESSION['caddie']->total; $sql = "SELECT p.id FROM gaia_produits p WHERE p.prix >= '".$prix_min."' AND p.etat = '1' ORDER BY p.prix LIMIT $start,$nb"; $result=mysql_query_override($sql); if (mysql_num_rows_override($result) == 0) { if (mysql_num_rows_override($qid_c) == 0) { echo "<div class=\"texte\">".NO_INDEX_PRODUCT."</div>"; } } else { echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"1\" width=\"100%\">"; $nb_cellules = mysql_num_rows_override($result); $nb_colonnes = 2; $j = 0; while($prod=mysql_fetch_array_override($result)) { if ( $j % $nb_colonnes == 0 ) { echo "<tr>"; } if($j % $nb_colonnes !=0 OR $j % $nb_colonnes == 0 ) { // on affiche une cellule if ( $j % $nb_colonnes == 0 OR $j == $nb_cellules ) { echo "<td bgcolor=\"#cccccc\" class=\"newsCelluleOne\" width=\"50%\" valign=\"top\">"; } else { echo "<td bgcolor=\"#cccccc\" class=\"newsCelluleTwo\" width=\"50%\" valign=\"top\">"; } $where = ""; template_index_produit($prod['id'], $where); } echo "</td>"; $j++; if ( $j % $nb_colonnes == 0 OR $j == $nb_cellules ) { echo "</tr>"; } } echo "<tr><td align=\"center\" class=\"normal\" colspan=\"2\">"; //Boutons précédent et suivant if($start) {print("<a class=petit href=\"achat/index.php?catid=".$catid."&start=".($start-$nb)."\">Page précédente</a>");} $result=mysql_query_override("SELECT COUNT(*) FROM gaia_produits p, gaia_produits_categories pc WHERE p.id = pc.produit_id AND pc.categorie_id = $catid AND p.etat = 1"); $row=mysql_fetch_row_override($result); if($row[0]>($start+$nb)) { if($start) {print(" / ");} print("<a class=petit href=\"achat/index.php?catid=".$catid."&start=".($start+$nb)."\">Page suivante</a>"); } print("<br />"); //Affichage des pages if($row[0]>$nb) {// le nombre d'enreg. est > au nb de lignes d'affichage ? print("Page : "); for($index=0;($index*$nb)<$row[0];$index++) // oui alors on affiche les numéros de pages { ?> <b><a class="petit" href="<?=$_SERVER['PHP_SELF']."?catid=".$catid."&start=".$index*$nb; ?>"><? echo $index+1; ?></a></b> <? } } echo "</td></tr></table>"; /* echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tr>"; $sql = "SELECT * FROM gaia_etatstock ORDER BY position"; $res = mysql_query_override($sql); if (mysql_num_rows_override($res) > 0) { while($EtatStock = mysql_fetch_array_override($res)) { echo "<td class=\"normal\"><img src=\"$repertoire_upload/".$EtatStock['image']."\" align=\"middle\"> ".$EtatStock['nom_'.$_SESSION['langue'].'']."</td>"; } } echo "</tr></table>"; */ } include("$repertoire_modele/bas.php"); /****************************************************************************** * FONCTIONS *****************************************************************************/ function recupere_sous_categorie($catid=0) { /* Récupère le nom et la description de toutes les sous-catégories de celle-ci */ $qid = mysql_query_override("SELECT id, nom_".$_SESSION['langue'].", description_".$_SESSION['langue'].", parent_id, image FROM gaia_categories WHERE parent_id = '$catid' AND id > '0' AND etat = '1' ORDER BY position") or DIE('Une erreur de connexion à la base s est produite ' . __LINE__ . '.<p>' . MYSQL_ERROR()); return $qid; } ?>