Posted 3 May 2007 · Report post Bonjour, en cliquant sur le lien plan du site la page nous sort un abécédaire des catégories. Serait-il possible d'avoir un abécédaire des produits (la liste complete des produits)? Merci Share this post : post Share on other sites
Posted 3 May 2007 · Report post Je pense que oui, il suffit d'aller chercher les produits au lieu des catégories. Il doit y avoir une requete SQL qui va chercher les information sur peel_categories, mettez peel_produits avec les bons noms de champs et ca roule. Willy Share this post : post Share on other sites
Posted 3 May 2007 · Report post cela ne suffira pas ! en effet il faut également récupérer la première lettre du produit !! Share this post : post Share on other sites
Posted 3 May 2007 · Report post Peut etre. Reste a voir quel champ il vaut, le nom, la ref ? Willy Share this post : post Share on other sites
Posted 3 May 2007 · Report post le nom je pense puisqu'il s'agit d'un abécédaire Share this post : post Share on other sites
Posted 3 May 2007 · Report post Et si l'on faisait un truc comme cela (je sais que cela ne marche pas mais j'ai essayé :) ) *************************************************************************** <? include("configuration.inc.php"); $DOC_TITLE = "[peel]"; include("$repertoire_modele/haut.php"); recup_produit(); include("$repertoire_modele/bas.php"); /****************************************************************************** * FUNCTIONS *****************************************************************************/ function recup_produit() { global $wwwroot, $repertoire_modele, $repertoire_images; $alpha = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'); echo "<table align=\"center\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\" width=\"100%\">"; echo "<tr><td colspan=\"2\" class=\"entete\">produits</td></tr>"; echo"<br>"; foreach ($alpha as $value) { $sqlCat = "SELECT c.id FROM peel_produits c WHERE c.etat = '1' AND c.alpha = '".$value."'"; $resCat = mysql_query($sqlCat) or DIE('Une erreur de connexion à la base s est produite ' . __LINE__ . '.<p>' . MYSQL_ERROR()); echo "<tr><td class=\"titre\" colspan=\"2\">".$value."</td></tr>"; if (mysql_num_rows($resCat) > 0) { while ($cat = mysql_fetch_array($resCat)) { $sqlCount = "SELECT COUNT(*) FROM peel_produits c WHERE p.id = pc.produit_id AND c.id = '".$cat['id']."' AND c.id = pc.categorie_id"; $resCount = mysql_query($sqlCount); if ($resCount) { $Count = mysql_fetch_row($resCount) or DIE('Une erreur de connexion à la base s est produite ' . __LINE__ . '.<p>' . MYSQL_ERROR()); } echo "<tr valign=\"top\"><td class=\"normal\">"; ?> <a class="normal" href="achat/index.php?catid=<? echo $cat['id'] ?>"><? echo html_entity_decode($cat['nom_'.$_SESSION['langue'].''])?> (<?php echo $Count[0] ?>)</a> <?php echo "</td></tr>"; } } } echo "</table>"; } ?> Share this post : post Share on other sites
Posted 3 May 2007 · Report post Pas mal, mais ca sert a quoi ca ? $sqlCount = "SELECT COUNT(*) FROM peel_produits c WHERE p.id = pc.produit_id AND c.id = '".$cat['id']."' AND c.id = pc.categorie_id"; Perso je mettrais: $sqlCount = "SELECT COUNT(*) FROM peel_produits c WHERE c.id = '".$cat['id']."' "; (car dans ta requete SQL tu fais appel a "p" et "pc" que tu ne déclares pas) Sinon ca a l'air bon. Willy Share this post : post Share on other sites
Posted 3 May 2007 · Report post Voila ce que ca me sort .... Si j'enleve la ligne 52 <a class="normal" href="achat/index.php?catid=<? echo $cat['id'] ?>"><? echo html_entity_decode($cat['nom_'.$_SESSION['langue'].''])?> (<?php echo $Count[0] ?>)</a> il ne me reste que les lettres Alpha sans les produits A Notice: Undefined index: nom_fr in c:\program files\easyphp1-8\www\1_gisserot\sitemap.php on line 52 (1) Notice: Undefined index: nom_fr in c:\program files\easyphp1-8\www\1_gisserot\sitemap.php on line 52 (1) B Notice: Undefined index: nom_fr in c:\program files\easyphp1-8\www\1_gisserot\sitemap.php on line 52 (1) Notice: Undefined index: nom_fr in c:\program files\easyphp1-8\www\1_gisserot\sitemap.php on line 52 (1) Notice: Undefined index: nom_fr in c:\program files\easyphp1-8\www\1_gisserot\sitemap.php on line 52 (1) Notice: Undefined index: nom_fr in c:\program files\easyphp1-8\www\1_gisserot\sitemap.php on line 52 (1) Notice: Undefined index: nom_fr in c:\program files\easyphp1-8\www\1_gisserot\sitemap.php on line 52 (1) Notice: Undefined index: nom_fr in c:\program files\easyphp1-8\www\1_gisserot\sitemap.php on line 52 (1) C Notice: Undefined index: nom_fr in c:\program files\easyphp1-8\www\1_gisserot\sitemap.php on line 52 (1) D Notice: Undefined index: nom_fr in c:\program files\easyphp1-8\www\1_gisserot\sitemap.php on line 52 (1) ...... Share this post : post Share on other sites
Posted 3 May 2007 · Report post la requte sql count n'est pas correcte Share this post : post Share on other sites
Posted 3 May 2007 · Report post Oups j'ais été trop vite, il faut mettre (a première vue): <? include("configuration.inc.php"); $DOC_TITLE = "[peel]"; include("$repertoire_modele/haut.php"); recup_produit(); include("$repertoire_modele/bas.php"); /****************************************************************************** * FUNCTIONS *****************************************************************************/ function recup_produit() { global $wwwroot, $repertoire_modele, $repertoire_images; $alpha = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'); echo "<table align=\"center\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\" width=\"100%\">"; echo "<tr><td colspan=\"2\" class=\"entete\">produits</td></tr>"; echo"<br>"; foreach ($alpha as $value) { $sqlCat = "SELECT c.id FROM peel_produits c WHERE c.etat = '1' AND c.alpha = '".$value."'"; $resCat = mysql_query($sqlCat) or DIE('Une erreur de connexion à la base s est produite ' . __LINE__ . '.<p>' . MYSQL_ERROR()); echo "<tr><td class=\"titre\" colspan=\"2\">".$value."</td></tr>"; if (mysql_num_rows($resCat) > 0) { while ($cat = mysql_fetch_array($resCat)) { $sqlCount = "SELECT id, nom_".$_SESSION['langue'].'' FROM peel_produits c WHERE c.id = '".$cat['id']."'"; $resCount = mysql_query($sqlCount); if ($resCount) { $Count = mysql_fetch_row($resCount) or DIE('Une erreur de connexion à la base s est produite ' . __LINE__ . '.<p>' . MYSQL_ERROR()); } echo "<tr valign=\"top\"><td class=\"normal\">"; ?> <a class="normal" href="achat/index.php?catid=<? echo $Count['id'] ?>"><? echo html_entity_decode($Count['nom_'.$_SESSION['langue'].''])?></a> <?php echo "</td></tr>"; } } } echo "</table>"; } ?> Share this post : post Share on other sites
Posted 3 May 2007 · Report post Parse error: parse error in c:\program files\easyphp1-8\www\1_gisserot\sitemap.php on line 33 voila ce que je recois :) Share this post : post Share on other sites
Posted 3 May 2007 · Report post <? include("configuration.inc.php"); $DOC_TITLE = "[peel]"; include("$repertoire_modele/haut.php"); recup_produit(); include("$repertoire_modele/bas.php"); /****************************************************************************** * FUNCTIONS *****************************************************************************/ function recup_produit() { global $wwwroot, $repertoire_modele, $repertoire_images; $alpha = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'); echo "<table align=\"center\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\" width=\"100%\">"; echo "<tr><td colspan=\"2\" class=\"entete\">produits</td></tr>"; echo"<br>"; foreach ($alpha as $value) { $sqlCat = "SELECT c.id FROM peel_produits c WHERE c.etat = '1' AND c.alpha = '".$value."'"; $resCat = mysql_query($sqlCat) or DIE('Une erreur de connexion à la base s est produite ' . __LINE__ . '.<p>' . MYSQL_ERROR()); echo "<tr><td class=\"titre\" colspan=\"2\">".$value."</td></tr>"; if (mysql_num_rows($resCat) > 0) { while ($cat = mysql_fetch_array($resCat)) { $sqlCount = "SELECT id, nom_".$_SESSION['langue']." FROM peel_produits c WHERE c.id = '".$cat['id']."'"; $resCount = mysql_query($sqlCount); if ($resCount) { $Count = mysql_fetch_row($resCount) or DIE('Une erreur de connexion à la base s est produite ' . __LINE__ . '.<p>' . MYSQL_ERROR()); } echo "<tr valign=\"top\"><td class=\"normal\">"; ?> <a class="normal" href="achat/index.php?catid=<? echo $Count['id'] ?>"><? echo html_entity_decode($Count['nom_'.$_SESSION['langue'].''])?></a> <?php echo "</td></tr>"; } } } echo "</table>"; } ?> Il y a '' eu lieu de " avant le FROM (2 quote simples au lieu d'une quote double). Tentes et dis nous. Willy Share this post : post Share on other sites
Posted 3 May 2007 · Report post Ca me donne cela maintenant Notice: Undefined index: nom_fr in c:\program files\easyphp1-8\www\1_gisserot\sitemap.php on line 50 Share this post : post Share on other sites
Posted 3 May 2007 · Report post J'ais refais le code a partir de ma page: <? include("configuration.inc.php"); $DOC_TITLE = "[PEEL.FR]"; include("$repertoire_modele/haut.php"); print_alpha(); include("$repertoire_modele/bas.php"); /****************************************************************************** * FUNCTIONS *****************************************************************************/ function print_alpha() { /* Affiche la liste des catégories par ordre alphabétique */ global $wwwroot, $repertoire_modele, $repertoire_images; $alpha = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'); echo "<table align=\"center\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\" width=\"100%\">"; echo "<tr><td colspan=\"2\" class=\"entete\">".SITEMAP."</td></tr>"; foreach ($alpha as $value) { $sqlCat = "SELECT c.id, c.nom_".$_SESSION['langue'].", c.alpha, c.image FROM peel_produits c WHERE c.etat = '1' AND c.alpha = '".$value."'"; $resCat = mysql_query($sqlCat) or DIE('Une erreur de connexion à la base s est produite ' . __LINE__ . '.<p>' . MYSQL_ERROR()); echo "<tr><td class=\"titre\" colspan=\"2\">".$value."</td></tr>"; if (mysql_num_rows($resCat) > 0) { while ($cat = mysql_fetch_array($resCat)) { $sqlCount = "SELECT COUNT(*) FROM peel_produits p, peel_produits_categories pc, peel_categories c WHERE p.id = pc.produit_id AND p.id = '".intval($cat['id'])."' AND c.id = pc.categorie_id"; $resCount = mysql_query($sqlCount); if ($resCount) { $Count = mysql_fetch_row($resCount) or DIE('Une erreur de connexion à la base s est produite ' . __LINE__ . '.<p>' . MYSQL_ERROR()); } echo "<tr valign=\"top\"><td class=\"normal\">"; ?> <a class="normal" href="achat/index.php?catid=<? echo $cat['id'] ?>"><? echo html_entity_decode($cat['nom_'.$_SESSION['langue'].''])?> (<?php echo $Count[0] ?>)</a> <?php echo "</td></tr>"; } } } echo "</table>"; } ?> Willy Share this post : post Share on other sites
Posted 3 May 2007 · Report post Une erreur de connexion à la base s est produite 32. Champ 'c.image' inconnu dans field list Share this post : post Share on other sites
Posted 3 May 2007 · Report post Une erreur de connexion à la base s est produite 32. Champ 'c.image' inconnu dans field list enlevez c.image de la requete. Willy Share this post : post Share on other sites
Posted 3 May 2007 · Report post Yes .......... :) Merci a toi Share this post : post Share on other sites
Posted 3 May 2007 · Report post Le bon code est donc pour les intéressés: <? include("configuration.inc.php"); $DOC_TITLE = "[PEEL.FR]"; include("$repertoire_modele/haut.php"); print_alpha(); include("$repertoire_modele/bas.php"); /****************************************************************************** * FUNCTIONS *****************************************************************************/ function print_alpha() { /* Affiche la liste des catégories par ordre alphabétique */ global $wwwroot, $repertoire_modele, $repertoire_images; $alpha = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'); echo "<table align=\"center\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\" width=\"100%\">"; echo "<tr><td colspan=\"2\" class=\"entete\">".SITEMAP."</td></tr>"; foreach ($alpha as $value) { $sqlCat = "SELECT c.id, c.nom_".$_SESSION['langue'].", c.alpha FROM peel_produits c WHERE c.etat = '1' AND c.alpha = '".$value."'"; $resCat = mysql_query($sqlCat) or DIE('Une erreur de connexion à la base s est produite ' . __LINE__ . '.<p>' . MYSQL_ERROR()); echo "<tr><td class=\"titre\" colspan=\"2\">".$value."</td></tr>"; if (mysql_num_rows($resCat) > 0) { while ($cat = mysql_fetch_array($resCat)) { $sqlCount = "SELECT COUNT(*) FROM peel_produits p, peel_produits_categories pc, peel_categories c WHERE p.id = pc.produit_id AND p.id = '".intval($cat['id'])."' AND c.id = pc.categorie_id"; $resCount = mysql_query($sqlCount); if ($resCount) { $Count = mysql_fetch_row($resCount) or DIE('Une erreur de connexion à la base s est produite ' . __LINE__ . '.<p>' . MYSQL_ERROR()); } echo "<tr valign=\"top\"><td class=\"normal\">"; ?> <a class="normal" href="achat/produit_details.php?id=<? echo $cat['id'] ?>" ><? echo html_entity_decode($cat['nom_'.$_SESSION['langue'].''])?> (<?php echo $Count[0] ?>)</a> <?php echo "</td></tr>"; } } } echo "</table>"; } ?> Willy Share this post : post Share on other sites
Posted 3 May 2007 · Report post mettre ceci : <a class="normal" href="achat/produit_details.php?id=<? echo $cat['id'] ?>" ><? echo html_entity_decode($cat['nom_'.$_SESSION['langue'].''])?> (<?php echo $Count[0] ?>)</a> ou lieu de <a class="normal" href="achat/index.php?catid=<? echo $cat['id'] ?>"><? echo html_entity_decode($cat['nom_'.$_SESSION['langue'].''])?> (<?php echo $Count[0] ?>)</a> Share this post : post Share on other sites
Posted 3 May 2007 · Report post Maintenant un peu plus dur :) : avec le sitemap d'origine les sous categories ne s'affichent pas comment faire pour les afficher aussi Share this post : post Share on other sites
Posted 3 May 2007 · Report post Dans quel sitemap ? Le vrai sitemap que vous soumettez à Google ou le plan du site pour les visiteurs ? Willy Share this post : post Share on other sites
Posted 3 May 2007 · Report post Oui pardon le "sitemap" plan du site pour les visiteurs Share this post : post Share on other sites
Posted 3 May 2007 · Report post Vous en voulez donc 2 un pour les produits et un pour les catégories et sous catégories ? Share this post : post Share on other sites
Posted 3 May 2007 · Report post En gros je voudrais celui affichant les catégories et sous catégories car j'ai trop de produits donc la liste est trop longue Merci Share this post : post Share on other sites