Jump to content

[RESOLU] Comment choisir l'image que l'ont veut afficher ?


Recommended Posts

Bonjour,

j'ai actuellement un diaporama qui fait défiler l'image de couverture de chaque produit en page d'accueil.

je souhaiterait choisir l'image que je veux afficher dans ce diapo (celle en position N°2 je m'arrangerais pour mettre la couverture en position n°1 à chaque fois) mais comment faire ?

style="background-image:url('{$img_prod_dir}{$product.id_image}-diapo.jpg'); display:block; height:350px;"



Comment assigner à la variable {$product.id_image} l'image en position N°2 via une requête SQL en PHP ? on peut toucher à la base SQL avec smarty ect .... ?

Merci :)

Link to comment
Share on other sites

Bon je viens de bricoler un truc c'est pas jolie :) mais ça marche :

{php}
$myVar = $this->get_template_vars('product');
$a = $myVar["id_product"];
$b = mysql_query("SELECT * FROM ps_image WHERE id_product='$a' AND position=2");
$c = mysql_fetch_array($;
$d = $c['id_image'];
{/php}



J'ai plus qu'a mettre $d dans l'url de l'image et c'est bon !

Link to comment
Share on other sites

  • 8 months later...

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
×
×
  • Create New...