sebi91650 Posted May 9, 2014 Share Posted May 9, 2014 Bonjour à toute la communauté! Je fais appel à vos lumières concernant un problème que je rencontre actuellement. Je voudrais afficher deux images différentes d' un produit selon qu' on clique sur une catégorie spécifique ou les autres catégories. J' ai donc créé une condition dans product-list.tpl : {if $category->id == 45} <img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" /> {else} <img src="{$link->getImageLink($product.link_rewrite, $product.id_image2, 'home_default')}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" />{/if} J' ai ensuite défini la deuxième image dans la classe produit : $row['id_image2'] = Category::getProductsImgSupp((int)$row['id_product']); Puis ajouter la fonction getProductsImgSupp dans la classe category : public function getProductsImgSupp($product_id) { $sql = ' SELECT id_image, id_product from `'._DB_PREFIX_.'image` WHERE id_product="'.$product_id.'" ORDER BY `position` ASC LIMIT 1,1 '; $result = Db::getInstance()->ExecuteS($sql); return $result[0]['id_product'].'-'.$result[0]['id_image']; } Et bien évidemment ça ne fonctionne pas! Merci d' éclairer ma lanterne svp! 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