0

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

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

public function initContent()
    {
        parent::initContent();
        $products = Product::getProducts(Context::getContext()->language->id, 0, 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 注意:未定义索引:覆盖

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

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

我在这里想念什么?

谢谢你的时间。

4

0 回答 0