Flux d’activité

Flux d’activité de Messages

  1. kawa26


    Salut

    En fait c'est le meme code, mais c'est juste une partie du code à modifier...

    pour faire simple, fais un copier-coller du code ci dessous, celui là fonctionna tres bien

    <?php
    
    
    /**********************************/
    
    /* FONCTIONS DE LA PAGE D ACCUEIL */
    
    /**********************************/
    
    
    
    function affiche_categorie_accueil() {
    
    /* Affiche la liste des cat&eacute;gories qui sont sp&eacute;ciales */
    
    	global $wwwroot, $repertoire_modele, $repertoire_upload;
    
    
    	$qid = mysql_query("SELECT c.id, c.nom_".$_SESSION['langue']." as categorie, c.image FROM peel_categories c WHERE c.etat = '1' AND c.on_special = '1' ORDER BY c.position") or DIE('Une erreur de connexion &agrave; la base s est produite ' . __LINE__ . '.<p>' . MYSQL_ERROR());
    
    
    	if (mysql_num_rows($qid) > 0) { 
    
    
    	$nb_cellules = mysql_num_rows($qid);
    
    
    	$nb_colonnes = 2;
    
    
    	echo "<h2>".CATALOG."</h2>";
    
    
    	echo "<table align=\"center\" border=\"0\" cellspacing=\"5\" cellpadding=\"0\" width=\"100%\">";
    
    
    	$j = 0;
    
    
    			while ($cat = mysql_fetch_array($qid)) 
    
    			{
    
    			if ( $j % $nb_colonnes == 0 ) {
    
    			echo "<tr>";
    
    			}
    
    			if($j % $nb_colonnes !=0 OR $j % $nb_colonnes == 0 ) {
    
    			// on affiche une cellule
    
    			echo "<td width=\"50%\" align=\"center\">";
    
    
    			echo "<p><a href=\"achat/index.php?catid=".$cat['id']."\">".html_entity_decode($cat['categorie'])."</a></p>";
    
    
    			if (!empty($cat['image'])) {
    
    
    				$width = calcul_largeur_image($repertoire_upload."/".$cat['image']);
    
    
    				$largeur = ($width >= 150) ? "150" : $width;
    
    
    				echo "<p><img src=\"$repertoire_upload/".$cat['image']."\" width=\"$largeur\" border=\"0\" alt=\"".html_entity_decode($cat['categorie'])."\"  title=\"".html_entity_decode($cat['categorie'])."\" /></p>";
    
    
    			}
    
    
    			} 
    
    
    			echo "</td>";
    
    
    			$j++;	
    
    
    			if ( $j % $nb_colonnes == 0 OR $j == $nb_cellules ) {
    
    
    				echo "</tr>";
    
    
    			}
    
    
    		} 
    
    
    	echo "</table>";
    
    
    
    }
    
    }
    
    
    function print_actu() {
    
    
    				global $wwwroot;
    
    				global $repertoire_upload;
    
    
    				$sql_ACTU = "SELECT p.id, p.surtitre_".$_SESSION['langue'].", p.titre_".$_SESSION['langue'].", p.chapo_".$_SESSION['langue'].", p.texte_".$_SESSION['langue']."
    
    				, p.image1, p.on_special, p.date_maj, pc.rubrique_id 
    
    				FROM peel_articles p, peel_articles_rubriques pc WHERE p.id = pc.article_id AND p.on_special = '1' AND p.etat = '1' ORDER BY p.date_maj DESC LIMIT 0,1";
    
    
    				$query_ACTU = mysql_query($sql_ACTU) or DIE('Une erreur de connexion &agrave; la base s est produite ' . __LINE__ . '.<p>' . MYSQL_ERROR());
    
    
    				if (mysql_num_rows($query_ACTU) > 0) {
    
    
    					echo "<table align=\"center\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">";
    
    
    					while ($art = mysql_fetch_array($query_ACTU)) {
    
    
    						echo "<tr>";
    
    
    						  echo "<td>";
    
    
    						echo "<h2>".html_entity_decode($art['titre_'.$_SESSION['langue'].''])."</h2>";
    
    
    						echo "<p>".date("d-m-Y")."</p>";
    
    
    						if (!empty($art['image1'])) {
    
    
    							echo "<img src=\"$repertoire_upload/".$art['image1']."\" align=\"left\">";
    
    
    						}
    
    
    						echo nl2br(html_entity_decode($art['chapo_'.$_SESSION['langue'].'']));
    
    
    						  echo "</td></tr>";
    
    
    					}
    
    
    					echo "</table>";
    
    
    				}
    
    
    } 
    
    
    
    function affiche_produit_colonne($cond, $titre) {
    
    /* Affiche la liste des cat&eacute;gories qui sont sp&eacute;ciales */
    
    	global $wwwroot;
    
    	global $repertoire_upload;
    
    	global $repertoire_images;
    
    
    	$requete = "SELECT p.id, p.nom_".$_SESSION['langue'].", p.image1, p.prix, p.promotion FROM peel_produits p WHERE ".$cond." AND p.etat = '1' LIMIT 0,2";
    
    
    	$qid = mysql_query($requete);
    
    
    	if (mysql_num_rows($qid) > 0) { 
    
    
    			$i = 1;
    
    
    			echo "<div id=\"top\">";
    
    
    			while ($prod = mysql_fetch_array($qid)) { 
    
    			?>
    
    
    			<h3><a href="achat/produit_details.php?id=<? echo $prod["id"] ?>" title="<?php echo html_entity_decode($prod['nom_'.$_SESSION['langue'].''])?>"><?php echo html_entity_decode($prod['nom_'.$_SESSION['langue'].''])?></a></h3>
    
    
    			<?php if (!empty($prod["image1"])) {
    
    
    			$width = calcul_largeur_image($repertoire_upload."/".$prod["image1"]);
    
    
    			$largeur = ($width >= 120) ? "120" : $width;
    
    
    			?>
    
    
    			<p><a href="achat/produit_details.php?id=<? echo $prod["id"] ?>" title="<?php echo html_entity_decode($prod['nom_'.$_SESSION['langue'].''])?>">	
    
    
    			<img src="<? echo $repertoire_upload?>/<?echo $prod["image1"]?>" width="<?php echo $largeur?>" align="center" border="0" alt="<?php echo html_entity_decode($prod['nom_'.$_SESSION['langue'].''])?>">
    
    
    			</a>
    
    
    			</p>
    
    
    			<?php } ?>
    
    
    			<p><?php affiche_prix($prod["id"])?></p>
    
    
    			<p><a href="achat/produit_details.php?id=<? echo $prod["id"] ?>" title="<?php echo html_entity_decode($prod['nom_'.$_SESSION['langue'].''])?>"><?echo MORE ?></a></p>
    
    
    			<?php
    
    
    			$i++;
    
    			}
    
    
    			echo "</div>";
    
    
    
    	}
    
    }
    
    
    
    
    function print_new() {
    
    
    	global $wwwroot;
    
    	global $repertoire_upload;
    
    
    	$qid = mysql_query("SELECT p.id, p.nom_".$_SESSION['langue'].", p.descriptif_".$_SESSION['langue'].", p.image1, p.image2 FROM peel_produits p INNER JOIN peel_sites_pivots sp ON (sp.produit_id = p.id) WHERE sp.site_id = '".intval($_SESSION['ecom']['id'])."' AND p.on_new = '1' AND p.etat = '1'	LIMIT 0,2") or DIE('Une erreur de connexion &agrave; la base s est produite ' . __LINE__ . '.<p>' . MYSQL_ERROR());
    
    
    	if (mysql_num_rows($qid) > 0) { 
    
    
    			echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"150\" style=\"background:#cccccc\">";
    
    
    			echo "<tr><td valign=\"top\">";
    
    
    			echo "<p class=\"titredroite\">".NEWS."</p>";
    
    
    			while ($prod = mysql_fetch_array($qid)) { 
    
    
    			echo "<p align=\"center\">";
    
    
    			if (!empty($prod['image2'])) {
    
    
    				echo "<a href=\"achat/produit_details.php?id=".$prod['id']."\" alt=\"".$prod['nom_'.$_SESSION['langue'].'']."\" title=\"".$prod['nom_'.$_SESSION['langue'].'']."\">";
    
    
    				echo "<img class=\"searchImg\" width=\"130\" alt=\"\" title=\"&nbsp;\" src=\"".$repertoire_upload."/".$prod['image1']."\"
    
    				onmouseover=\"showtrail(
    
    							'".$repertoire_upload."/".$prod['image2']."',
    
    							'".$prod['nom_'.$_SESSION['langue'].'']."',
    
    							'".$prod['descriptif_'.$_SESSION['langue'].'']."',
    
    							'5.0000',
    
    							'1',
    
    							'1',
    
    							280,
    
    							1				);\"
    
    						onmouseout=\"hidetrail();\" /></a>";
    
    
    				} else { 
    
    
    					echo "<a href=\"achat/produit_details.php?id=".$prod['id']."\">";
    
    
    					echo (!empty($prod['image1'])) ? "<img src=\"$repertoire_upload/".$prod['image1']."\" width=\"130\" border=\"0\" title=\"".$prod['nom_'.$_SESSION['langue'].'']."\"/>" : "<img src=\"$repertoire_upload/pasimage.gif\" width=\"130\" alt=\"photo non disponible\" border=\"0\">";
    
    
    					echo "</a>";
    
    
    				}
    
    
    			echo "</p>";
    
    
    			}
    
    
    			echo "</td></tr></table>";
    
    
    		}
    
    }
    
    
    function template_index_produit_en_ligne(
    
    			$id,
    
    			$nom,
    
    			$promotion,
    
    			$descriptif,
    
    			$id_marque,
    
    			$image1,
    
    			$image2,
    
    			$prix,
    
    			$form) {
    
    
    global $wwwroot;
    
    global $dirroot;
    
    global $repertoire_images;
    
    global $repertoire_upload;
    
    
    				echo "<div class=\"col1\">";
    
    
    				echo "<a title=\"".$nom."\" href=\"achat/produit_details.php?id=".$id."\">";
    
    
    				if (!empty($image1)) {
    
    
    				$width = calcul_largeur_image($repertoire_upload."/".$image1);
    
    
    				$largeur = ($width >= 150) ? "150" : $width;
    
    
    				echo "<img src=\"$repertoire_upload/".$image1."\" width=\"$largeur\" border=\"0\" alt=\"".$nom."\"/>";
    
    
    				} else {
    
    
    				 echo "<img src=\"$wwwroot/images/photo-non-disponible.gif\" width=\"130\" alt=\"photo non disponible\" border=\"0\">";
    
    
    				}
    
    
    				echo "</a>";
    
    
    				echo (!empty($image2)) ? "<p class=\"retour\"><a href=\"".$repertoire_upload."/".$image2."\" rel=\"lightbox\" />zoom</a></p>" : "";
    
    
    				echo "</div>";
    
    
    				echo "<div class=\"col2\">";
    
    
    				echo "<h3>".$nom."</h3>";
    
    
    				echo (!empty($id_marque)) ? "<p class=\"retour\">".BRAND." : ".affiche_marque($id_marque)."</p>"  : "";
    
    
    				echo "<p class=\"retour\">".$descriptif."</p>";
    
    
    				echo "<p class=\"retour\"><img src=\"images/lirelasuite.gif\" class=\"alignerimage\" alt=\"".MORE."\" title=\"".MORE."\">&nbsp;<a href=\"achat/produit_details.php?id=".$id."\" title=\"".$nom."\">".MORE."</a></p>";
    
    
    				affiche_prix($id);
    
    
    				echo "</div>";
    
    
    				echo "<div class=\"col3\">";
    
    
    				  affiche_critere($id, $form);
    
    
    				if (est_identifie()) {
    
    
    					if (a_priv("admin")) {
    
    
    						echo "<p class=\#retour\"><a href=\"administrer/produits.php?mode=modif&id=".$id."\" class=\"label\">MODIFIER LE PRODUIT</a></p>";
    
    
    					}
    
    
    				}
    
    
    				echo "</div>";
    
    
    
    }
    
    
    
    
    
    
    function affiche_critere($prodId, $form) {
    
    
    global $wwwroot;
    
    global $repertoire_images;
    
    
    		$sqlProd = "SELECT on_stock, on_rupture, prix, promotion, tva, delai_stock, affiche_stock, stock FROM peel_produits WHERE id = '".$prodId."'";
    
    
    		$resProd = mysql_query($sqlProd);
    
    
    		$objProd = mysql_fetch_object($resProd);
    
    
    		/* Choix entre prix grossiste et prix public */
    
    		$prix = $objProd->prix * (1-$objProd->promotion/100);
    
    
    		$prix_barre =$objProd->prix;
    
    
    		echo "<form method=\"POST\" action=\"$wwwroot/achat/caddie_ajout.php\" name=\"".$form."ajout".$prodId."\">";
    
    
    				echo "<input type=\"hidden\" name=\"id\" value=\"".$prodId."\">";
    
    
    				echo "<input type=\"hidden\" value=\"".$prix."\" name=\"prix\">";
    
    
    				echo "<input type=\"hidden\" value=\"".$objProd->promotion."\" name=\"promotion\">";
    
    
    				echo "<input type=\"hidden\" value=\"".$objProd->tva."\" name=\"tva\">";
    
    
    				$couleur = mysql_query("SELECT c.id, c.nom_".$_SESSION['langue'].", pc.couleur_id FROM peel_couleurs c, peel_produits_couleurs pc WHERE c.id = pc.couleur_id AND pc.produit_id = '".$prodId."' ORDER BY position") 
    
    				or DIE('Une erreur de connexion &agrave; la base s est produite ' . __LINE__ . '.<p>' . MYSQL_ERROR());
    
    
    				if (mysql_num_rows($couleur) > 0) {
    
    
    					echo "<p class=\"retour\">".COLOR." : ";
    
    
    					echo "<select  name=\"couleur\">";
    
    
    						while ($col = mysql_fetch_array($couleur)) {
    
    
    							echo "<option value=\"".$col['id']."\">".stripslashes($col['nom_'.$_SESSION['langue'].''])."</option>";
    
    						}
    
    
    					echo "</select></p>";
    
    
    				} else {
    
    
    				echo "<input type=\"hidden\" value=\"\" name=\"couleur\">";
    
    
    				}
    
    
    				$sPrix = 0;
    
    
    				$taille = mysql_query("SELECT t.id, t.nom_".$_SESSION['langue'].", t.prix, pt.taille_id FROM peel_tailles t, peel_produits_tailles pt WHERE t.id = pt.taille_id AND pt.produit_id = '".$prodId."' ORDER BY t.prix, t.nom_".$_SESSION['langue']."") 
    
    				or DIE('Une erreur de connexion &agrave; la base s est produite ' . __LINE__ . '.<p>' . MYSQL_ERROR());
    
    
    				if (mysql_num_rows($taille) > 0) {
    
    
    					echo "<p class=\"retour\">".SIZE." : ";
    
    
    					echo "<select  name=\"taille\">";
    
    
    						while ($siz = mysql_fetch_array($taille)) {
    
    
    							echo "<option value=\"".$siz['id']."\">";
    
    
    							echo stripslashes($siz['nom_'.$_SESSION['langue'].'']);
    
    
    							if ($siz['prix'] != 0) { 
    
    
    							$sPrix = $siz["prix"] * (1-$objProd->promotion/100);
    
    
    							echo " : ".$sPrix." &euro; TTC";}
    
    
    							echo "</option>";
    
    						}
    
    
    					echo "</select></p>";
    
    
    				} else {
    
    
    				echo "<input type=\"hidden\" value=\"\" name=\"taille\">";
    
    
    				}
    
    
    				echo "<input type=\"hidden\" name=\"option\" value=\"".vn($sPrix)."\" />";
    
    
    				if ($objProd->on_stock == 1) {
    
    
    					echo (!empty($objProd->delai_stock)) ? "<p>Délai disponible : ".html_entity_decode($objProd->delai_stock)."</p>" : "";
    
    
    					echo ($objProd->affiche_stock == 1 ) ? "<p>Stock disponible : ".$objProd->stock."</p>" : "";
    
    
    				}
    
    
    				if ($objProd->on_rupture != 1) {
    
    
    				echo "<p class=\"retour\">".QUANTITY." : <input type=\"text\"  size=\"3\" name=\"qte\" value=\"1\" /></p>";
    
    
    				echo "<p class=\"retour\">";
    
    
    				echo "<input type=\"image\" src=\"http://www.vmfloc.com/boutik/images/panier.gif\" onClick=\"java script:document.".$form."ajout".$prodId.".submit()\"  value=\"".ADD_CART."\" title=\"".ADD_CART."\" alt=\"".ADD_CART."\" />";
    
    
    				} else {
    
    
    					echo "<div style=\"color:#990000;font-style:italic\">Ce produit est actuellement en rupture de stock. Vous ne pouvez pas le commander.</div>";
    
    
    				}
    
    
    				echo "</form>";
    
    }
    
    
    function affiche_prix($prodId) {
    
    
    global $wwwroot;
    
    global $repertoire_images;
    
    
    		$resProd = mysql_query("SELECT prix, promotion, tva, ecotaxe FROM peel_produits WHERE id = '".$prodId."'");
    
    
    		$objProd = mysql_fetch_object($resProd);
    
    
    		/* Choix entre prix grossiste et prix public */
    
    
    
    		if (isset($_SESSION['utilisateur']['priv']) && $_SESSION['utilisateur']['priv'] == "reve") {
    
    
    				$prix = $objProd->prix_revendeur * (1-$objProd->promotion/100);
    
    
    				$prix_barre = $objProd->prix_revendeur;
    
    
    		} else {
    
    
    				$prix = $objProd->prix * (1-$objProd->promotion/100);
    
    
    				$prix_barre = $objProd->prix;
    
    
    		}
    
    
    		$ecotaxe_ttc = $ecotaxe_ht = $objProd->ecotaxe;
    
    
    		$prix = $prix + $ecotaxe_ttc;
    
    
    		$prix_ht = $prix / (1+$objProd->tva/100);
    
    
    		$prix_barre_ht = $prix_barre / (1+$objProd->tva/100);
    
    
    		if ($prix !=0) {
    
    
    				if ($objProd->promotion != 0) {
    
    
    				echo "<del>".fprix($prix_barre)." ".$_SESSION['devise']['symbole']."</del> - ";
    
    
    				# echo PROMOTION." -&nbsp;".fprix($objProd->promotion)."%";
    
    
    				}
    
    
    			echo "<span class=\"prix\">".fprix($prix)." ".$_SESSION['devise']['symbole']."<abbr title=\"Toutes taxes comprises\">T.T.C</abbr></span>";
    
    
    			echo ($ecotaxe_ttc > 0) ? "<span class=\"ecotaxe\"><i> dont ecotaxe : ".fprix($ecotaxe_ttc)." ".$_SESSION['devise']['symbole']."</i></span>" : "";
    
    
    		}
    
    
    
    
    } 
    
    
    
    function affichage_fin_succes() {
    
    
    	global $commandeid;
    
    	global $wwwroot; 
    
    	global $email_paypal;
    
    	global $site;
    
    	global $support;
    
    
    	send_mail_order_admin($commandeid);
    
    
    	email_commande($commandeid);
    
    
    	$result = mysql_query("SELECT * FROM peel_commandes WHERE id ='".$commandeid."'");
    
    
    	$com = mysql_fetch_object($result);
    
    
    echo "<h2>&nbsp;".STEP3."</h2>"; 
    
    
    ?>
    
    
    <p>
    
    <?php
    
    
    echo MSG_THANKS;
    
    
    switch ($com->paiement) {
    
    
    case html_entity_decode(CHECK) :
    
    
    
    
    ?>
    
    </p>
    
    <p>- <?php echo PRINT_PROFORMA?> : <a href="<?php echo $wwwroot?>/factures/commande_pdf.php?code_facture=<?php echo $com->code_facture?>&mode=bdc"><?php echo CLICK_HERE?></a></p>
    
    <p>
    
    - <?php echo SEND_CHECK ?> :
    
    <?php
    
    print_societe();
    
    
    echo "</p>";
    
    
    break;
    
    
    case html_entity_decode(TRANSFER) :
    
    
    echo nl2br(SEND_TRANSFER);
    
    
    print_rib();
    
    
    break;
    
    
    case html_entity_decode(PAYPAL) :
    
    
    ?>
    
    <div id="center">
    
    Pour r&eacute;gler par carte bancaire, cliquez ici :<br />
    
    	<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
    
    		<INPUT TYPE="hidden" NAME="cmd" VALUE="_ext-enter">
    
    		<INPUT TYPE="hidden" NAME="redirect_cmd" VALUE="_xclick">
    
    		<input type="hidden" name="business" value="<?php echo $email_paypal?>">
    
    		<input type="hidden" name="item_name" value="<?php echo $site?> COMMANDE <?=$commandeid?>">
    
    		<input type="hidden" name="item_number" value="<?php echo $commandeid?>">
    
    		<input type="hidden" name="amount" value="<?php echo number_format($com->montant,2);?>">
    
    		<input type="hidden" name="page_style" value="Primary">
    
    		<input type="hidden" name="no_shipping" value="1">
    
    		<input type="hidden" name="return" value="<?php echo $wwwroot?>/modules/paypal/ok.php?id=<?=$commandeid?>">
    
    		<input type="hidden" name="cancel_return" value="<?php echo $wwwroot?>/modules/paypal/nok.php?id=<?=$commandeid?>">
    
    		<input type="hidden" name="no_note" value="1">
    
    		<input type="hidden" name="currency_code" value="<?php echo $_SESSION['devise']['code']?>">
    
    		<input type="hidden" name="lc" value="FR">
    
    		<input TYPE="hidden" NAME="email" VALUE="<?php echo $com->email?>">
    
    		<input type="image" src="https://www.paypal.com/fr_FR/i/btn/x-click-but23.gif" border="0" name="submit" alt="Effectuez vos paiements via PayPal : une solution rapide, gratuite et sécurisée !">
    
    		</form>
    
    		<br>
    
    		<img src="<?php echo $wwwroot?>/images/logo-xclickBox.gif" width="152" height="29" alt="" border="0">
    
    	</div>
    
    
    
    <?
    
    break;
    
    
    }
    
    
    echo "<fieldset>";
    
    
    affiche_resume_commande($commandeid, $affiche_statut=2);
    
    
    echo "</fieldset>";
    
    
    }  
    
    
    function send_mail_order_admin($commandeid) {
    
    
    	global $wwwroot; 
    
    	global $site;
    
    	global $support;
    
    
    	$result = mysql_query("SELECT * FROM peel_commandes WHERE id ='".$commandeid."'");
    
    
    	$com = mysql_fetch_object($result);
    
    
    	$message = "La commande $commandeid vient d'être enregistrée sur le site $site";
    
    	$message .= "\n\r";
    
    	$message .= "Email client : ".$com->email;
    
    	$message .= "\n\r";
    
    	$message .= "Référence commande : ".$com->id;
    
    	$message .= "\n\r";
    
    	$message .= "Montant de la commande : ".fprix($com->montant)." EUR";
    
    	$message .= "\n\r";
    
    	$message .= "Date de la commande : ".return_date_fr($com->o_timestamp);
    
    	$message .= "\n\r";
    
    	$message .= "Paiement : ".$com->paiement;
    
    	$message .= "\n\r";
    
    	$message .= "Merci de consulter l'interface d'administration de votre site.";
    
    
    	mail($support,"[$site] Enregistrement de la commande $commandeid",$message,"FROM:$support");
    
    
    }
    
    
    
    
    function affiche_menu_catalogue() {
    
    
    if (!isset($_GET['catid'])) { $catid = 0; } else {$catid = $_GET['catid']; }
    
    
    	$frm['parent'] = array($catid);
    
    
    	construit_menu_arborescent_cat($categorie_options, $frm['parent']);
    
    
    	echo $categorie_options;
    
    
    }	
    
    
    function affiche_menu_contenu() {
    
    
    	if (!isset($_GET['rubid'])) { $rubid = 0; } else {$rubid = intval($_GET['rubid']); }
    
    
    	$frm['parent'] = array($rubid);
    
    
    	construit_menu_arborescent_rub($rubrique_options, $frm['parent']);
    
    
    	echo $rubrique_options;
    
    
    }	
    
    
    /******************************************/
    
    /* Affichage des produits en mode colonne */
    
    /******************************************/
    
    
    function affiche_produit_en_colonne($catid) {
    
    
    global $repertoire_modele;
    
    global $repertoire_upload;
    
    global $repertoire_images;
    
    global $wwwroot;
    
    
    $Links = new MultiPage();
    
    $Links-> ResultPerPage = 50;
    
    $Links-> LinkPerPage   = 15;
    
    $Links-> Template	   = "tpl1.htm";
    
    
    $tri = (isset($_GET['tri'])) ? $_GET['tri'] : "position";
    
    
    $tables = "peel_produits p";
    
    
    $inner_table = "INNER JOIN peel_produits_categories pc ON (pc.produit_id = p.id)";
    
    
    $champs = "p.id, p.nom_".$_SESSION['langue']." as nom, p.promotion, p.descriptif_".$_SESSION['langue']." as descriptif, p.id_marque, p.image1, p.image2, p.prix";
    
    
    $contrainte = "AND p.id = pc.produit_id AND pc.categorie_id = '$catid'";
    
    
    $tri = "ORDER BY p.".$tri.", p.id";
    
    
    $Links-> SqlRequest = "SELECT ".$champs." FROM ".$tables." ".$inner_table." WHERE p.etat = '1' AND 1 ".$contrainte." ".$tri;
    
    
    $Links-> Initialize();
    
    
    $result=mysql_query($Links-> LimitSQL) or die('Une erreur de connexion &agrave; la base s est produite ' . __LINE__ . '.<p>' . mysql_error());
    
    
    if (mysql_num_rows($result) == 0) { 
    
    
    	echo "<h3>".NO_INDEX_PRODUCT."</h3>";
    
    
    } else {
    
    
    echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"1\" width=\"100%\">";
    
    
    $nb_cellules = mysql_num_rows($result);
    
    
    $nb_colonnes = 2;
    
    
    $j = 0;
    
    
    while($prod=mysql_fetch_array($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 class=\"produit2col bordure\">"; } else { echo "<td class=\"produit2col\">"; }
    
    
    			affiche_produit_catalogue(
    
    			intval($prod['id'])
    
    			,html_entity_decode($prod['nom'])
    
    			, $prod['promotion']
    
    			,html_entity_decode($prod['descriptif'])
    
    			,intval($prod['id_marque'])
    
    			,$prod['image1']
    
    			,$prod['image2']
    
    			,$prod['prix']
    
    			, $form = "catalogue");
    
    
    			} 
    
    
    			echo "</td>";
    
    
    			$j++;	
    
    
    			if ( $j % $nb_colonnes == 0 OR $j == $nb_cellules ) {
    
    
    			echo "</tr>";
    
    
    			}
    
    
    			} 
    
    
    
    echo "<tr><td align=\"center\" class=\"normal\" colspan=\"2\">";
    
    
    $Links-> pMultipage();
    
    
    echo "</td></tr></table>";
    
    
    }
    
    
    
    }
    
    
    /******************************************/
    
    /* Affichage des produits en mode listing */
    
    /******************************************/
    
    
    function affiche_produit_en_ligne($catid) {
    
    
    $Links = new MultiPage();
    
    $Links-> ResultPerPage = $_SESSION['ecom']['nb_produit_page'];
    
    $Links-> LinkPerPage   = 15;
    
    $Links-> Template	   = "tpl1.htm";
    
    
    $tri = (isset($_GET['tri'])) ? $_GET['tri'] : "position";
    
    
    $tables = "peel_produits p, peel_produits_categories pc";
    
    
    $champs = "p.id, p.nom_".$_SESSION['langue']." as nom, p.promotion, p.descriptif_".$_SESSION['langue']." as descriptif, p.id_marque, p.image1, p.image2, p.prix";
    
    
    $contrainte = "AND p.id = pc.produit_id AND pc.categorie_id = '$catid'";
    
    
    $tri = "ORDER BY p.".$tri.", p.id";
    
    
    $Links-> SqlRequest = "SELECT ".$champs." FROM ".$tables." WHERE p.etat = '1' AND 1 ".$contrainte." ".$tri;
    
    
    $Links-> Initialize();
    
    
    $result=mysql_query($Links-> LimitSQL) or die('Une erreur de connexion &agrave; la base s est produite ' . __LINE__ . '.<p>' . mysql_error());
    
    
    if (mysql_num_rows($result) == 0) { 
    
    
    	echo "<h3>".NO_INDEX_PRODUCT."</h3>";
    
    
    } else {
    
    
    echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"1\" width=\"100%\">";
    
    
    $nb_cellules = mysql_num_rows($result);
    
    
    $nb_colonnes = 2;
    
    
    $j = 0;
    
    
    while($prod=mysql_fetch_array($result)) 
    
    {
    
    
    echo "<tr>";
    
    
    echo "<td>";
    
    
    template_index_produit_en_ligne(
    
    	intval($prod['id']),
    
    	html_entity_decode($prod['nom']),
    
    	$prod['promotion'],
    
    	html_entity_decode($prod['descriptif']),
    
    	intval($prod['id_marque']),
    
    	$prod['image1'],
    
    	$prod['image2'],
    
    	$prod['prix'],
    
    	$form = "catalogue");
    
    
    echo "</td></tr>";
    
    
    } 
    
    
    echo "<tr><td align=\"center\" class=\"normal\">";
    
    
    $Links-> pMultipage();
    
    
    echo "</td></tr></table>";
    
    
    }
    
    
    }
    
    
    /********************************/
    
    /* Affiche la marque du produit */
    
    /********************************/
    
    
    function affiche_marque($id_marque) {
    
    
    global $wwwroot;
    
    
    $sql = "SELECT id, nom_".$_SESSION['langue']." as marque, image FROM peel_marques WHERE id = '".intval($id_marque)."'";
    
    
    $query = mysql_query($sql);
    
    
    if (mysql_num_rows($query) > 0) {
    
    
    	$brand = mysql_fetch_object($query);
    
    
    	echo "<h3>".BRAND." : <a href=\"$wwwroot/achat/marque.php?id=".$brand->id."\"><b>".html_entity_decode($brand->marque)."</b></a></h3>";
    
    
    }
    
    
    }
    
    
    function affiche_menu_recherche() {
    
    
    global $wwwroot;
    
    global $repertoire_images;
    
    ?>
    
    <form method="get" action="<?php echo $wwwroot ?>/search.php" id="recherche" name="searchform">
    
    	<input type="hidden" name="mode" value="1">
    
    	<input type="hidden" name="match" value="1">
    
    	<input type="text" name="search" id="foo" value="" onkeyup="loadData();" style="width:120px;"/>
    
    	<input type="submit" class="bouton" value="Go" name="action" />
    
    </form>
    
    <p><div id="placement_produit"></div></p>
    
    
    <?php
    
    }
    
    
    function affiche_select_categorie() {
    
    
    ?>
    
    <select onChange="java script:gotocategorie(this.options[this.selectedIndex].value)" style="width:175px;">
    
    		<option><?echo SEARCH_CATEGORY ?></option>
    
    		<?php
    
    
    		$frm['categories_select'] = array();
    
    
    		construit_arbo_cat_fo($categorie_options_select, $frm['categories_select']);
    
    
    		echo $categorie_options_select;
    
    
    		?>
    
    	</select>
    
    
    
    <?php
    
    
    }
    
    
    function affiche_select_marque() {
    
    
    global $wwwroot;
    
    
    $query = mysql_query("SELECT id, nom_".$_SESSION['langue']." as marque FROM peel_marques ORDER BY position") or die('Une erreur de connexion &agrave; la base s est produite ' . __LINE__ . '.<p>' . mysql_error());
    
    
    if (mysql_num_rows($query) > 0) {
    
    
    ?>
    
    
    	<select name="brand" onChange="java script:gotobrand(this.options[this.selectedIndex].value)" style="width:175px;">
    
    	<option value=""><?php echo SEARCH_BRAND?></option>
    
    	<?php
    
    
    	while ($brand = mysql_fetch_array($query)) {
    
    
    	echo "<option value=\"".$brand['id']."\">".html_entity_decode($brand['marque'])."</a><br />";
    
    
    	}
    
    
    	?>
    
    	</select>
    
    <?php	
    
    
    }
    
    
    }
    
    
    
    function affiche_filtre() {
    
    
    global $module_filtre;
    
    
    
    if ($module_filtre == 1) {
    
    ?>
    
    
    <select name="filtre" onChange="java script:gotoself(this.options[this.selectedIndex].value)">
    
    	<option value=""><?php echo CLASSERPAR ?></option>
    
    	<option value="catid=<?php echo vn($_GET['catid']) ?>&page=<?php echo vn($_GET['page']) ?>&tri=reference"><?php echo REFERENCE?></option>
    
    	<option value="catid=<?php echo vn($_GET['catid']) ?>&page=<?php echo vn($_GET['page']) ?>&tri=nom_<?php echo $_SESSION['langue']?>"><?php echo ITEM?></option>
    
    	<option value="catid=<?php echo vn($_GET['catid']) ?>&page=<?php echo vn($_GET['page']) ?>&tri=prix"><?php echo PRICE?></option>	
    
    </select>
    
    
    <?php
    
    
    }
    
    
    }
    
    
    function affiche_sous_categorie() {
    
    global $repertoire_upload;
    
    global $wwwroot;
    
    $qid_c = recupere_sous_categorie(vn($_GET['catid']));
    
    
    if (mysql_num_rows($qid_c) > 0) { 
    
    
    
    		echo "<table border=\"0\" cellpadding=\"5\" cellspacing=\"0\" width=\"100%\">";
    
    
    		$nb_cellules = mysql_num_rows($qid_c);
    
    
    		$nb_colonnes = 3;
    
    
    		$j = 0;
    
    
    		while ($cat = mysql_fetch_array($qid_c)) { 
    
    
    		if ( $j % $nb_colonnes == 0 ) { echo "<tr>"; }
    
    
    		if($j % $nb_colonnes !=0 OR $j % $nb_colonnes == 0 ) {
    
    
    		echo "<td width=\"33%\" align=\"center\">"; 
    
    
    		?>
    
    
    		<a href="<?=$_SERVER['PHP_SELF']?>?catid=<?=$cat['id'] ?>">
    
    
    		<?php
    
    
    		if (!empty($cat['image'])) { 
    
    
    			$width = calcul_largeur_image($repertoire_upload."/".$cat['image']);
    
    
    			$largeur = ($width >= 150) ? "150" : $width;
    
    
    			echo "<img src=\"$repertoire_upload/".$cat['image']."\" width=\"$largeur\" border=\"0\" alt=\"".html_entity_decode($cat['nom_'.$_SESSION['langue'].''])."\"/>";
    
    
    			echo "<br />".html_entity_decode($cat['nom_'.$_SESSION['langue'].'']);
    
    
    		} else {
    
    
    			echo html_entity_decode($cat['nom_'.$_SESSION['langue'].'']);
    
    
    		}
    
    
    		?>
    
    
    		</a>
    
    
    		<? 
    
    
    		} 
    
    
    		echo "</td>";
    
    
    		$j++;	
    
    
    		if ( $j % $nb_colonnes == 0 OR $j == $nb_cellules ) {
    
    
    		echo "</tr>";
    
    
    		}
    
    
    		} 
    
    		echo "</table>"; 
    
    
    }
    
    
    }
    
    
    function recupere_sous_categorie($catid=0) { 
    
    
    	$qid = mysql_query("SELECT id, nom_".$_SESSION['langue'].", description_".$_SESSION['langue'].", parent_id, image  FROM peel_categories WHERE parent_id = '$catid' AND id > '0' AND etat = '1' ORDER BY position") 
    
    	or DIE('Une erreur de connexion &agrave; la base s est produite ' . __LINE__ . '.<p>' . MYSQL_ERROR()); 
    
    	return $qid; 
    
    
    } 
    
    
    
    function affiche_compte() {
    
    
    global  $wwwroot;
    
    
    if (est_identifie()) { ?>
    
    
    	- <a href="<?php echo $wwwroot ?>/compte.php"><?php echo COMPTE?></a><br />
    
    	- <a href="<?php echo $wwwroot ?>/utilisateurs/change_params.php"><?php echo CHANGE_PARAMS?></a><br />	
    
    	- <a href="<?php echo $wwwroot ?>/achat/historique_commandes.php"><?php echo ORDER_HISTORY?></a><br />	
    
    
    <?php } else { ?>
    
    
    	- <a href="<?php echo $wwwroot ?>/membre.php"><?php echo LOGIN?></a><br />
    
    	- <a href="<?php echo $wwwroot ?>/utilisateurs/enregistrement.php"><?php echo REGISTER?></a><br />	
    
    
    
    <?php
    
    
    }
    
    
    }
    
    
    function affiche_billet_accueil() {
    
    
    global $wwwroot;
    
    global $repertoire_upload;
    
    
    $result=mysql_query("SELECT p.id, p.surtitre_".$_SESSION['langue'].", p.titre_".$_SESSION['langue'].", p.chapo_".$_SESSION['langue'].", p.texte_".$_SESSION['langue'].", p.image1, p.on_special FROM peel_articles p WHERE p.id_site = '".intval($_SESSION['ecom']['id'])."' AND p.etat = '1' AND p.on_special = '1' ORDER BY p.date_maj DESC"); 
    
    
    			if (mysql_num_rows($result) > 0) {
    
    
    			echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"5\" width=\"100%\" align=\"center\">";
    
    
    			while($prod=mysql_fetch_array($result)) 
    
    
    			{
    
    
    			echo "<tr>";
    
    
    			if (!empty($prod['image1'])) {
    
    
    				echo "<td>";
    
    
    				$width = calcul_largeur_image($repertoire_upload."/".$prod['image1']);
    
    
    				$largeur = ($width >= 150) ? "150" : $width;
    
    
    				echo "<img src=\"$repertoire_upload/".$prod['image1']."\" width=\"$largeur\" align=\"left\" />";
    
    
    				echo "</td>";
    
    				}	
    
    
    
    				echo "<td valign=\"top\" colspan=\"2\">";	
    
    
    				echo "<a href=".$wwwroot."/lire/article_details.php?id=".$prod['id'].">";
    
    
    				echo "<b>".html_entity_decode($prod['titre_'.$_SESSION['langue'].''])."</b>";
    
    
    				echo "</a>";
    
    
    				echo "<p>".nl2br(html_entity_decode($prod['chapo_'.$_SESSION['langue'].'']))."</p>";
    
    
    				if (!empty($prod['texte_'.$_SESSION['langue'].''])) {
    
    
    				echo "<div align=\"right\"><a href=".$wwwroot."/lire/article_details.php?id=".$prod['id'].">".MORE."</a></div>";
    
    
    				}
    
    
    				echo "</td></tr>";
    
    
    			}
    
    
    			echo "</table>";
    
    
    			}
    
    
    }
    
    
    function affiche_paiement() {
    
    
    $sql = "SELECT nom_".$_SESSION['langue']." as paiement FROM peel_paiement ORDER BY position";
    
    
    $query = mysql_query($sql);
    
    
    echo "<ul><b>Paiement acceptés :</b> ";
    
    
    while ($r = mysql_fetch_array($query)) {
    
    
    	echo "<li>".html_entity_decode($r['paiement'])."</li>";
    
    
    }	
    
    
    echo "</ul>";
    
    
    }
    
    
    function affiche_transport() {
    
    
    $sql = "SELECT nom_".$_SESSION['langue']." as transport FROM peel_types ORDER BY position";
    
    
    $query = mysql_query($sql);
    
    
    echo "<ul><b>Nos modes d'expédition :</b> ";
    
    
    while ($r = mysql_fetch_array($query)) {
    
    
    	echo "<li>".html_entity_decode($r['transport'])."</li>";
    
    
    }	
    
    
    echo "</ul>";
    
    
    }
    
    
    function affiche_produit_catalogue(
    
    $id, $nom, $promotion, $descriptif, $id_marque, $image1, $image2, $prix)
    
    
    {
    
    global $wwwroot;
    
    global $repertoire_upload;
    
    ?>
    
    <table class="fc">
    
    <tr><td colspan="2" class="fc_titre_produit"><?php echo ucfirst($nom) ?></td></tr>
    
    <tr><td colspan="2" class="fc_prix"><?php affiche_prix($id); ?></td></tr>
    
    <tr><td colspan="2" class="fc_image">
    
    
    <a title="<?php echo $nom?>" alt="<?php echo $nom?>" href="achat/produit_details.php?id=<?php echo $id?>">
    
    
    <?php		
    
    
    if (!empty($image1)) {
    
    
    	$width = calcul_largeur_image($repertoire_upload."/".$image1);
    
    
    	$largeur = ($width >= 250) ? "250" : $width;
    
    
    ?>	
    
    
    <img src="<?php echo $repertoire_upload."/".$image1 ?>" width="<?php echo $largeur ?>" border="0" alt="<?php echo $nom?>" />
    
    
    <?php } else { ?>
    
    
    <img src="<?php echo $wwwroot?>/images/photo-non-disponible.gif" width="130" alt="photo non disponible" border="0">
    
    
    <?php } ?>
    
    
    </a>
    
    
    </td>
    
    </tr>
    
    <tr>
    
    <td class="fc_zoom">
    
    <?php 
    
    
    echo (!empty($image2)) ? "<a href=\"".$repertoire_upload."/".$image2."\" rel=\"lightbox\" class=\"zoom\" />zoom</a>" : "<a class=\"zoom\" href=\"".$repertoire_upload."/".$image1."\" rel=\"lightbox\" />zoom</a>";
    
    
    ?>
    
    </a>
    
    </td>
    
    <td class="fc_detail">
    
    <a class="plus_detail" href="achat/produit_details.php?id=<?php echo $id ?>" title="<?php echo $nom ?>"><?php echo MORE ?></a>
    
    </td>
    
    </tr>
    
    </table>
    
    <?php
    
    
    }
    
    
    ?>

    @ +

  2. abelazi


    Bonjour,

    merci pour la réponse. Mais dan fichier template.php j'ai pas les même code que vous.

    Voici ce qu'il y a dans ce fichier template.php:

    ---------

    <?php
    
    
    /**********************************/
    
    /* FONCTIONS DE LA PAGE D ACCUEIL */
    
    /**********************************/
    
    
    
    function affiche_categorie_accueil() {
    
    /* Affiche la liste des cat&eacute;gories qui sont sp&eacute;ciales */
    
    	global $wwwroot, $repertoire_modele, $repertoire_upload;
    
    
    	$qid = mysql_query("SELECT c.id, c.nom_".$_SESSION['langue']." as categorie, c.image FROM peel_categories c WHERE c.etat = '1' AND c.on_special = '1' ORDER BY c.position") or DIE('Une erreur de connexion &agrave; la base s est produite ' . __LINE__ . '.<p>' . MYSQL_ERROR());
    
    
    	if (mysql_num_rows($qid) > 0) { 
    
    
    	$nb_cellules = mysql_num_rows($qid);
    
    
    	$nb_colonnes = 2;
    
    
    	echo "<h2>".CATALOG."</h2>";
    
    
    	echo "<table align=\"center\" border=\"0\" cellspacing=\"5\" cellpadding=\"0\" width=\"100%\">";
    
    
    	$j = 0;
    
    
    			while ($cat = mysql_fetch_array($qid)) 
    
    			{
    
    			if ( $j % $nb_colonnes == 0 ) {
    
    			echo "<tr>";
    
    			}
    
    			if($j % $nb_colonnes !=0 OR $j % $nb_colonnes == 0 ) {
    
    			// on affiche une cellule
    
    			echo "<td width=\"50%\" align=\"center\">";
    
    
    			echo "<p><a href=\"achat/index.php?catid=".$cat['id']."\">".html_entity_decode($cat['categorie'])."</a></p>";
    
    
    			if (!empty($cat['image'])) {
    
    
    				$width = calcul_largeur_image($repertoire_upload."/".$cat['image']);
    
    
    				$largeur = ($width >= 150) ? "150" : $width;
    
    
    				echo "<p><img src=\"$repertoire_upload/".$cat['image']."\" width=\"$largeur\" border=\"0\" alt=\"".html_entity_decode($cat['categorie'])."\"  title=\"".html_entity_decode($cat['categorie'])."\" /></p>";
    
    
    			}
    
    
    			} 
    
    
    			echo "</td>";
    
    
    			$j++;	
    
    
    			if ( $j % $nb_colonnes == 0 OR $j == $nb_cellules ) {
    
    
    				echo "</tr>";
    
    
    			}
    
    
    		} 
    
    
    	echo "</table>";
    
    
    
    }
    
    }
    
    
    function print_actu() {
    
    
    				global $wwwroot;
    
    				global $repertoire_upload;
    
    
    				$sql_ACTU = "SELECT p.id, p.surtitre_".$_SESSION['langue'].", p.titre_".$_SESSION['langue'].", p.chapo_".$_SESSION['langue'].", p.texte_".$_SESSION['langue']."
    
    				, p.image1, p.on_special, p.date_maj, pc.rubrique_id 
    
    				FROM peel_articles p, peel_articles_rubriques pc WHERE p.id = pc.article_id AND p.on_special = '1' AND p.etat = '1' ORDER BY p.date_maj DESC LIMIT 0,1";
    
    
    				$query_ACTU = mysql_query($sql_ACTU) or DIE('Une erreur de connexion &agrave; la base s est produite ' . __LINE__ . '.<p>' . MYSQL_ERROR());
    
    
    				if (mysql_num_rows($query_ACTU) > 0) {
    
    
    					echo "<table align=\"center\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">";
    
    
    					while ($art = mysql_fetch_array($query_ACTU)) {
    
    
    						echo "<tr>";
    
    
    						  echo "<td>";
    
    
    						echo "<h2>".html_entity_decode($art['titre_'.$_SESSION['langue'].''])."</h2>";
    
    
    						echo "<p>".date("d-m-Y")."</p>";
    
    
    						if (!empty($art['image1'])) {
    
    
    							echo "<img src=\"$repertoire_upload/".$art['image1']."\" align=\"left\">";
    
    
    						}
    
    
    						echo nl2br(html_entity_decode($art['chapo_'.$_SESSION['langue'].'']));
    
    
    						  echo "</td></tr>";
    
    
    					}
    
    
    					echo "</table>";
    
    
    				}
    
    
    } 
    
    
    
    function affiche_produit_colonne($cond, $titre) {
    
    /* Affiche la liste des cat&eacute;gories qui sont sp&eacute;ciales */
    
    	global $wwwroot;
    
    	global $repertoire_upload;
    
    	global $repertoire_images;
    
    
    	$requete = "SELECT p.id, p.nom_".$_SESSION['langue'].", p.image1, p.prix, p.promotion FROM peel_produits p WHERE ".$cond." AND p.etat = '1' LIMIT 0,2";
    
    
    	$qid = mysql_query($requete);
    
    
    	if (mysql_num_rows($qid) > 0) { 
    
    
    			$i = 1;
    
    
    			echo "<div id=\"top\">";
    
    
    			while ($prod = mysql_fetch_array($qid)) { 
    
    			?>
    
    
    			<h3><a href="achat/produit_details.php?id=<? echo $prod["id"] ?>" title="<?php echo html_entity_decode($prod['nom_'.$_SESSION['langue'].''])?>"><?php echo html_entity_decode($prod['nom_'.$_SESSION['langue'].''])?></a></h3>
    
    
    			<?php if (!empty($prod["image1"])) {
    
    
    			$width = calcul_largeur_image($repertoire_upload."/".$prod["image1"]);
    
    
    			$largeur = ($width >= 120) ? "120" : $width;
    
    
    			?>
    
    
    			<p><a href="achat/produit_details.php?id=<? echo $prod["id"] ?>" title="<?php echo html_entity_decode($prod['nom_'.$_SESSION['langue'].''])?>">	
    
    
    			<img src="<? echo $repertoire_upload?>/<?echo $prod["image1"]?>" width="<?php echo $largeur?>" align="center" border="0" alt="<?php echo html_entity_decode($prod['nom_'.$_SESSION['langue'].''])?>">
    
    
    			</a>
    
    
    			</p>
    
    
    			<?php } ?>
    
    
    			<p><?php affiche_prix($prod["id"])?></p>
    
    
    			<p><a href="achat/produit_details.php?id=<? echo $prod["id"] ?>" title="<?php echo html_entity_decode($prod['nom_'.$_SESSION['langue'].''])?>"><?echo MORE ?></a></p>
    
    
    			<?php
    
    
    			$i++;
    
    			}
    
    
    			echo "</div>";
    
    
    
    	}
    
    }
    
    
    
    
    function print_new() {
    
    
    	global $wwwroot;
    
    	global $repertoire_upload;
    
    
    	$qid = mysql_query("SELECT p.id, p.nom_".$_SESSION['langue'].", p.descriptif_".$_SESSION['langue'].", p.image1, p.image2 FROM peel_produits p INNER JOIN peel_sites_pivots sp ON (sp.produit_id = p.id) WHERE sp.site_id = '".intval($_SESSION['ecom']['id'])."' AND p.on_new = '1' AND p.etat = '1'	LIMIT 0,2") or DIE('Une erreur de connexion &agrave; la base s est produite ' . __LINE__ . '.<p>' . MYSQL_ERROR());
    
    
    	if (mysql_num_rows($qid) > 0) { 
    
    
    			echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"150\" style=\"background:#cccccc\">";
    
    
    			echo "<tr><td valign=\"top\">";
    
    
    			echo "<p class=\"titredroite\">".NEWS."</p>";
    
    
    			while ($prod = mysql_fetch_array($qid)) { 
    
    
    			echo "<p align=\"center\">";
    
    
    			if (!empty($prod['image2'])) {
    
    
    				echo "<a href=\"achat/produit_details.php?id=".$prod['id']."\" alt=\"".$prod['nom_'.$_SESSION['langue'].'']."\" title=\"".$prod['nom_'.$_SESSION['langue'].'']."\">";
    
    
    				echo "<img class=\"searchImg\" width=\"130\" alt=\"\" title=\"&nbsp;\" src=\"".$repertoire_upload."/".$prod['image1']."\"
    
    				onmouseover=\"showtrail(
    
    							'".$repertoire_upload."/".$prod['image2']."',
    
    							'".$prod['nom_'.$_SESSION['langue'].'']."',
    
    							'".$prod['descriptif_'.$_SESSION['langue'].'']."',
    
    							'5.0000',
    
    							'1',
    
    							'1',
    
    							280,
    
    							1				);\"
    
    						onmouseout=\"hidetrail();\" /></a>";
    
    
    				} else { 
    
    
    					echo "<a href=\"achat/produit_details.php?id=".$prod['id']."\">";
    
    
    					echo (!empty($prod['image1'])) ? "<img src=\"$repertoire_upload/".$prod['image1']."\" width=\"130\" border=\"0\" title=\"".$prod['nom_'.$_SESSION['langue'].'']."\"/>" : "<img src=\"$repertoire_upload/pasimage.gif\" width=\"130\" alt=\"photo non disponible\" border=\"0\">";
    
    
    					echo "</a>";
    
    
    				}
    
    
    			echo "</p>";
    
    
    			}
    
    
    			echo "</td></tr></table>";
    
    
    		}
    
    }
    
    
    function template_index_produit_en_ligne(
    
    			$id,
    
    			$nom,
    
    			$promotion,
    
    			$descriptif,
    
    			$id_marque,
    
    			$image1,
    
    			$image2,
    
    			$prix,
    
    			$form) {
    
    
    global $wwwroot;
    
    global $dirroot;
    
    global $repertoire_images;
    
    global $repertoire_upload;
    
    
    				echo "<div class=\"col1\">";
    
    
    				echo "<a title=\"".$nom."\" href=\"achat/produit_details.php?id=".$id."\">";
    
    
    				if (!empty($image1)) {
    
    
    				$width = calcul_largeur_image($repertoire_upload."/".$image1);
    
    
    				$largeur = ($width >= 150) ? "150" : $width;
    
    
    				echo "<img src=\"$repertoire_upload/".$image1."\" width=\"$largeur\" border=\"0\" alt=\"".$nom."\"/>";
    
    
    				} else {
    
    
    				 echo "<img src=\"$wwwroot/images/photo-non-disponible.gif\" width=\"130\" alt=\"photo non disponible\" border=\"0\">";
    
    
    				}
    
    
    				echo "</a>";
    
    
    				echo (!empty($image2)) ? "<p class=\"retour\"><a href=\"".$repertoire_upload."/".$image2."\" rel=\"lightbox\" />zoom</a></p>" : "";
    
    
    				echo "</div>";
    
    
    				echo "<div class=\"col2\">";
    
    
    				echo "<h3>".$nom."</h3>";
    
    
    				echo (!empty($id_marque)) ? "<p class=\"retour\">".BRAND." : ".affiche_marque($id_marque)."</p>"  : "";
    
    
    				echo "<p class=\"retour\">".$descriptif."</p>";
    
    
    				echo "<p class=\"retour\"><img src=\"images/lirelasuite.gif\" class=\"alignerimage\" alt=\"".MORE."\" title=\"".MORE."\">&nbsp;<a href=\"achat/produit_details.php?id=".$id."\" title=\"".$nom."\">".MORE."</a></p>";
    
    
    				affiche_prix($id);
    
    
    				echo "</div>";
    
    
    				echo "<div class=\"col3\">";
    
    
    				  affiche_critere($id, $form);
    
    
    				if (est_identifie()) {
    
    
    					if (a_priv("admin")) {
    
    
    						echo "<p class=\#retour\"><a href=\"administrer/produits.php?mode=modif&id=".$id."\" class=\"label\">MODIFIER LE PRODUIT</a></p>";
    
    
    					}
    
    
    				}
    
    
    				echo "</div>";
    
    
    
    }
    
    
    
    
    
    
    function affiche_critere($prodId, $form) {
    
    
    global $wwwroot;
    
    global $repertoire_images;
    
    
    		$sqlProd = "SELECT on_stock, on_rupture, prix, promotion, tva, delai_stock, affiche_stock, stock FROM peel_produits WHERE id = '".$prodId."'";
    
    
    		$resProd = mysql_query($sqlProd);
    
    
    		$objProd = mysql_fetch_object($resProd);
    
    
    		/* Choix entre prix grossiste et prix public */
    
    		$prix = $objProd->prix * (1-$objProd->promotion/100);
    
    
    		$prix_barre =$objProd->prix;
    
    
    		echo "<form method=\"POST\" action=\"$wwwroot/achat/caddie_ajout.php\" name=\"".$form."ajout".$prodId."\">";
    
    
    				echo "<input type=\"hidden\" name=\"id\" value=\"".$prodId."\">";
    
    
    				echo "<input type=\"hidden\" value=\"".$prix."\" name=\"prix\">";
    
    
    				echo "<input type=\"hidden\" value=\"".$objProd->promotion."\" name=\"promotion\">";
    
    
    				echo "<input type=\"hidden\" value=\"".$objProd->tva."\" name=\"tva\">";
    
    
    				$couleur = mysql_query("SELECT c.id, c.nom_".$_SESSION['langue'].", pc.couleur_id FROM peel_couleurs c, peel_produits_couleurs pc WHERE c.id = pc.couleur_id AND pc.produit_id = '".$prodId."' ORDER BY position") 
    
    				or DIE('Une erreur de connexion &agrave; la base s est produite ' . __LINE__ . '.<p>' . MYSQL_ERROR());
    
    
    				if (mysql_num_rows($couleur) > 0) {
    
    
    					echo "<p class=\"retour\">".COLOR." : ";
    
    
    					echo "<select  name=\"couleur\">";
    
    
    						while ($col = mysql_fetch_array($couleur)) {
    
    
    							echo "<option value=\"".$col['id']."\">".stripslashes($col['nom_'.$_SESSION['langue'].''])."</option>";
    
    						}
    
    
    					echo "</select></p>";
    
    
    				} else {
    
    
    				echo "<input type=\"hidden\" value=\"\" name=\"couleur\">";
    
    
    				}
    
    
    				$sPrix = 0;
    
    
    				$taille = mysql_query("SELECT t.id, t.nom_".$_SESSION['langue'].", t.prix, pt.taille_id FROM peel_tailles t, peel_produits_tailles pt WHERE t.id = pt.taille_id AND pt.produit_id = '".$prodId."' ORDER BY t.prix, t.nom_".$_SESSION['langue']."") 
    
    				or DIE('Une erreur de connexion &agrave; la base s est produite ' . __LINE__ . '.<p>' . MYSQL_ERROR());
    
    
    				if (mysql_num_rows($taille) > 0) {
    
    
    					echo "<p class=\"retour\">".SIZE." : ";
    
    
    					echo "<select  name=\"taille\">";
    
    
    						while ($siz = mysql_fetch_array($taille)) {
    
    
    							echo "<option value=\"".$siz['id']."\">";
    
    
    							echo stripslashes($siz['nom_'.$_SESSION['langue'].'']);
    
    
    							if ($siz['prix'] != 0) { 
    
    
    							$sPrix = $siz["prix"] * (1-$objProd->promotion/100);
    
    
    							echo " : ".$sPrix." &euro; TTC";}
    
    
    							echo "</option>";
    
    						}
    
    
    					echo "</select></p>";
    
    
    				} else {
    
    
    				echo "<input type=\"hidden\" value=\"\" name=\"taille\">";
    
    
    				}
    
    
    				echo "<input type=\"hidden\" name=\"option\" value=\"".vn($sPrix)."\" />";
    
    
    				if ($objProd->on_stock == 1) {
    
    
    					echo (!empty($objProd->delai_stock)) ? "<p>Délai disponible : ".html_entity_decode($objProd->delai_stock)."</p>" : "";
    
    
    					echo ($objProd->affiche_stock == 1 ) ? "<p>Stock disponible : ".$objProd->stock."</p>" : "";
    
    
    				}
    
    
    				if ($objProd->on_rupture != 1) {
    
    
    				echo "<p class=\"retour\">".QUANTITY." : <input type=\"text\"  size=\"3\" name=\"qte\" value=\"1\" /></p>";
    
    
    				echo "<p class=\"retour\">";
    
    
    				echo "<input type=\"submit\" class=\"bouton\" onClick=\"java script:document.".$form."ajout".$prodId.".submit()\" value=\"".ADD_CART."\" title=\"".ADD_CART."\" alt=\"".ADD_CART."\" />";
    
    
    				} else {
    
    
    					echo "<div style=\"color:#990000;font-style:italic\">Ce produit est actuellement en rupture de stock. Vous ne pouvez pas le commander.</div>";
    
    
    				}
    
    
    				echo "</form>";
    
    }
    
    
    function affiche_prix($prodId) {
    
    
    global $wwwroot;
    
    global $repertoire_images;
    
    
    		$resProd = mysql_query("SELECT prix, promotion, tva, ecotaxe FROM peel_produits WHERE id = '".$prodId."'");
    
    
    		$objProd = mysql_fetch_object($resProd);
    
    
    		/* Choix entre prix grossiste et prix public */
    
    
    
    		if (isset($_SESSION['utilisateur']['priv']) && $_SESSION['utilisateur']['priv'] == "reve") {
    
    
    				$prix = $objProd->prix_revendeur * (1-$objProd->promotion/100);
    
    
    				$prix_barre = $objProd->prix_revendeur;
    
    
    		} else {
    
    
    				$prix = $objProd->prix * (1-$objProd->promotion/100);
    
    
    				$prix_barre = $objProd->prix;
    
    
    		}
    
    
    		$ecotaxe_ttc = $ecotaxe_ht = $objProd->ecotaxe;
    
    
    		$prix = $prix + $ecotaxe_ttc;
    
    
    		$prix_ht = $prix / (1+$objProd->tva/100);
    
    
    		$prix_barre_ht = $prix_barre / (1+$objProd->tva/100);
    
    
    		if ($prix !=0) {
    
    
    				if ($objProd->promotion != 0) {
    
    
    				echo "<del>".fprix($prix_barre)." ".$_SESSION['devise']['symbole']."</del> - ";
    
    
    				# echo PROMOTION." -&nbsp;".fprix($objProd->promotion)."%";
    
    
    				}
    
    
    			echo "<span class=\"prix\">".fprix($prix)." ".$_SESSION['devise']['symbole']."<abbr title=\"Toutes taxes comprises\">T.T.C</abbr></span>";
    
    
    			echo ($ecotaxe_ttc > 0) ? "<span class=\"ecotaxe\"><i> dont ecotaxe : ".fprix($ecotaxe_ttc)." ".$_SESSION['devise']['symbole']."</i></span>" : "";
    
    
    		}
    
    
    
    
    } 
    
    
    
    function affichage_fin_succes() {
    
    
    	global $commandeid;
    
    	global $wwwroot; 
    
    	global $email_paypal;
    
    	global $site;
    
    	global $support;
    
    
    	send_mail_order_admin($commandeid);
    
    
    	email_commande($commandeid);
    
    
    	$result = mysql_query("SELECT * FROM peel_commandes WHERE id ='".$commandeid."'");
    
    
    	$com = mysql_fetch_object($result);
    
    
    echo "<h2>&nbsp;".STEP3."</h2>"; 
    
    
    ?>
    
    
    <p>
    
    <?php
    
    
    echo MSG_THANKS;
    
    
    switch ($com->paiement) {
    
    
    case html_entity_decode(CHECK) :
    
    
    
    
    ?>
    
    </p>
    
    <p>- <?php echo PRINT_PROFORMA?> : <a href="<?php echo $wwwroot?>/factures/commande_pdf.php?code_facture=<?php echo $com->code_facture?>&mode=bdc"><?php echo CLICK_HERE?></a></p>
    
    <p>
    
    - <?php echo SEND_CHECK ?> :
    
    <?php
    
    print_societe();
    
    
    echo "</p>";
    
    
    break;
    
    
    case html_entity_decode(TRANSFER) :
    
    
    echo nl2br(SEND_TRANSFER);
    
    
    print_rib();
    
    
    break;
    
    
    case html_entity_decode(PAYPAL) :
    
    
    ?>
    
    <div id="center">
    
    Pour r&eacute;gler par carte bancaire, cliquez ici :<br />
    
    	<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
    
    		<INPUT TYPE="hidden" NAME="cmd" VALUE="_ext-enter">
    
    		<INPUT TYPE="hidden" NAME="redirect_cmd" VALUE="_xclick">
    
    		<input type="hidden" name="business" value="<?php echo $email_paypal?>">
    
    		<input type="hidden" name="item_name" value="<?php echo $site?> COMMANDE <?=$commandeid?>">
    
    		<input type="hidden" name="item_number" value="<?php echo $commandeid?>">
    
    		<input type="hidden" name="amount" value="<?php echo number_format($com->montant,2);?>">
    
    		<input type="hidden" name="page_style" value="Primary">
    
    		<input type="hidden" name="no_shipping" value="1">
    
    		<input type="hidden" name="return" value="<?php echo $wwwroot?>/modules/paypal/ok.php?id=<?=$commandeid?>">
    
    		<input type="hidden" name="cancel_return" value="<?php echo $wwwroot?>/modules/paypal/nok.php?id=<?=$commandeid?>">
    
    		<input type="hidden" name="no_note" value="1">
    
    		<input type="hidden" name="currency_code" value="<?php echo $_SESSION['devise']['code']?>">
    
    		<input type="hidden" name="lc" value="FR">
    
    		<input TYPE="hidden" NAME="email" VALUE="<?php echo $com->email?>">
    
    		<input type="image" src="https://www.paypal.com/fr_FR/i/btn/x-click-but23.gif" border="0" name="submit" alt="Effectuez vos paiements via PayPal : une solution rapide, gratuite et sécurisée !">
    
    		</form>
    
    		<br>
    
    		<img src="<?php echo $wwwroot?>/images/logo-xclickBox.gif" width="152" height="29" alt="" border="0">
    
    	</div>
    
    
    
    <?
    
    break;
    
    
    }
    
    
    echo "<fieldset>";
    
    
    affiche_resume_commande($commandeid, $affiche_statut=2);
    
    
    echo "</fieldset>";
    
    
    }  
    
    
    function send_mail_order_admin($commandeid) {
    
    
    	global $wwwroot; 
    
    	global $site;
    
    	global $support;
    
    
    	$result = mysql_query("SELECT * FROM peel_commandes WHERE id ='".$commandeid."'");
    
    
    	$com = mysql_fetch_object($result);
    
    
    	$message = "La commande $commandeid vient d'être enregistrée sur le site $site";
    
    	$message .= "\n\r";
    
    	$message .= "Email client : ".$com->email;
    
    	$message .= "\n\r";
    
    	$message .= "Référence commande : ".$com->id;
    
    	$message .= "\n\r";
    
    	$message .= "Montant de la commande : ".fprix($com->montant)." EUR";
    
    	$message .= "\n\r";
    
    	$message .= "Date de la commande : ".return_date_fr($com->o_timestamp);
    
    	$message .= "\n\r";
    
    	$message .= "Paiement : ".$com->paiement;
    
    	$message .= "\n\r";
    
    	$message .= "Merci de consulter l'interface d'administration de votre site.";
    
    
    	mail($support,"[$site] Enregistrement de la commande $commandeid",$message,"FROM:$support");
    
    
    }
    
    
    
    
    function affiche_menu_catalogue() {
    
    
    if (!isset($_GET['catid'])) { $catid = 0; } else {$catid = $_GET['catid']; }
    
    
    	$frm['parent'] = array($catid);
    
    
    	construit_menu_arborescent_cat($categorie_options, $frm['parent']);
    
    
    	echo $categorie_options;
    
    
    }	
    
    
    function affiche_menu_contenu() {
    
    
    	if (!isset($_GET['rubid'])) { $rubid = 0; } else {$rubid = intval($_GET['rubid']); }
    
    
    	$frm['parent'] = array($rubid);
    
    
    	construit_menu_arborescent_rub($rubrique_options, $frm['parent']);
    
    
    	echo $rubrique_options;
    
    
    }	
    
    
    /******************************************/
    
    /* Affichage des produits en mode colonne */
    
    /******************************************/
    
    
    function affiche_produit_en_colonne($catid) {
    
    
    global $repertoire_modele;
    
    global $repertoire_upload;
    
    global $repertoire_images;
    
    global $wwwroot;
    
    
    $Links = new MultiPage();
    
    $Links-> ResultPerPage = 50;
    
    $Links-> LinkPerPage   = 15;
    
    $Links-> Template	   = "tpl1.htm";
    
    
    $tri = (isset($_GET['tri'])) ? $_GET['tri'] : "position";
    
    
    $tables = "peel_produits p";
    
    
    $inner_table = "INNER JOIN peel_produits_categories pc ON (pc.produit_id = p.id)";
    
    
    $champs = "p.id, p.nom_".$_SESSION['langue']." as nom, p.promotion, p.descriptif_".$_SESSION['langue']." as descriptif, p.id_marque, p.image1, p.image2, p.prix";
    
    
    $contrainte = "AND p.id = pc.produit_id AND pc.categorie_id = '$catid'";
    
    
    $tri = "ORDER BY p.".$tri.", p.id";
    
    
    $Links-> SqlRequest = "SELECT ".$champs." FROM ".$tables." ".$inner_table." WHERE p.etat = '1' AND 1 ".$contrainte." ".$tri;
    
    
    $Links-> Initialize();
    
    
    $result=mysql_query($Links-> LimitSQL) or die('Une erreur de connexion &agrave; la base s est produite ' . __LINE__ . '.<p>' . mysql_error());
    
    
    if (mysql_num_rows($result) == 0) { 
    
    
    	echo "<h3>".NO_INDEX_PRODUCT."</h3>";
    
    
    } else {
    
    
    echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"1\" width=\"100%\">";
    
    
    $nb_cellules = mysql_num_rows($result);
    
    
    $nb_colonnes = 2;
    
    
    $j = 0;
    
    
    while($prod=mysql_fetch_array($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 class=\"produit2col bordure\">"; } else { echo "<td class=\"produit2col\">"; }
    
    
    			affiche_produit_catalogue(
    
    			intval($prod['id'])
    
    			,html_entity_decode($prod['nom'])
    
    			, $prod['promotion']
    
    			,html_entity_decode($prod['descriptif'])
    
    			,intval($prod['id_marque'])
    
    			,$prod['image1']
    
    			,$prod['image2']
    
    			,$prod['prix']
    
    			, $form = "catalogue");
    
    
    			} 
    
    
    			echo "</td>";
    
    
    			$j++;	
    
    
    			if ( $j % $nb_colonnes == 0 OR $j == $nb_cellules ) {
    
    
    			echo "</tr>";
    
    
    			}
    
    
    			} 
    
    
    
    echo "<tr><td align=\"center\" class=\"normal\" colspan=\"2\">";
    
    
    $Links-> pMultipage();
    
    
    echo "</td></tr></table>";
    
    
    }
    
    
    
    }
    
    
    /******************************************/
    
    /* Affichage des produits en mode listing */
    
    /******************************************/
    
    
    function affiche_produit_en_ligne($catid) {
    
    
    $Links = new MultiPage();
    
    $Links-> ResultPerPage = $_SESSION['ecom']['nb_produit_page'];
    
    $Links-> LinkPerPage   = 15;
    
    $Links-> Template	   = "tpl1.htm";
    
    
    $tri = (isset($_GET['tri'])) ? $_GET['tri'] : "position";
    
    
    $tables = "peel_produits p, peel_produits_categories pc";
    
    
    $champs = "p.id, p.nom_".$_SESSION['langue']." as nom, p.promotion, p.descriptif_".$_SESSION['langue']." as descriptif, p.id_marque, p.image1, p.image2, p.prix";
    
    
    $contrainte = "AND p.id = pc.produit_id AND pc.categorie_id = '$catid'";
    
    
    $tri = "ORDER BY p.".$tri.", p.id";
    
    
    $Links-> SqlRequest = "SELECT ".$champs." FROM ".$tables." WHERE p.etat = '1' AND 1 ".$contrainte." ".$tri;
    
    
    $Links-> Initialize();
    
    
    $result=mysql_query($Links-> LimitSQL) or die('Une erreur de connexion &agrave; la base s est produite ' . __LINE__ . '.<p>' . mysql_error());
    
    
    if (mysql_num_rows($result) == 0) { 
    
    
    	echo "<h3>".NO_INDEX_PRODUCT."</h3>";
    
    
    } else {
    
    
    echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"1\" width=\"100%\">";
    
    
    $nb_cellules = mysql_num_rows($result);
    
    
    $nb_colonnes = 2;
    
    
    $j = 0;
    
    
    while($prod=mysql_fetch_array($result)) 
    
    {
    
    
    echo "<tr>";
    
    
    echo "<td>";
    
    
    template_index_produit_en_ligne(
    
    	intval($prod['id']),
    
    	html_entity_decode($prod['nom']),
    
    	$prod['promotion'],
    
    	html_entity_decode($prod['descriptif']),
    
    	intval($prod['id_marque']),
    
    	$prod['image1'],
    
    	$prod['image2'],
    
    	$prod['prix'],
    
    	$form = "catalogue");
    
    
    echo "</td></tr>";
    
    
    } 
    
    
    echo "<tr><td align=\"center\" class=\"normal\">";
    
    
    $Links-> pMultipage();
    
    
    echo "</td></tr></table>";
    
    
    }
    
    
    }
    
    
    /********************************/
    
    /* Affiche la marque du produit */
    
    /********************************/
    
    
    function affiche_marque($id_marque) {
    
    
    global $wwwroot;
    
    
    $sql = "SELECT id, nom_".$_SESSION['langue']." as marque, image FROM peel_marques WHERE id = '".intval($id_marque)."'";
    
    
    $query = mysql_query($sql);
    
    
    if (mysql_num_rows($query) > 0) {
    
    
    	$brand = mysql_fetch_object($query);
    
    
    	echo "<h3>".BRAND." : <a href=\"$wwwroot/achat/marque.php?id=".$brand->id."\"><b>".html_entity_decode($brand->marque)."</b></a></h3>";
    
    
    }
    
    
    }
    
    
    function affiche_menu_recherche() {
    
    
    global $wwwroot;
    
    global $repertoire_images;
    
    ?>
    
    <form method="get" action="<?php echo $wwwroot ?>/search.php" id="recherche" name="searchform">
    
    	<input type="hidden" name="mode" value="1">
    
    	<input type="hidden" name="match" value="1">
    
    	<input type="text" name="search" id="foo" value="" onkeyup="loadData();" style="width:120px;"/>
    
    	<input type="submit" class="bouton" value="Go" name="action" />
    
    </form>
    
    <p><div id="placement_produit"></div></p>
    
    
    <?php
    
    }
    
    
    function affiche_select_categorie() {
    
    
    ?>
    
    <select onChange="java script:gotocategorie(this.options[this.selectedIndex].value)" style="width:175px;">
    
    		<option><?echo SEARCH_CATEGORY ?></option>
    
    		<?php
    
    
    		$frm['categories_select'] = array();
    
    
    		construit_arbo_cat_fo($categorie_options_select, $frm['categories_select']);
    
    
    		echo $categorie_options_select;
    
    
    		?>
    
    	</select>
    
    
    
    <?php
    
    
    }
    
    
    function affiche_select_marque() {
    
    
    global $wwwroot;
    
    
    $query = mysql_query("SELECT id, nom_".$_SESSION['langue']." as marque FROM peel_marques ORDER BY position") or die('Une erreur de connexion &agrave; la base s est produite ' . __LINE__ . '.<p>' . mysql_error());
    
    
    if (mysql_num_rows($query) > 0) {
    
    
    ?>
    
    
    	<select name="brand" onChange="java script:gotobrand(this.options[this.selectedIndex].value)" style="width:175px;">
    
    	<option value=""><?php echo SEARCH_BRAND?></option>
    
    	<?php
    
    
    	while ($brand = mysql_fetch_array($query)) {
    
    
    	echo "<option value=\"".$brand['id']."\">".html_entity_decode($brand['marque'])."</a><br />";
    
    
    	}
    
    
    	?>
    
    	</select>
    
    <?php	
    
    
    }
    
    
    }
    
    
    
    function affiche_filtre() {
    
    
    global $module_filtre;
    
    
    
    if ($module_filtre == 1) {
    
    ?>
    
    
    <select name="filtre" onChange="java script:gotoself(this.options[this.selectedIndex].value)">
    
    	<option value=""><?php echo CLASSERPAR ?></option>
    
    	<option value="catid=<?php echo vn($_GET['catid']) ?>&page=<?php echo vn($_GET['page']) ?>&tri=reference"><?php echo REFERENCE?></option>
    
    	<option value="catid=<?php echo vn($_GET['catid']) ?>&page=<?php echo vn($_GET['page']) ?>&tri=nom_<?php echo $_SESSION['langue']?>"><?php echo ITEM?></option>
    
    	<option value="catid=<?php echo vn($_GET['catid']) ?>&page=<?php echo vn($_GET['page']) ?>&tri=prix"><?php echo PRICE?></option>	
    
    </select>
    
    
    <?php
    
    
    }
    
    
    }
    
    
    function affiche_sous_categorie() {
    
    global $repertoire_upload;
    
    global $wwwroot;
    
    $qid_c = recupere_sous_categorie(vn($_GET['catid']));
    
    
    if (mysql_num_rows($qid_c) > 0) { 
    
    
    
    		echo "<table border=\"0\" cellpadding=\"5\" cellspacing=\"0\" width=\"100%\">";
    
    
    		$nb_cellules = mysql_num_rows($qid_c);
    
    
    		$nb_colonnes = 3;
    
    
    		$j = 0;
    
    
    		while ($cat = mysql_fetch_array($qid_c)) { 
    
    
    		if ( $j % $nb_colonnes == 0 ) { echo "<tr>"; }
    
    
    		if($j % $nb_colonnes !=0 OR $j % $nb_colonnes == 0 ) {
    
    
    		echo "<td width=\"33%\" align=\"center\">"; 
    
    
    		?>
    
    
    		<a href="<?=$_SERVER['PHP_SELF']?>?catid=<?=$cat['id'] ?>">
    
    
    		<?php
    
    
    		if (!empty($cat['image'])) { 
    
    
    			$width = calcul_largeur_image($repertoire_upload."/".$cat['image']);
    
    
    			$largeur = ($width >= 150) ? "150" : $width;
    
    
    			echo "<img src=\"$repertoire_upload/".$cat['image']."\" width=\"$largeur\" border=\"0\" alt=\"".html_entity_decode($cat['nom_'.$_SESSION['langue'].''])."\"/>";
    
    
    			echo "<br />".html_entity_decode($cat['nom_'.$_SESSION['langue'].'']);
    
    
    		} else {
    
    
    			echo html_entity_decode($cat['nom_'.$_SESSION['langue'].'']);
    
    
    		}
    
    
    		?>
    
    
    		</a>
    
    
    		<? 
    
    
    		} 
    
    
    		echo "</td>";
    
    
    		$j++;	
    
    
    		if ( $j % $nb_colonnes == 0 OR $j == $nb_cellules ) {
    
    
    		echo "</tr>";
    
    
    		}
    
    
    		} 
    
    		echo "</table>"; 
    
    
    }
    
    
    }
    
    
    function recupere_sous_categorie($catid=0) { 
    
    
    	$qid = mysql_query("SELECT id, nom_".$_SESSION['langue'].", description_".$_SESSION['langue'].", parent_id, image  FROM peel_categories WHERE parent_id = '$catid' AND id > '0' AND etat = '1' ORDER BY position") 
    
    	or DIE('Une erreur de connexion &agrave; la base s est produite ' . __LINE__ . '.<p>' . MYSQL_ERROR()); 
    
    	return $qid; 
    
    
    } 
    
    
    
    function affiche_compte() {
    
    
    global  $wwwroot;
    
    
    if (est_identifie()) { ?>
    
    
    	- <a href="<?php echo $wwwroot ?>/compte.php"><?php echo COMPTE?></a><br />
    
    	- <a href="<?php echo $wwwroot ?>/utilisateurs/change_params.php"><?php echo CHANGE_PARAMS?></a><br />	
    
    	- <a href="<?php echo $wwwroot ?>/achat/historique_commandes.php"><?php echo ORDER_HISTORY?></a><br />	
    
    
    <?php } else { ?>
    
    
    	- <a href="<?php echo $wwwroot ?>/membre.php"><?php echo LOGIN?></a><br />
    
    	- <a href="<?php echo $wwwroot ?>/utilisateurs/enregistrement.php"><?php echo REGISTER?></a><br />	
    
    
    
    <?php
    
    
    }
    
    
    }
    
    
    function affiche_billet_accueil() {
    
    
    global $wwwroot;
    
    global $repertoire_upload;
    
    
    $result=mysql_query("SELECT p.id, p.surtitre_".$_SESSION['langue'].", p.titre_".$_SESSION['langue'].", p.chapo_".$_SESSION['langue'].", p.texte_".$_SESSION['langue'].", p.image1, p.on_special FROM peel_articles p WHERE p.id_site = '".intval($_SESSION['ecom']['id'])."' AND p.etat = '1' AND p.on_special = '1' ORDER BY p.date_maj DESC"); 
    
    
    			if (mysql_num_rows($result) > 0) {
    
    
    			echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"5\" width=\"100%\" align=\"center\">";
    
    
    			while($prod=mysql_fetch_array($result)) 
    
    
    			{
    
    
    			echo "<tr>";
    
    
    			if (!empty($prod['image1'])) {
    
    
    				echo "<td>";
    
    
    				$width = calcul_largeur_image($repertoire_upload."/".$prod['image1']);
    
    
    				$largeur = ($width >= 150) ? "150" : $width;
    
    
    				echo "<img src=\"$repertoire_upload/".$prod['image1']."\" width=\"$largeur\" align=\"left\" />";
    
    
    				echo "</td>";
    
    				}	
    
    
    
    				echo "<td valign=\"top\" colspan=\"2\">";	
    
    
    				echo "<a href=".$wwwroot."/lire/article_details.php?id=".$prod['id'].">";
    
    
    				echo "<b>".html_entity_decode($prod['titre_'.$_SESSION['langue'].''])."</b>";
    
    
    				echo "</a>";
    
    
    				echo "<p>".nl2br(html_entity_decode($prod['chapo_'.$_SESSION['langue'].'']))."</p>";
    
    
    				if (!empty($prod['texte_'.$_SESSION['langue'].''])) {
    
    
    				echo "<div align=\"right\"><a href=".$wwwroot."/lire/article_details.php?id=".$prod['id'].">".MORE."</a></div>";
    
    
    				}
    
    
    				echo "</td></tr>";
    
    
    			}
    
    
    			echo "</table>";
    
    
    			}
    
    
    }
    
    
    function affiche_paiement() {
    
    
    $sql = "SELECT nom_".$_SESSION['langue']." as paiement FROM peel_paiement ORDER BY position";
    
    
    $query = mysql_query($sql);
    
    
    echo "<ul><b>Paiement acceptés :</b> ";
    
    
    while ($r = mysql_fetch_array($query)) {
    
    
    	echo "<li>".html_entity_decode($r['paiement'])."</li>";
    
    
    }	
    
    
    echo "</ul>";
    
    
    }
    
    
    function affiche_transport() {
    
    
    $sql = "SELECT nom_".$_SESSION['langue']." as transport FROM peel_types ORDER BY position";
    
    
    $query = mysql_query($sql);
    
    
    echo "<ul><b>Nos modes d'expédition :</b> ";
    
    
    while ($r = mysql_fetch_array($query)) {
    
    
    	echo "<li>".html_entity_decode($r['transport'])."</li>";
    
    
    }	
    
    
    echo "</ul>";
    
    
    }
    
    
    function affiche_produit_catalogue(
    
    $id, $nom, $promotion, $descriptif, $id_marque, $image1, $image2, $prix)
    
    
    {
    
    global $wwwroot;
    
    global $repertoire_upload;
    
    ?>
    
    <table class="fc">
    
    <tr><td colspan="2" class="fc_titre_produit"><?php echo ucfirst($nom) ?></td></tr>
    
    <tr><td colspan="2" class="fc_prix"><?php affiche_prix($id); ?></td></tr>
    
    <tr><td colspan="2" class="fc_image">
    
    
    <a title="<?php echo $nom?>" alt="<?php echo $nom?>" href="achat/produit_details.php?id=<?php echo $id?>">
    
    
    <?php		
    
    
    if (!empty($image1)) {
    
    
    	$width = calcul_largeur_image($repertoire_upload."/".$image1);
    
    
    	$largeur = ($width >= 250) ? "250" : $width;
    
    
    ?>	
    
    
    <img src="<?php echo $repertoire_upload."/".$image1 ?>" width="<?php echo $largeur ?>" border="0" alt="<?php echo $nom?>" />
    
    
    <?php } else { ?>
    
    
    <img src="<?php echo $wwwroot?>/images/photo-non-disponible.gif" width="130" alt="photo non disponible" border="0">
    
    
    <?php } ?>
    
    
    </a>
    
    
    </td>
    
    </tr>
    
    <tr>
    
    <td class="fc_zoom">
    
    <?php 
    
    
    echo (!empty($image2)) ? "<a href=\"".$repertoire_upload."/".$image2."\" rel=\"lightbox\" class=\"zoom\" />zoom</a>" : "<a class=\"zoom\" href=\"".$repertoire_upload."/".$image1."\" rel=\"lightbox\" />zoom</a>";
    
    
    ?>
    
    </a>
    
    </td>
    
    <td class="fc_detail">
    
    <a class="plus_detail" href="achat/produit_details.php?id=<?php echo $id ?>" title="<?php echo $nom ?>"><?php echo MORE ?></a>
    
    </td>
    
    </tr>
    
    </table>
    
    <?php
    
    
    }
    
    
    ?>

    ----------------------

    Merci de m'aider

  3. phildu34


    re bonjour, je souhaiterais avoir la possibilité d'imprimer toutes les factures du mois ou toutes les factures crées entre deux dates .

    ceci depuis le BO.

    vous allez me dire " sa c'est du développement spécifique" donc payant , et bien soit je règlerez la facture à celui qui me fera une bonne proposition...

    je pense tout de même que sa devrais devenir une fonction de " série " dans les futures version de Premuim, car nous avons tous besoin de fournir les factures au comptable , un jour ou l'autre.

    cette demande est relativement urgente.

    ma version : Premuim 3.1

  4. les miniatures


    donc dans search.php, juste au dessus de ta requête, tu as un truc du genre :

    $cmptype="AND";

    if($match!=1) $cmptype="OR";

    $where_clause.= " (".implode( $termArray, " $cmptype " ).") ";

    $where_clause.="order by p.id desc";

    Tu le mets ici ton LIMIT...

    $cmptype="AND";

    if($match!=1) $cmptype="OR";

    $where_clause.= " (".implode( $termArray, " $cmptype " ).") ";

    $where_clause.="order by p.id desc limit 0, 50";

    Et dans ta requête, tu laisses le AND"; à la fin.

    AND p.etat = '1' AND";

    Dis moi si cela fonctionne chez toi.

    Thierry

  5. macao45


    bonsoir,

    le getimage size est fait pour connaitre la taille de l'image dans l'affichage des pages . donc rien à voir avec url rewriting

    pour mettre en place un URL rewriting il faut retoucher un peut au code par ci par la pour transformer les liens du site

    index.php?catid=6 en votre-categorie.html

    il vous faut quelques connaissances en php et regex (remplacement de caracter à la volé grace au .htaccess)

    bonne soirée

  6. abdel


    j'avais déjà fais le test sans resultat, quand je supprime le AND" a la fin de la ligne je reçoi toujours une erreur.

    voici le code de mon fichier search.php:

    /////////////////////////////////////////////////////////////////

    // build the sql statement

    // this will build the sql based on the given information

    function build_sql($table_name, $terms, $fields, $match)

    {

    $SQL = "SELECT DISTINCT(p.id), c.id AS categorie_id, p.nom_".$_SESSION['langue'].", p.description_".$_SESSION['langue']."

    , p.image1, p.prix, p.reference, c.nom_".$_SESSION['langue']." AS categorie

    FROM peel_produits p, peel_produits_categories pc, peel_categories c, peel_sites_pivots sp

    WHERE sp.produit_id = p.id AND sp.site_id = '".intval($_SESSION['ecom']['id'])."' AND p.id = pc.produit_id AND pc.categorie_id = c.id AND p.etat = '1' LIMIT 0,10";

    $SQL.= build_terms_clause($terms, $fields,$match);

    return $SQL;

    }

    ?>

    voici l'erreur :

    Une erreur de connexion à la base s est produite 36.

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '( ( p.nom_fr LIKE '%amilo%' OR p.description_fr LIKE '%amilo%' OR p.refere' at line 4

    merci pour vos réactions.

    abdel

  7. ro2kpdp


    Bonjour dans /modules/paypal/nok.php en 5.3 il y a cette requette :

    mysql_query("UPDATE peel_commandes SET statut = '6' WHERE id = '".intval(vb($_GET['id']))."'"); (passe en annulé la commande)

    Bizarement elle n'est pas prise en compte en cas d'incident sur Paypal.

    Ca serait pratique de connaitre les commandes Paypal avec un incident en creant un statut "incident paypal" "99" par exemple dans la base peel_commandes et status_commandes

    Donc de ne pas etre obligé de visualiser l'interface paypal pour finalement s'appercevoir qu'elle n'a pas ete enregistrée et comble du bonheur generer un mail a l'admin l'avertissant de cet incident.

    Cordialement,

    David

Twitter Advisto ecommerce

Facebook PEEL Shopping