Mettre le nom de la catégorie

23 posts in this topic

Posted · Report post

Tout d'abord bonjour à tous...

Voilà je suis en train de mettre en place la société et le site de ma femme pour de la vente de lingerie...

J'ai opté pour la solution open source pour démarrer et je pense passer à la version premium dès que l'on aura gagné un petit peu de sous ;) ... J'ai fait quelques petite modifs de présentation (mode débutant très facile).

Voilà je voudrais pouvoir mettre sur l'index.php (achats) le nom de la catégorie dans laquelle on se trouve sous format de titre...

je mets une image car mes explications sont un peu floues

070424031946505912.jpg

Share this post


: post
Share on other sites

Posted · Report post

ce n'est pas déjà le cas ?

Share this post


: post
Share on other sites

Posted · Report post

ce n'est pas déjà le cas ?

Bin non justement

Je voudrais mettre comme dans l'exemple Lady VIP (La catégorie) à la place de liste des produits

Share this post


: post
Share on other sites

Posted · Report post

pas possible il y a l'arborescence des catégories et/ou des produits et à partir de là tu as la liste des produits en fonction de la catégorie sélectionnée

Share this post


: post
Share on other sites

Posted · Report post

pas possible il y a l'arborescence des catégories et/ou des produits et à partir de là tu as la liste des produits en fonction de la catégorie sélectionnée

Bien sur que si c'est possible, c'est la dernière catégorie de l'arborescence qui m'intéresse à chaque fois... Tout ce qu'il faut c'est le code php correct et là je suis trop noob pour ça

Share this post


: post
Share on other sites

Posted · Report post

désolé alors mais comprend rien alors je passe

Share this post


: post
Share on other sites

Posted · Report post

J'ai remplacé ce code

echo "<strong>Liste des produits</strong><br /><br />";

par

echo "<strong>";

echo $cat['nom'];

echo "</strong><br /><br />";

Mais ça ne marche pas... voilà où est mon problème

Share this post


: post
Share on other sites

Posted · Report post

désolé alors mais comprend rien alors je passe

En fait il veut remplacer "Liste des produits" par le nom de sa catégorie en cours ici "Lady VIP", non ?

Cherchez "Liste des produits" dans la page et remplacez le par le nom de la catégorie en cours.

WIlly

J'ai remplacé ce code

echo "<strong>Liste des produits</strong><br /><br />";

par

echo "<strong>";

echo $cat['nom'];

echo "</strong><br /><br />";

Mais ça ne marche pas... voilà où est mon problème

Ca marque quoi ?

Rien ?

Est ce que "$cat" est bien définie avant ?

Comment est contruit l'arborescence apres "PARCOURIR" ?

WIlly

Share this post


: post
Share on other sites

Posted · Report post

ça ne marque rien...

Comment est contruit l'arborescence apres "PARCOURIR" ?

<?php affiche_arbre_categorie($catid) ?>

après tout ce situe dans le function.php

<?php 

include("../configuration.inc.php");


if (!isset($_GET['catid'])) {	$catid = 0;} else {$catid = intval($_GET['catid']);}


$qid_c = recupere_sous_categorie($catid);


$DOC_TITLE = "Mademoiselle De Cheransac, Vente de lingerie fine de grande qualité à prix doux...";


include("$repertoire_modele/haut.php");

?>

<div class="normal" style="border-bottom: 1px dotted grey;text-transform : uppercase;"><?php affiche_arbre_categorie($catid) ?></div>


		<?php 


		$sqlcat = "SELECT image, description FROM peel_categories WHERE id = '".$catid."'";


		$rescat = mysql_query($sqlcat);


		$objcat = mysql_fetch_object($rescat);


		if ($rescat) {


			if (mysql_num_rows($rescat) > 0) {


				echo "<div align=\"center\" class=\"normal\">";


				if (!empty($objcat->image)) {


				echo "<img  src=\"$wwwroot/upload/".$objcat->image."\" align=\"left\">";


				}


				echo "<br /><br >".stripslashes($objcat->description);


				echo "</div>";


			}


		}



			if ($qid_c) {


				if (mysql_num_rows($qid_c) == 0) { 


					echo "";


				} else {


				echo "<table border=\"0\" width=\"90%\" cellpadding=\"0\" cellspacing=\"0\"><tr valign=\"top\"><td class=\"normal\" align=\"center\">";


		  echo "<strong>Liste des produits</strong><br /><br />";

		   echo $cat['nom'];

				echo "</td></tr>";

					 while ($cat = mysql_fetch_array($qid_c)) { ?>

					 <tr valign="top" align="center"><td class="normal">

					<li><a class="normal" href="<?php echo $_SERVER['PHP_SELF']?>?catid=<?php echo $cat['id'] ?>"><?php echo $cat['nom'] ?></a></li>

					</td></tr>

					<?php } 

					echo "<tr><td><img src=$wwwroot/images/blank.gif width=\"1\" height=\"10\"  border=\"0\" alt=\"\" /></td></tr></table>"; 

				}

			} else {

			echo "";

			}

		 ?>


