如何在自定义模块的视图中列出产品? (PS 1.7)

问题描述

我使用的是 prestashop 1.7,我需要在我的自定义模块的前端模板中显示一个给定类别的产品列表。

目前我在模块的显示控制器中得到这样的 $products

public function initContent()
    {
        parent::initContent();
        $products = Product::getProducts(Context::getContext()->language->id,NULL,'id_product','ASC',3);
        $products_all = Product::getProductsProperties($this->context->language->id,$products);
        $this->context->smarty->assign(array(
            'products' => $products_all
        ));
        $this->context->smarty->assign('products',$products_all);
        $this->setTemplate('module:goodies/views/templates/front/display.tpl');
    }

在视图中我复制了产品微型 tpl 文件内容

但我得到这个例外:

ContextErrorException 注意:未定义索引:cover

我已正确上传了产品封面,并在使用 print_r 显示我的产品数组时得到了一个产品。

正如我所说,我从未修改过 tpl 列表产品部分。

在这里遗漏了什么?

感谢您的时间。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)