Question

Let's say I want to display the specials module on the homepage in a position different than $content_top, $content_bottom, $column_left or $column_right. How do I do that? If you have some experience with this, could you give me some pointers?

The module will be display in home.tpl but I'm assuming I would need to edit the controller file home.php

Was it helpful?

Solution

To do this, you will need to make edits to two files

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
));

The array is the settings for the module. Note that the layout, position, status and sort order aren't included, as they're irrelevant here. I've also used special_block as a unique key for the content, to avoid it conflicting with any other items that may need rendering

Then in your template file, you just need to use <?php echo $special_block; ?> wherever you want the module to go

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top