I am new to prestashop and I am trying to create a simple product filter to be displayed on the category page. I managed to output my filter on the page using the hook for the hookDisplayLeftColumn method, however I have a few questions. Right now I am hooking to the leftColumn but the filter will show on any page that has it.I want to show it only on the category page.
public function hookDisplayLeftColumn($params)
{
$data = array(
'bar' => 'foo'
);
$this->context->smarty->assign($data);
return $this->display(__FILE__, 'categoryfilter.tpl');
}
And this is the tricky part.How do I filter the products. Is there any method I can hook to and filter the results?
If you want to only include your code in category pages use something like:
public function hookDisplayLeftColumn($params)
{
if (!isset($this->context->controller->php_self) or $this->context->controller->php_self != 'category')
return false;
$data = array(
'bar' => 'foo'
);
$this->context->smarty->assign($data);
return $this->display(__FILE__, 'categoryfilter.tpl');
}