thecolmix Posted January 21, 2020 Share Posted January 21, 2020 Hello I am working on a module which should allow displaying the products of a category. but i have this error Notice: Undefined index: products in C:\xampp\htdocs\ldfmega\tools\smarty\sysplugins\smarty_internal_templatebase.php(171) : eval()'d code on line 89 Notice: Trying to get property of non-object in C:\xampp\htdocs\ldfmega\tools\smarty\sysplugins\smarty_internal_templatebase.php(171) : eval()'d code on line 89 Page php public function ProductCat() { $category = new Category(3); // Retrieves the first 15 products of a category $products = $category->getProducts($this->context->language->id, 1, 15); } Page tpl <div>{include file="$tpl_dir./product-list.tpl" products=$products }</div> Link to comment Share on other sites More sharing options...
MarlexLadag Posted January 22, 2020 Share Posted January 22, 2020 You lack something: $this->smarty->assign(array('product' => $product)); public function ProductCat() { $category = new Category(3); // Retrieves the first 15 products of a category $products = $category->getProducts($this->context->language->id, 1, 15); $this->smarty->assign(array('product' => $product)); } Link to comment Share on other sites More sharing options...
thecolmix Posted January 24, 2020 Author Share Posted January 24, 2020 thanks you 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