<?php 

$nb = 30; //nombre d'enregistrement par page 


if (!isset($_GET['start'])) {$start=0;} else {$start = $_REQUEST['start'];}


// Récupération et affichage des données 

$sql = "SELECT p.id, p.reference, p.nom, p.promotion, p.descriptif, p.description, p.image1, p.prix, p.on_special, pc.categorie_id FROM peel_produits p, peel_produits_categories pc WHERE p.id = pc.produit_id AND pc.categorie_id = $catid  AND p.etat = 1 ORDER BY p.prix LIMIT $start,$nb";


$result=mysql_query($sql); 


if (mysql_num_rows($result) == 0) { 



	if (mysql_num_rows($qid_c) == 0) { 


		echo "aucun produit disponible dans cette catégorie"; 


	}


	} else {


echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";


while($prod=mysql_fetch_array($result)) 

{

?>

<tr>

<td class="normal" valign="top">

	<?php if ($prod['image1']  != "") { ?>


	<img src="<?php echo $repertoire_images?>/<?php echo $prod['image1'] ?>" valign="top" width="100" alt="" />


	<?php } else {?>


	<img src="<?php echo $wwwroot?>/images/photo-non-disponible.gif" align="left" valign="top" width="100%" alt="" />


	<?php }?>


</td>

<td class="normal">


	<?php if (!empty($prod['reference'])) { echo "<span class=\"petit\">Réf. : ".$prod['reference']."</span><br />";} ?>


	<a class="titre" href="<?php echo  $wwwroot?>/achat/produit_details.php?id=<?php echo $prod['id'] ?>&catid=<?php echo $catid?>"><?php echo  stripslashes($prod['nom']) ?></a><br />

	<?php 

	echo nl2br(stripslashes($prod['descriptif']))."<br />";


	$prix = $prod['prix'] * (1-$prod['promotion']/100);


			if ($prod['promotion'] != 0) {?>


				<font color="#CC0000">Promotion : <?php echo $prod['promotion'];  ?> %</font><br />


		 		Prix TTC : <s><?php echo fprix($prod['prix']); ?></s> 


				<font color="#CC0000"><?php echo fprix($prix); ?> € TTC</font><br />


			 <?php } else {?>


			 	Prix : <font color="#CC0000"><?php echo fprix($prix); ?> € T.T.C</font><br />


			 <?php } ?>


	<form method="post" action="<?php echo $wwwroot?>/achat/caddie_ajout.php" name="ajout<?php echo $prod['id'] ?>">

				Quantité : 

				<select name="qte" class="formulaire1">

					<option value="1">1</option>

					<option value="2">2</option>

					<option value="3">3</option>

					<option value="4">4</option>

					<option value="5">5</option>

				</select>

				<input type="hidden" name="id" value="<?php echo $prod['id'] ?>" />

				<a class="normal" href="java script:document.ajout<?php echo $prod['id'] ?>.submit()">

				<img src="<?php echo $wwwroot?>/images/caddie.gif" align=middle alt="" border="0" />

				</a>

				<a class="normal" href="java script:document.ajout<?php echo $prod['id'] ?>.submit()">

				Ajouter au caddie

				</a>


	 			| <a class="normal" href="<?php echo  $wwwroot?>/achat/produit_details.php?id=<?php echo $prod['id'] ?>&catid=<?php echo $catid?>">

				<img src="<?php echo $wwwroot?>/images/voir.gif" align="middle" width="20" height="20" alt="" border="0" /></a>

				<a class="normal" href="<?php echo  $wwwroot?>/achat/produit_details.php?id=<?php echo $prod['id'] ?>&catid=<?php echo $catid?>">+ de détails</a><p>

</form>

</td></tr>

<tr>

<td align="center" class="normal" colspan="2">

<?php 

} 


//Boutons précédent et suivant 

if($start) 

{echo ("<a class=\"petit\" href=\"$wwwroot/achat/index.php?catid=".$catid."&start=".($start-$nb)."\">Page précédente</a>");} 


$result=mysql_query("SELECT COUNT(*) FROM peel_produits p, peel_produits_categories pc WHERE p.id = pc.produit_id	AND pc.categorie_id = $catid  AND p.etat = 1"); 


$row=mysql_fetch_row($result); 


if($row[0]>($start+$nb)) 

{ 

if($start) 

{echo (" / ");} 

echo ("<a class=\"petit\" href=\"$wwwroot/achat/index.php?catid=".$catid."&start=".($start+$nb)."\">Page suivante</a>"); 

} 


echo ("<br />"); 


//Affichage des pages 

if($row[0]>$nb) {// le nombre d'enreg. est > au nb de lignes d'affichage ?

echo ("Page : "); 

for($index=0;($index*$nb)<$row[0];$index++) // oui alors on affiche les numéros de pages

{ 

?>

	<b><a class="petit" href="<?php echo $_SERVER['PHP_SELF']."?catid=".$catid."&start=".$index*$nb; ?>"><?php echo $index+1; ?></a></b>

<?php 

}

}

echo "</td></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("SELECT id, nom, description, parent_id  FROM peel_categories WHERE parent_id = $catid AND id > 0 AND etat = 1") or DIE('Une erreur de connexion à la base s est produite ' . __LINE__ . '.<p>' . MYSQL_ERROR()); 

	return $qid; 

} 


