Rohit
Rohit

Reputation: 370

Custom Module in Open Cart not showing in admin section

I am a newbee to opencart and php.

I am trying to create a custome category module to display categories on home page.

I copied the respective files in MVCL folders ,changes the name of classes with the file's name .

But the module is not not showing in the list of modules in admin section.

I dont know where i am making a wrong move.

Is there any way to create a module in opencart?

thanks

Upvotes: 2

Views: 2219

Answers (1)

B-and-P
B-and-P

Reputation: 1713

You did not forget to copy and rename files in admin by any chance? The are two sets of files, one in catalog and one in admin.

Aside from changing names of files and classes, you need to change setting and config names. Basically, find and change all references to category with your own, e.g. my_category.

$this->model_setting_setting->editSetting('category', $this->request->post);
...
if (isset($this->request->post['category_module'])) {
        $this->data['modules'] = $this->request->post['category_module'];
    } elseif ($this->config->get('category_module')) { 
        $this->data['modules'] = $this->config->get('category_module');
    }   

etc. Also in tpl, change form field names, example:

<select name="category_module[<?php echo $module_row; ?>][layout_id]">

change to:

<select name="my_category_module[<?php echo $module_row; ?>][layout_id]">

This goes for both, admin and catalog files.

Upvotes: 1

Related Questions