Prestashop-1.7: Примечание: неопределенный индекс: продукты
Я пытаюсь отобразить продукты в моем/modules/mymodule/views/templates/admin/mymodule.tpl
но я получаю ошибку "Notice: Undefined index: products".
Пожалуйста, смотрите мой код ниже.
class AdminMymoduleController extends ModuleAdminController
{
public function __construct()
{
$this->bootstrap = true;
$this->display = 'view';
parent::__construct();
$this->meta_title = $this->l('My module');
if (!$this->module->active) {
Tools::redirectAdmin($this->context->link->getAdminLink('AdminHome'));
}
}
public function renderView() {
$id_lang = $this->context->language->id;
$productObj = new Product();
$products_all = $productObj -> getProducts($id_lang, 0, 0, 'id_product', 'DESC' );
$this->context->smarty->assign(array(
'products' => $products_all
));
$tpl = $this->context->smarty->createTemplate(_PS_MODULE_DIR_.'/mymodule/views/templates/admin/mymodule.tpl');
return $tpl->fetch();
//return $this->display(__FILE__, 'mymodule.tpl');
}
}
Пожалуйста, кто-нибудь, помогите мне исправить это.