在模板中获取 NULL - OpenCart 2.0

Getting NULL in template - OpenCart 2.0

我正在尝试在 home.tpl 中呈现 product_list.tpl 文件,但它给了我 NULL

控制器文件:

/controller/product/product_list.php

代码:

class ControllerProductProductList extends Controller {
    public function index() {

        $this->load->model('catalog/category');

        $this->load->model('catalog/product');

        $this->load->model('tool/image');

        $filter_data = array(
                'filter_tag'          => 'featured',
                'limit'               => 9
            );
        $data['results'] = $this->model_catalog_product->getProducts($filter_data);
        if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/common/productlist.tpl')) {
            $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/common/productlist.tpl', $data));
        } else {
            $this->response->setOutput($this->load->view('default/template/common/productlist.tpl', $data));
        }
    }
}

要呈现的模板

/template/product/productlist.tpl

代码:

<?php var_dump($results); ?>
<h2>Product are here</h2>

然后在home.php控制器中添加这一行

$data['special_mod'] = $this->load->controller('product/product_list');

并在 common/home.tpl 文件中打印 $special_mod

问题出在/controller/product/product_list.php

方法 $this->response->setOutput 不只是 return 值,而是将用户发送到不同的页面,而我想要的只是将 productlist.tpl 作为字符串输出我不得不更换代码

if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/common/productlist.tpl')) {
            $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/common/productlist.tpl', $data));
        } else {
            $this->response->setOutput($this->load->view('default/template/common/productlist.tpl', $data));
        }

if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/common/productlist.tpl')) {
            return $this->load->view($this->config->get('config_template') . '/template/common/productlist.tpl', $data);
        } else {
            return $this->load->view('default/template/common/productlist.tpl', $data);
        }