//$NumProd contient le numéro de produit à détailler dans cette fiche
//Construction de la requete
/*
if (!isset($Action) or ($Action!="Access"))
{
$SQL="SELECT LibelleProd, DescriptifProd$Langue AS DescriptifProduit, PrixProd, TVAProd, QuantiteProd, Fidelite_Produit ";
$SQL.=", CatProduit$Langue, SousCatProduit$Langue, Marque.Libel$Langue AS MarqueProduit";
$SQL.=" FROM Produits, CatProduits, SousCatProduits, Marque";
$SQL.=" WHERE Produits.NumProd=$NumProd ";
$SQL.=" AND CategorieProd=CatProduits.NumCatProduit AND SousCatProd=SousCatProduits.NumSousCatProduit";
$SQL.=" AND Produits.MarqueProd=Marque.NumLibel";
}
else
{ $SQL="SELECT LibelleProd, DescriptifProd$Langue AS DescriptifProduit, PrixProd, TVAProd, QuantiteProd ";
$SQL.=", CatProduit$Langue, SousCatProduit$Langue, Marque.Libel$Langue AS MarqueProduit";
$SQL.=" FROM Produits, CatProduits, SousCatProduits, Marque ";
$SQL.=" WHERE Produits.NumProd=$NumProd AND Produits.MarqueProd=Marque.NumLibel ";
$SQL.=" AND CategorieProd=CatProduits.NumCatProduit AND SousCatProd=SousCatProduits.NumSousCatProduit";
}
*/
$SQL="SELECT NumProd, LibelleProd, PrixProd, QuantiteProd, DescriptifProd$Langue AS DescriptifProduit, CatProduits.CatProduit".ucfirst($Langue)." AS CategorieProduit, SousCatProduit".ucfirst($Langue).", Fidelite_Produit ";
$SQL.=" FROM Produits LEFT JOIN CatProduits ON CategorieProd=NumCatProduit ";
$SQL.=" LEFT JOIN SousCatProduits ON SousCatProduits.NumSousCatProduit=Produits.SousCatProd ";
$SQL.=" LEFT JOIN Marque ON Produits.MarqueProd=Marque.NumLibel ";
$SQL.=" WHERE NumUtilisateurProduit='".NUM_UTILISATEUR."'";
$SQL.=" AND NumProd=$NumProd";
$Requete=mysql_query($SQL,CONNECTION);
if ($Requete)
{//on a pu faire la liste des produits
$T=mysql_fetch_object($Requete);
mysql_free_result($Requete); //libération mémoire
//Cherchons maintenant l'image principale de produit à afficher
$SQL="SELECT FichierImage,NumImage FROM Images ";
$SQL.=" WHERE NumProdImage=$NumProd AND PremierImage LIKE 'OUI'";
$Requete=mysql_query($SQL,$Connection);
if ($Requete)
{//on a pu chercher l'image
if (mysql_num_rows($Requete)==1)
{$U=mysql_fetch_object($Requete);
$ImagePrincipale=CHEMIN_IMAGE_HTTP."/".$U->FichierImage;
$ImageAAfficher=$U->FichierImage;
$NumImagePremier=$U->NumImage; }
else {$ImagePrincipale=ScriptPath."/".$ImageVide;
$ImageAAfficher=$ImageVide;
$NumImagePremier=0;}
mysql_free_result($Requete);
}//fin on a pu chercher l'image
if ($Fidelite=="Oui")
{//alors le taux promotionnel est de 100% car produit gratuit!
$TypePromo=PROMO_GRATUIT;
$TauxPromo="100";
}
else {//on cherche de quelle promo il s'agit, ou s'il n'y en a pas
//maintenant on stocke dans la variable $Promo la promotion sur ce produit si elle existe
$SQL="SELECT TauxPromo,TypePromotion,DateFinPromotion ";
$SQL.=" FROM Produits LEFT JOIN Lien_Prod_Promo ON Produits.NumProd=Lien_Prod_Promo.NumProduit ";
//sin une promo déterminée est demandée
$SQL.=",Promotions";
$SQL.=" WHERE NumUtilisateurProduit='".NUM_UTILISATEUR."' ";
$SQL.=" AND Promotions.NumPromotion=Lien_Prod_Promo.NumPromo ";
$SQL.=" AND NumProd='".$NumProd."' AND TypePromotion='".$TypePromo."'";
$SQL.=" AND DateDepPromotion<=NOW('') AND DateFinPromotion>=NOW('')";
$Requete=mysql_query($SQL,CONNECTION);
$TypePromo=0;
if ($Requete)
{if (mysql_num_rows($Requete)>0)
{$Promo=mysql_fetch_object($Requete);
$TypePromo=$Promo->TypePromotion;
}
mysql_free_result($Requete);
}
}//fin de la recherche de l'existence d'une promotion autre que gratuit
}//fin on a pu faire la liste des produits
else {//on ne peut pas lancer la requete
$ErreurNo=ERR_SELECT;
}//fin on ne peut pas lancer la requete
//gestion de l'affichage des liste déroulantes pour les options du produit
//création en même temps du javascript nécessaire pour les contrôles
$LibelleOptionAncien="";
$TexteOptions="";
$SQL="SELECT NumCatOption, LibelCatOption".$Langue." As LibelleOption FROM CatOptions WHERE NumProdCatOption=$NumProd ORDER BY LibelCatOption".$Langue;
$Requete3=mysql_query($SQL,CONNECTION);
if ($Requete3)
{if (mysql_num_rows($Requete3)>0) {$TexteOptions="
"; }
$TabOptions=""; //stocke le nom des différentes listes déroulantes d'option
$TabTexteOptions=""; //stocke le nom des différentes options pour le produit
for ($i=0;$i\n
\n";
//on cherche maintenant les modalités pour cette option
$SQL="SELECT NumValeurOption, PrixValeur, LibelValeur".$Langue." AS LibelleValeurOption FROM ValeurOptions WHERE NumOption=$V->NumCatOption";
$Requete4=mysql_query($SQL,CONNECTION);
if ($Requete4)
{//on crée la liste déroulante des options possibles
$NbreValeurs=mysql_num_rows($Requete4);
if ($NbreValeurs>0)
{
$VariableTemp="Option".$V->NumCatOption;
$TexteOptions.="\n";
}//
}
//on a fini de chercher les sous modalités
$TexteOptions.="
\n";
$TexteOptions.="\n";
//On cherche ensuite les différentes options
}// fin tant que d'options
if (mysql_num_rows($Requete3)>0) {$TexteOptions.= "
\n";}
mysql_free_result($Requete3);
}
if ($TabTexteOptions!="")
{
?>
}
else
{// cas d'un produit sans option!
?>
}
?>
$LibelleProduit=strtr(stripslashes($T->LibelleProd)," ","+");
if (isset($TypePromo))
{//une promo est en cours pour cet article
//on remplit la case avec une animation
if ($TypePromo!=PROMO_GRATUIT)
{$DateFin=$Promo->DateFinPromotion;
//calcul du nombre de jours restants
$DateJour=mysql_date();
$NbreJoursRestant=Nbre_Jours_Entre_Dates($DateJour,$DateFin);
}
switch ($TypePromo)
{ case PROMO_FLASH :
$DateFinTemp=strtr($DateFin," ","-");
$DateFinTemp=strtr($DateFinTemp,":","-");
$DateFinTemp=substr($DateFinTemp,2,strlen($DateFinTemp));
?>
if ($TypePromo==PROMO_GRATUIT)
{$PrixProdT[0]="0";
}
else {//le produit est payant, hors programme fidelité donc
$PrixProd=AfficheNombre($PrixProd);
$PrixProdT=split(DECIMALE,$PrixProd);}
echo $PrixProdT[0];
?>
echo "€";
if ($PrixProd[0]!=0) {echo $PrixProdT[1];} ?>
if (PROMOTIONS==1) {//affichage du mot "seulement!" en cas de promotion
?>
if ($TypePromo==PROMO_GRATUIT)
{echo "",$Libelle_Seulement_Fidelite,""; }
else {echo $Libelle_Seulement;} ?>
} //fin affichage du sous titre de prix seulement! en promotion
?>
if ($Economie>0) //dans le cas d'une reduction/promotion
{//affichage de l'économie
?>
echo $Libel_TuEconomises; ?>
echo $Economie; ?>€
}
if (PROG_FIDELITE==1)
{//afficahge des points fidélité
?>
if ($TypePromo==PROMO_GRATUIT) {echo $Libelle_ProgFideliteTer;} else { echo $Libelle_ProgFidelite;} ?>
if ($TypePromo==PROMO_GRATUIT) {echo $T->Fidelite_Produit;} else {echo intval(COEFF_FIDELITE*$PrixProd*(1-($Promo->TauxPromo/100))*100);} ?>
echo $Libelle_ProgFideliteBis; ?>
}
?>
if (isset($NbreJoursRestant) && ($NbreJoursRestant<5) && $TypePromo>0)
{$Choix=rand(0,1);
switch ($Choix)
{ case 0 : if ($NbreJoursRestant==0)
{$TexteRestant=$Libelle_DernierJour."!|".$Libelle_Dernier_Demain."!";}
else {$TexteRestant=$Libelle_PlusQue." ".$NbreJoursRestant." ".$Libelle_PlusQue_Fin."!|";}
break;
case 1 : $TexteRestant=Jour_DateSup($DateFin,$Langue)." ".$Libelle_CFini."!|";
break;
}
?>
}
?>
" border=0 align=absmiddle alt=" echo $Libel_Clic_Commander," ",ucfirst(stripslashes($T->LibelleProd)); ?>">
echo $Libel_Nom_Prod; ?>
echo stripslashes($T->LibelleProd); ?>
if (isset($T->MarqueProduit) and $T->MarqueProduit!="")
{
?>
echo $Libel_Marque_Prod; ?>
echo $T->MarqueProduit; ?>
//fin affichage si la marque est renseignée
}
if (AFFICHE_DISPONIBILITE==1) { //on affiche la disponibilité du produit en stock
?>
echo $Libelle_Disponible; ?>
if ($T->QuantiteProd>0) { if ($T->QuantiteProd<10) {echo $Libelle_PresqueEpuise;}
else {echo $Libel_Quantite; }
} else {echo $Libelle_Epuise;} ?>
} //fin affichage du produit en disponibilité
?>
echo $T->DescriptifProduit; ?>
//on sélectionne les images déjà saisies pour ce produit
$SQL="SELECT NumImage,FichierImage ";
$SQL.="FROM Images WHERE NumProdImage=$NumProd AND PremierImage NOT LIKE 'Oui'";
// on lance l'affichage des images
$Requete=mysql_query($SQL,$Connection);
if ($Requete)
{//on a pu sélectionner les images
$NbreImages=mysql_num_rows($Requete);
if ($NbreImages>0)
{//il existe des images
//on crée la structure html de la galerie
?>
echo $GaleriePhotos; ?>
//Construction d'un tableau
for ($cpt = 0; $cpt < $NbreImages; $cpt++)
{ $T=mysql_fetch_object($Requete);
// génère 2 tableaux synchronisés
$tImages[] = $T->FichierImage;
$tNumImages[]=$T->NumImage;
}
//-----------------------------------------------------
// définition du tableau HTML (plaquette de photos)
$NbrePhotosParLigne=NbreImagesLigne;
echo "
\n";
$ligne=0;
while (($ligne*$NbrePhotosParLigne)<(sizeof($tImages)))
{
print "\n";
echo "
\n";
for ($pos = 0; $pos < $NbrePhotosParLigne; $pos++)
{
$ind=$ligne*$NbrePhotosParLigne+$pos;
if (isset($tImages[$ind]) && $tImages[$ind]!="")
{
$NomImg=substr($tImages[$ind],0,strlen($tImages[$ind])-4);
echo "
\n";
//-----------------------------------------------------
//Fin construction du tableau
?>
echo $Libel_Fin_Photos; ?>
} //fin il existe des images
else {//aucune image pour ce produit
$ErreurNo=ERR_AUCUN_AFFICHAGE;
}
mysql_free_result($Requete);
}
else {$ErreurNo=ERR_SELECT;
echo MessageErreur($ErreurNo,$Langue);}
//fin affichage des images
if (PROMOTIONS==1)
{//on naffiche maintenant en cas de promotions, les liens avec d'autres produits
?>