Jump to content

search.tpl add other query


sedatimben

Recommended Posts

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

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 by sedatimben (see edit history)
Link to comment
Share on other sites

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...