?>

Share this post


: post
Share on other sites

Posted · Report post

Et avec ca (apres avoir fait une copie de secour de la page):

<?php 

include("../configuration.inc.php");


if (!isset($_GET['catid'])) {	$catid = 0;} else {$catid = intval($_GET['catid']);}


$qid_c = recupere_sous_categorie($catid);


$DOC_TITLE = "Mademoiselle De Cheransac, Vente de lingerie fine de grande qualité à prix doux...";


include("$repertoire_modele/haut.php");

?>

<div class="normal" style="border-bottom: 1px dotted grey;text-transform : uppercase;"><?php affiche_arbre_categorie($catid) ?></div>


		<?php 


		$sqlcat = "SELECT image, description, nom FROM peel_categories WHERE id = '".$catid."'";


		$rescat = mysql_query($sqlcat);


		$objcat = mysql_fetch_object($rescat);


		if ($rescat) {


			if (mysql_num_rows($rescat) > 0) {


				echo "<div align=\"center\" class=\"normal\">";


				if (!empty($objcat->image)) {


				echo "<img  src=\"$wwwroot/upload/".$objcat->image."\" align=\"left\">";


				}


				echo "<br /><br >".stripslashes($objcat->description);


				echo "</div>";


			}


		}



			if ($qid_c) {


				if (mysql_num_rows($qid_c) == 0) { 


					echo "";


				} else {


				echo "<table border=\"0\" width=\"90%\" cellpadding=\"0\" cellspacing=\"0\"><tr valign=\"top\"><td class=\"normal\" align=\"center\">";


		  echo "<strong>Liste des produits</strong><br /><br />";


		if ($rescat) {


			if (mysql_num_rows($rescat) > 0) {

					 echo $objcat->nom;

			}

		}


				echo "</td></tr>";

					 while ($cat = mysql_fetch_array($qid_c)) { ?>

					 <tr valign="top" align="center"><td class="normal">

					<li><a class="normal" href="<?php echo $_SERVER['PHP_SELF']?>?catid=<?php echo $cat['id'] ?>"><?php echo $cat['nom'] ?></a></li>

					</td></tr>

					<?php } 

					echo "<tr><td><img src=$wwwroot/images/blank.gif width=\"1\" height=\"10\"  border=\"0\" alt=\"\" /></td></tr></table>"; 

				}

			} else {

			echo "";

			}

		 ?>


