//liste actuelle des produits en promotion
$SQL="SELECT FichierImage, NumImage,LibelleProd,PrixProd,NumProd,CategorieProd,TauxPromo,TypePromotion,DateFinPromotion,LibellePromotion ";
$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.=", Images, Promotions";
$SQL.=" WHERE NumProdImage=NumProd AND PremierImage NOT LIKE 'Cou' AND NumUtilisateurProduit='".NUM_UTILISATEUR."' ";
$SQL.=" AND Promotions.NumPromotion=Lien_Prod_Promo.NumPromo ";
if (isset($NumPromotion) && $Numpromotion!=0) {$SQL.=" AND Lien_Prod_Promo.NumPromo=".$NumPromotion;}
$SQL.=" AND DateDepPromotion<=NOW('') AND DateFinPromotion>=NOW('')";
$SQL.=" ORDER By DateFinPromotion"; //classe les promotions finissant en premier
$Requete=mysql_query($SQL,$Connection);
$T=mysql_fetch_object($Requete);
?>
if ($Requete)
{//on a pu sélectionner les images
@mysql_data_seek($Requete,0); //on se replace au début!
$NbreImages=mysql_num_rows($Requete);
if ($NbreImages>0)
{//il existe des images
//Construction d'un tableau
?>
if (isset($tImages)) {unset($tImages);}
if (isset($tNumImages)) {unset($tNumImages);}
if (isset($tNomImage)) {unset($tNomImage);}
if (isset($tPrixProd)) {unset($tPrixProd);}
if (isset($tCatProd)) {unset($tCatProd);}
if (isset($tTauxPromo)) {unset($tTauxPromo);}
if (isset($tTypePromo)) {unset($tTypePromo);}
if (isset($tDateFin)) {unset($tDateFin);}
for ($cpt = 0; $cpt < $NbreImages; $cpt++)
{ $T=mysql_fetch_object($Requete);
// génère 2 tableaux synchronisés
$tImages[] = $T->FichierImage;
$tNumImages[]=$T->NumImage;
$tNomImage[]=stripslashes($T->LibelleProd);
$tPrixProd[]=$T->PrixProd;
$tNumProd[]=$T->NumProd;
$tCatProd[]=$T->CategorieProd;
$tTauxPromo[]=$T->TauxPromo;
$tTypePromo[]=$T->TypePromotion;
$tDateFin[]=$T->DateFinPromotion;
}
//-----------------------------------------------------
// définition du tableau HTML (plaquette de photos)
$NbrePhotosParLigne=NBRE_COL_NOUVEAUTES;
echo "
\n";
$ligne=0;
while (($ligne*$NbrePhotosParLigne)<(sizeof($tImages)))
{
//ligne du nom de la poupée
echo "
\n";
for ($pos = 0; $pos < $NbrePhotosParLigne; $pos++)
{
$ind=$ligne*$NbrePhotosParLigne+$pos;
if (isset($tImages[$ind]) && $tImages[$ind]!="")
{
echo "
\n";
echo "
",ucfirst($tNomImage[$ind]),"";
echo "
\n";
}
else
{
echo "
\n";
}
}//fin for
print "
\n";
// ligne de l' image principale
echo "
\n";
for ($pos = 0; $pos < $NbrePhotosParLigne; $pos++)
{
$ind=$ligne*$NbrePhotosParLigne+$pos;
if (isset($tImages[$ind]) && $tImages[$ind]!="")
{//recherche augmentation de prix avec les options
$NomImg=substr($tImages[$ind],0,strlen($tImages[$ind])-4);
echo "
\n";
}
else
{//affichage vide si pas de photo sur la fin de ligne
echo "
";
echo "
\n";
}
}
print "
\n";
//affichage ligne de ventes flash
$ligne++;
}
echo "
\n";
?>
mysql_free_result($Requete);
//-----------------------------------------------------
//Fin construction du tableau
} //fin il existe des images
else {//si aucune image promotionnelle en cours
//on choisit l'affichae classique
include 'page_indexfr_classic.inc';
}
}
else {$ErreurNo=ERR_SELECT;
echo MessageErreur($ErreurNo,$Langue);}
?>