Saturday, April 2, 2016

opencart - How to manually display a module inside a template file?

firstly, you will need to edit the controller. In this example, I'm going to add the specials to the home page

So open the controller file catalog/controller/common/home.php. Somewhere before this line $this->response->setOutput($this->render()); add the following

$this->data['special_block'] = $module = $this->getChild('module/special', array(
    'limit' => 5,
    'image_width' => 80,
    'image_height' => 80
));


On the view
$special_block; will provide you  the content.

No comments:

Post a Comment