<?php 

$nb = 30; //nombre d'enregistrement par page 


if (!isset($_GET['start'])) {$start=0;} else {$start = $_REQUEST['start'];}


// Récupération et affichage des données 

$sql = "SELECT p.id, p.reference, p.nom, p.promotion, p.descriptif, p.description, p.image1, p.prix, p.on_special, pc.categorie_id FROM peel_produits p, peel_produits_categories pc WHERE p.id = pc.produit_id AND pc.categorie_id = $catid  AND p.etat = 1 ORDER BY p.prix LIMIT $start,$nb";


$result=mysql_query($sql); 


if (mysql_num_rows($result) == 0) { 



	if (mysql_num_rows($qid_c) == 0) { 


		echo "aucun produit disponible dans cette catégorie"; 


	}


	} else {


echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";


while($prod=mysql_fetch_array($result)) 

{

?>

<tr>

<td class="normal" valign="top">

	<?php if ($prod['image1']  != "") { ?>


	<img src="<?php echo $repertoire_images?>/<?php echo $prod['image1'] ?>" valign="top" width="100" alt="" />


	<?php } else {?>


	<img src="<?php echo $wwwroot?>/images/photo-non-disponible.gif" align="left" valign="top" width="100%" alt="" />


	<?php }?>


</td>

<td class="normal">


	<?php if (!empty($prod['reference'])) { echo "<span class=\"petit\">Réf. : ".$prod['reference']."</span><br />";} ?>


	<a class="titre" href="<?php echo  $wwwroot?>/achat/produit_details.php?id=<?php echo $prod['id'] ?>&catid=<?php echo $catid?>"><?php echo  stripslashes($prod['nom']) ?></a><br />

	<?php 

	echo nl2br(stripslashes($prod['descriptif']))."<br />";


	$prix = $prod['prix'] * (1-$prod['promotion']/100);


			if ($prod['promotion'] != 0) {?>


				<font color="#CC0000">Promotion : <?php echo $prod['promotion'];  ?> %</font><br />


				 Prix TTC : <s><?php echo fprix($prod['prix']); ?></s> 


				<font color="#CC0000"><?php echo fprix($prix); ?> € TTC</font><br />


			 <?php } else {?>


				 Prix : <font color="#CC0000"><?php echo fprix($prix); ?> € T.T.C</font><br />


			 <?php } ?>


	<form method="post" action="<?php echo $wwwroot?>/achat/caddie_ajout.php" name="ajout<?php echo $prod['id'] ?>">

				Quantité : 

				<select name="qte" class="formulaire1">

					<option value="1">1</option>

					<option value="2">2</option>

					<option value="3">3</option>

					<option value="4">4</option>

					<option value="5">5</option>

				</select>

				<input type="hidden" name="id" value="<?php echo $prod['id'] ?>" />

				<a class="normal" href="java script:document.ajout<?php echo $prod['id'] ?>.submit()">

				<img src="<?php echo $wwwroot?>/images/caddie.gif" align=middle alt="" border="0" />

				</a>

				<a class="normal" href="java script:document.ajout<?php echo $prod['id'] ?>.submit()">

				Ajouter au caddie

				</a>


				 | <a class="normal" href="<?php echo  $wwwroot?>/achat/produit_details.php?id=<?php echo $prod['id'] ?>&catid=<?php echo $catid?>">

				<img src="<?php echo $wwwroot?>/images/voir.gif" align="middle" width="20" height="20" alt="" border="0" /></a>

				<a class="normal" href="<?php echo  $wwwroot?>/achat/produit_details.php?id=<?php echo $prod['id'] ?>&catid=<?php echo $catid?>">+ de détails</a><p>

</form>

</td></tr>

<tr>

<td align="center" class="normal" colspan="2">

<?php 

} 


//Boutons précédent et suivant 

if($start) 

{echo ("<a class=\"petit\" href=\"$wwwroot/achat/index.php?catid=".$catid."&start=".($start-$nb)."\">Page précédente</a>");} 


$result=mysql_query("SELECT COUNT(*) FROM peel_produits p, peel_produits_categories pc WHERE p.id = pc.produit_id	AND pc.categorie_id = $catid  AND p.etat = 1"); 


$row=mysql_fetch_row($result); 


if($row[0]>($start+$nb)) 

{ 

if($start) 

{echo (" / ");} 

echo ("<a class=\"petit\" href=\"$wwwroot/achat/index.php?catid=".$catid."&start=".($start+$nb)."\">Page suivante</a>"); 

} 


echo ("<br />"); 


//Affichage des pages 

if($row[0]>$nb) {// le nombre d'enreg. est > au nb de lignes d'affichage ?

echo ("Page : "); 

for($index=0;($index*$nb)<$row[0];$index++) // oui alors on affiche les numéros de pages

{ 

?>

	<b><a class="petit" href="<?php echo $_SERVER['PHP_SELF']."?catid=".$catid."&start=".$index*$nb; ?>"><?php echo $index+1; ?></a></b>

<?php 

}

}

echo "</td></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("SELECT id, nom, description, parent_id  FROM peel_categories WHERE parent_id = $catid AND id > 0 AND etat = 1") or DIE('Une erreur de connexion à la base s est produite ' . __LINE__ . '.<p>' . MYSQL_ERROR()); 

	return $qid; 

} 


