Jump to content

Retrieve searched products data from Template


NemoPS
 Share

Recommended Posts

Hi,

I'm currently developing a search filter module, but i'm having issues retrieving searched products data. I first tried using Smarty funzion getTemplateVars('search_products'), but since Prestashop search engine takes care of pagination, i only get data for products in the current page. Is there a way for bypassing pagination? Else i'd have to query again Search::find and that would cost a huge amount of mySQL requests being performed almost uselessly.

 

I really hope somebody can help me

 

Best regards

Share this post


Link to post
Share on other sites

  • 3 years later...
Hi Nemo.

 

I'm trying to retrieve the search_products as you did it on this post.

 

In my module I tried getTemplateVars('search_products');

 



public function hookActionSearch($params)
{
$my_var = $this->context->smarty->getTemplateVars();

$var_dump($my_var);
}


The same on hookHeader,

 



public function hookHeader($params)
{
$controller_name = Tools::getValue('controller');

if ($controller_name !== 'search')
$my_var = $this->context->smarty->getTemplateVars();

$var_dump($my_var);
}


but in the dump I don't see the search_result.

 

The performed test it's on a non ajax search result page.

 

How did you get to search_products?

 

Thanks!

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More