Search code examples
phpopencartopencart2.xocmod

Load the output of Store module in menu opencart2


I have a "Store" module and I need to put the output of it in the menu which is rendered by /catalog/view/theme/journal2/template/journal2/menu/main.tpl

It's controller is in catalog/controller/journal2/menu.php

What I have tried :

 <file path="catalog/controller/journal2/menu.php">
    <operation>
    <search><![CDATA[$this->template = $this->config->get('config_template') . '/template/journal2/menu/main.tpl';]]></search>
    <add position="before"><![CDATA[
    $data['ac_all_stores'] = $this->load->controller('module/store');
    ]]></add>
    </operation>
</file>

and

 <file path="catalog/controller/module/store.php">
    <operation>
    <search><![CDATA[return $this->load->view($this->config->get('config_template') . '/template/module/store.tpl', $data);]]></search>
    <add position="after"><![CDATA[
    $this->load->view($this->config->get('config_template') . 'template/journal2/menu/main.tpl', $data);
    ]]></add>
    </operation>
</file>

But none of these works. Output of the module is still not visible in menu's main.tpl Can anyone please tel how to do it right? Thanks in advance!


Solution

  • I have managed to solve that by putting

        $this->data['ac_all_stores'] = $this->load->controller('module/store');
    

    instead of

       $data['ac_all_stores'] = $this->load->controller('module/store');