?>

Share this post


: post
Share on other sites

Posted · Report post

Non, c'est toujours pareil, rien n'est marqué ;)

Share this post


: post
Share on other sites

Posted · Report post

Et avec ca (apres avoir fait une copie de secour de la page):

<?php 

include("../configuration.inc.php");


if (!isset($_GET['catid'])) {	$catid = 0;} else {$catid = intval($_GET['catid']);}


$qid_c = recupere_sous_categorie($catid);


$DOC_TITLE = "Mademoiselle De Cheransac, Vente de lingerie fine de grande qualité à prix doux...";


include("$repertoire_modele/haut.php");

?>

<div class="normal" style="border-bottom: 1px dotted grey;text-transform : uppercase;"><?php affiche_arbre_categorie($catid) ?></div>


		<?php 


		$sqlcat = "SELECT image, description, nom FROM peel_categories WHERE id = '".$catid."'";


		$rescat = mysql_query($sqlcat);


		$objcat = mysql_fetch_object($rescat);


		if ($rescat) {


			if (mysql_num_rows($rescat) > 0) {


				echo "<div align=\"center\" class=\"normal\">";


				if (!empty($objcat->image)) {


				echo "<img  src=\"$wwwroot/upload/".$objcat->image."\" align=\"left\">";


				}


				echo "<br /><br >".stripslashes($objcat->description);


				echo "</div>";


			}


		}



			if ($qid_c) {


				if (mysql_num_rows($qid_c) == 0) { 


					echo "";


				} else {


				echo "<table border=\"0\" width=\"90%\" cellpadding=\"0\" cellspacing=\"0\"><tr valign=\"top\"><td class=\"normal\" align=\"center\">";


		  /*echo "<strong>Liste des produits</strong><br /><br />";*/



		$sqlcat = "SELECT image, description, nom FROM peel_categories WHERE id = '".$catid."'";


		$rescat = mysql_query($sqlcat);


		$objcat = mysql_fetch_object($rescat);

		if ($rescat) {


			if (mysql_num_rows($rescat) > 0) {

					 "<strong>".$objcat->nom."</strong><br /><br />";

			}

		}


				echo "</td></tr>";

					 while ($cat = mysql_fetch_array($qid_c)) { ?>

					 <tr valign="top" align="center"><td class="normal">

					<li><a class="normal" href="<?php echo $_SERVER['PHP_SELF']?>?catid=<?php echo $cat['id'] ?>"><?php echo $cat['nom'] ?></a></li>

					</td></tr>

					<?php } 

					echo "<tr><td><img src=$wwwroot/images/blank.gif width=\"1\" height=\"10\"  border=\"0\" alt=\"\" /></td></tr></table>"; 

				}

			} else {

			echo "";

			}

		 ?>


<?php 

$nb = 30; //nombre d'enregistrement par page 


if (!isset($_GET['start'])) {$start=0;} else {$start = $_REQUEST['start'];}


// Récupération et affichage des données 

