sedatimben Posted October 3, 2018 Share Posted October 3, 2018 Hi my english is very poor I need a show to result on the search page add this lines for SearchController page and serach.tpl file 1 - SearchController.php : $myvalue= "xxxxx"; $this->context->smarty->assign('myvalue', $myvalue); search.tpl : {$myvalue} is work 2 - $myvalue44= 'SELECT * FROM `ps_country` WHERE `id_country`=1'; ( ps_country or ps_product or ps_category ....) $myvalue = (Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($myvalue44)); $this->context->smarty->assign('myvalue', $myvalue); search.tpl : {foreach from=$myvalue item=row} {$row['id_product']} is work but this not work $myvalue44= 'SELECT * FROM `my_other_table` WHERE `my_other_id`=1'; ( tables I created , my table , my table 2 ) $myvalue = (Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($myvalue44)); $this->context->smarty->assign('myvalue', $myvalue); search.tpl : {foreach from=$myvalue item=row} {$row['id_product']} is not work I get data from the tables that prestashop uses but I can't get data from the tables I created myself , why? thansks Link to comment Share on other sites More sharing options...
Adeko.nl Posted October 3, 2018 Share Posted October 3, 2018 HI, The code looks fine, maybe var_dump the result in your smarty: {$myvalue|@var_dump} Perhaps it's a spelling error, or id_product doesn't exist in your table. Link to comment Share on other sites More sharing options...
sedatimben Posted October 3, 2018 Author Share Posted October 3, 2018 (edited) thanks for replay i clone table ps_product ------ ps_productOK1 SELECT * FROM `ps_product` WHERE `id_product`=60064 ps_product : {$myvalue|@var_dump} array(1) { [0]=> array(64) { ["id_product"]=> string(5) "60064" ["id_supplier"]=> string(2) "39" ["id_manufacturer"]=> string(1) ........ SELECT * FROM `ps_productOK1` WHERE `id_product`=60064 ps_productOK1 : {$myvalue|@var_dump} array(0) { } ? Edited October 3, 2018 by sedatimben (see edit history) Link to comment Share on other sites More sharing options...
sedatimben Posted October 3, 2018 Author Share Posted October 3, 2018 Adeko.nl thanks a million i have two sql 1 sql front and backoffice 2 other sql only search and update product i not cereate search database my_other_table (database 2) big mistake ohaaa :)) 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