Hi I'm trying to do my first module.
I need to get a copy or the same $products array when I'm located on category page.
I have this code.
public function hookHeader($params)
{
if ('category' == $this->context->controller->php_self){
$products = //Here I need the same products array from this category
$this->smarty->assign('products', $products);
}
return $this->display(__FILE__, 'views/templates/hook/header.tpl');
}
Thanks!
Try this
This will grab 99 products out of the category.
Why can't you 'copy' the category's products? SImply because they have not been assigned yet when you call hookHeader, as the CategoryController comes after that
Also, be aware that will display content in the portion, and if you want to show anything you must use hookDisplayTop
Also, in 1.6 you should use $this->context->smarty :)