$sql = "SELECT p.id, p.reference, p.nom, p.promotion, p.descriptif, p.description, p.image1, p.prix, p.on_special, pc.categorie_id FROM peel_produits p, peel_produits_categories pc WHERE p.id = pc.produit_id AND pc.categorie_id = $catid  AND p.etat = 1 ORDER BY p.prix LIMIT $start,$nb";


$result=mysql_query($sql); 


if (mysql_num_rows($result) == 0) { 



	if (mysql_num_rows($qid_c) == 0) { 


		echo "aucun produit disponible dans cette catégorie"; 


	}


	} else {


echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";


while($prod=mysql_fetch_array($result)) 

{

?>

<tr>

<td class="normal" valign="top">

	<?php if ($prod['image1']  != "") { ?>


	<img src="<?php echo $repertoire_images?>/<?php echo $prod['image1'] ?>" valign="top" width="100" alt="" />


	<?php } else {?>


	<img src="<?php echo $wwwroot?>/images/photo-non-disponible.gif" align="left" valign="top" width="100%" alt="" />


	<?php }?>


</td>

<td class="normal">


	<?php if (!empty($prod['reference'])) { echo "<span class=\"petit\">Réf. : ".$prod['reference']."</span><br />";} ?>


	<a class="titre" href="<?php echo  $wwwroot?>/achat/produit_details.php?id=<?php echo $prod['id'] ?>&catid=<?php echo $catid?>"><?php echo  stripslashes($prod['nom']) ?></a><br />

	<?php 

	echo nl2br(stripslashes($prod['descriptif']))."<br />";


	$prix = $prod['prix'] * (1-$prod['promotion']/100);


			if ($prod['promotion'] != 0) {?>


				<font color="#CC0000">Promotion : <?php echo $prod['promotion'];  ?> %</font><br />


				 Prix TTC : <s><?php echo fprix($prod['prix']); ?></s> 


				<font color="#CC0000"><?php echo fprix($prix); ?> € TTC</font><br />


			 <?php } else {?>


				 Prix : <font color="#CC0000"><?php echo fprix($prix); ?> € T.T.C</font><br />


			 <?php } ?>


	<form method="post" action="<?php echo $wwwroot?>/achat/caddie_ajout.php" name="ajout<?php echo $prod['id'] ?>">

				Quantité : 

				<select name="qte" class="formulaire1">

					<option value="1">1</option>

					<option value="2">2</option>

					<option value="3">3</option>

					<option value="4">4</option>

					<option value="5">5</option>

				</select>

				<input type="hidden" name="id" value="<?php echo $prod['id'] ?>" />

				<a class="normal" href="java script:document.ajout<?php echo $prod['id'] ?>.submit()">

				<img src="<?php echo $wwwroot?>/images/caddie.gif" align=middle alt="" border="0" />

				</a>

				<a class="normal" href="java script:document.ajout<?php echo $prod['id'] ?>.submit()">

				Ajouter au caddie

				</a>


				 | <a class="normal" href="<?php echo  $wwwroot?>/achat/produit_details.php?id=<?php echo $prod['id'] ?>&catid=<?php echo $catid?>">

				<img src="<?php echo $wwwroot?>/images/voir.gif" align="middle" width="20" height="20" alt="" border="0" /></a>

				<a class="normal" href="<?php echo  $wwwroot?>/achat/produit_details.php?id=<?php echo $prod['id'] ?>&catid=<?php echo $catid?>">+ de détails</a><p>

</form>

</td></tr>

<tr>

<td align="center" class="normal" colspan="2">

<?php 

} 


//Boutons précédent et suivant 

if($start) 

{echo ("<a class=\"petit\" href=\"$wwwroot/achat/index.php?catid=".$catid."&start=".($start-$nb)."\">Page précédente</a>");} 


$result=mysql_query("SELECT COUNT(*) FROM peel_produits p, peel_produits_categories pc WHERE p.id = pc.produit_id	AND pc.categorie_id = $catid  AND p.etat = 1"); 


$row=mysql_fetch_row($result); 


if($row[0]>($start+$nb)) 

{ 

if($start) 

{echo (" / ");} 

echo ("<a class=\"petit\" href=\"$wwwroot/achat/index.php?catid=".$catid."&start=".($start+$nb)."\">Page suivante</a>"); 

} 


echo ("<br />"); 


//Affichage des pages 

if($row[0]>$nb) {// le nombre d'enreg. est > au nb de lignes d'affichage ?

echo ("Page : "); 

for($index=0;($index*$nb)<$row[0];$index++) // oui alors on affiche les numéros de pages

{ 

?>

	<b><a class="petit" href="<?php echo $_SERVER['PHP_SELF']."?catid=".$catid."&start=".$index*$nb; ?>"><?php echo $index+1; ?></a></b>

<?php 

}

}

echo "</td></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("SELECT id, nom, description, parent_id  FROM peel_categories WHERE parent_id = $catid AND id > 0 AND etat = 1") or DIE('Une erreur de connexion à la base s est produite ' . __LINE__ . '.<p>' . MYSQL_ERROR()); 

	return $qid; 

} 


