leakimd Posted April 28, 2020 Share Posted April 28, 2020 Salut. Petit problème d'URL pour un module, je souhaite afficher l'image correspondant a la déclinaison d'un produit d’après ce que j'ai trouvé sur différents forum il faut utiliser Link::getImageLink ou $link->getImageLink (si je peux le mettre directe dans le TPL ça serais cool) Mais j'arrive pas a utilisé cette fonction. pour info je travaille a partir de la requête : SELECT p.id_product, pac.id_product_attribute, pai.id_image, pl.name, GROUP_CONCAT(DISTINCT(pal.name) SEPARATOR ", ") as combination, GROUP_CONCAT(DISTINCT(pal.id_attribute) SEPARATOR ", ") as combination2, pq.quantity, pl.link_rewrite FROM ps7bis_product p LEFT JOIN ps7bis_product_attribute pa ON (p.id_product = pa.id_product) LEFT JOIN ps7bis_stock_available pq ON (p.id_product = pq.id_product AND pa.id_product_attribute = pq.id_product_attribute) LEFT JOIN ps7bis_product_lang pl ON (p.id_product = pl.id_product) LEFT JOIN ps7bis_product_attribute_combination pac ON (pa.id_product_attribute = pac.id_product_attribute) LEFT JOIN ps7bis_attribute_lang pal ON (pac.id_attribute = pal.id_attribute) LEFT JOIN ps7bis_product_attribute_image pai on(pa.id_product_attribute = pai.id_product_attribute)WHERE pl.id_lang = 1 AND pal.id_lang = 1 and p.id_product = 20 And pac.id_product_attribute = 40GROUP BY pac.id_product_attribute Quelqu'un peux m'aider ???? Merci d'avance Link to comment Share on other sites More sharing options...
doekia Posted April 28, 2020 Share Posted April 28, 2020 et bien... il te manque l'id de l'image cover ... donc jointure sur ps_image Link to comment Share on other sites More sharing options...
leakimd Posted April 28, 2020 Author Share Posted April 28, 2020 merci pour ta réponse mais je pensais utilisé id de l'image de la déclinaison ps_product_attribute_image.id_image mais mon problème c'est la syntaxe pour la fonction $link->getImageLink() Si ça peut faire une différence je sur sur ps 1.7.4.3 Link to comment Share on other sites More sharing options...
doekia Posted April 28, 2020 Share Posted April 28, 2020 /** * Returns a link to a product image for display * Note: the new image filesystem stores product images in subdirectories of img/p/. * * @param string $name rewrite link of the image * @param string $ids id part of the image filename - can be "id_product-id_image" (legacy support, recommended) or "id_image" (new) * @param string $type * * @return string */ public function getImageLink($name, $ids, $type = null) { Link to comment Share on other sites More sharing options...
leakimd Posted April 28, 2020 Author Share Posted April 28, 2020 ouai j'ai vu je cherche depuis ce matin Mais, si je fait $thisImagelink = getImageLink($row2[link_rewrite], $row2[id_image], 'home_default'); ça marche pas Link to comment Share on other sites More sharing options...
doekia Posted April 28, 2020 Share Posted April 28, 2020 $link->getImageLink($row2['link_rewrite'], $row2['id_image'], 'home_default'); ? Link to comment Share on other sites More sharing options...
leakimd Posted April 28, 2020 Author Share Posted April 28, 2020 OK problème résolut avec $context = Context::getContext(); $thisImagelink = $context->link->getImageLink($row2['link_rewrite'], $row2['id_image'], 'small_default'); reste plus qu'a le passer dans tpl Merci. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now