spemar Posted January 25, 2013 Share Posted January 25, 2013 I need to insert a 2nd image in product comparison page . The mysql query is: SELECT id_image FROM ps3image WHERE id_product = X AND position = 2 How can I insert in products-comparison.tpl ?? Thanx Marco Link to comment Share on other sites More sharing options...
be_tnt Posted January 26, 2013 Share Posted January 26, 2013 Hello! The tpl is not a place for SQL query. What you can do is to override the product controller and add this information in a smarty variable. Link to comment Share on other sites More sharing options...
spemar Posted January 26, 2013 Author Share Posted January 26, 2013 Can you please do an example? Link to comment Share on other sites More sharing options...
spemar Posted January 27, 2013 Author Share Posted January 27, 2013 I've add this line code in ProductController: public function imagePos2() { $result = Db::getInstance()->executeS(' SELECT `id_image` FROM `'._DB_PREFIX_.'image` WHERE `id_product` = '.(int)$id_product.' AND position = 2'); $smarty>assign('ImEtich', $result); } How to get image in product-comparison.tpl? Link to comment Share on other sites More sharing options...
be_tnt Posted January 27, 2013 Share Posted January 27, 2013 (edited) I guess imagePos2 is called by the hook function, right? In that case, ImEtich variable is accessible for the tpl. Edited January 27, 2013 by be_tnt (see edit history) 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