?>

Share this post


: post
Share on other sites

Posted · Report post

Non, toujours pareil ;)

Merci quand même de ton aide

Share this post


: post
Share on other sites

Posted · Report post

Non, toujours pareil ;)

Merci quand même de ton aide

C'est pas mon code qui est en ligne, il y a toujours "liste des produits"

Willy

Share this post


: post
Share on other sites

Posted · Report post

oui normal, j'ai testé et remis l'ancien ensuite

Share this post


: post
Share on other sites

Posted · Report post

Toujours rien ?

Le principe est d'aller chercher le nom de la catégorie s'il y en a un et de l'afficher.

C'est plus facile d'écrire et de tester pas soit même.

Willy

Share this post


: post
Share on other sites

Posted · Report post

Oui, le principe, je l'ai compris... Mais la question est quelle est la variable qui le permettra... J'ai fait tout un rituel de test sans résultat...

Il doit falloir inclure une fonction PhP mais là je suis pas trop au point

Share this post


: post
Share on other sites

Posted · Report post

Dans ta page, fais un test remplace:

		$sqlcat = "SELECT image, description FROM peel_categories WHERE id = '".$catid."'";


		$rescat = mysql_query($sqlcat);


		$objcat = mysql_fetch_object($rescat);


		if ($rescat) {


			if (mysql_num_rows($rescat) > 0) {


				echo "<div align=\"center\" class=\"normal\">";


				if (!empty($objcat->image)) {


				echo "<img  src=\"$wwwroot/upload/".$objcat->image."\" align=\"left\">";


				}


				echo "<br /><br >".stripslashes($objcat->description);


				echo "</div>";


			}


		}
Par (le champ "nom" existe bien dans la table peel_categories" ???) :
		$sqlcat = "SELECT image, description, nom FROM peel_categories WHERE id = '".$catid."'";


		$rescat = mysql_query($sqlcat);


		$objcat = mysql_fetch_object($rescat);


		if ($rescat) {


			if (mysql_num_rows($rescat) > 0) {


				echo "<div align=\"center\" class=\"normal\">";


				if (!empty($objcat->image)) {


				echo "<img  src=\"$wwwroot/upload/".$objcat->image."\" align=\"left\">";


				}


				echo "<br /><br >".stripslashes($objcat->nom);


				echo "<br /><br >".stripslashes($objcat->description);


				echo "</div>";


			}


		}

Tu devrais avoir le nom de la catégorie avant la description, dis nous si tu l'as.

Willy

Share this post


: post
Share on other sites

Posted · Report post

Bravo, et mille fois mercis de ton aide

;) ;) :P :) :( :D

Share this post


: post
Share on other sites

Posted · Report post

Mais là ca l'ecrit en tres tres gros aussi, pas terrible pour les petits écrans ;)

Sinon le principe est là, a vous de modifier a voter guise et à appeler "stripslashes($objcat->nom)" quand vous voulez du moment que l'objet "$objcat" est valable.

Willy

Share this post


: post
Share on other sites

Posted · Report post

Oui, c'est normal, je suis en train de modifier la taille... Normalement ça s'écrit en petit selon ton code

Share this post


: post
Share on other sites

Posted · Report post

Oui, apres je ne peux pas tout faire a ta place :P

Enfin si je peux commander 2 ou 3 trucs pour ma copine ;) ;)

Share this post


: post
Share on other sites

Posted · Report post

tu peux toujours la société est ouverte ;)

Share this post


: post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

Twitter Advisto ecommerce

Facebook PEEL Shopping