Uploading a module in OpenCart

OpenCart is module-based system that allows us to extend functionalities with unlimited module instance system. What unlimited module instance system means is we can show many module of one module in same page and in many different pages. Let’s take example of Banner module, we can show multiple banners in multiple places of one page and in other pages also.

Okay to upload a module I will show you two ways, one through FTP and another through Admin panel which also need FTP enabled. I am using OpenCart 2.3.0.2, similar way for 2.2.

First let’s install through FTP:

Another way is through Admin Panel:

Login into store administration panel and go to Extensions >> Extension installer.

module-installer

Now click on the upload button, a popup will show where you select zip file which ends with *.ocmod.zip or xml file which ends with *.ocmod.xml. Then click Ok. If you got success message then files are uploaded properly.

module-upload-success

Now go to Extension >> Modifications, then click the clear button near refresh button and check the Log tab.

If you see any errors then you have to solve them before clicking refresh. Some error may be like below:

2016-09-09 3:05:26 - MOD: Modification Default

FILE: system/engine/action.php

REGEX: ~(require|include)(_once)?\(([^)]+)~

FILE: system/engine/loader.php

REGEX: ~(require|include)(_once)?\(([^)]+)~

FILE: system/library/config.php

REGEX: ~(require|include)(_once)?\(([^)]+)~

FILE: system/library/language.php

REGEX: ~(require|include)(_once)?\(([^)]+)~

FILE: system/library/template/php.php

REGEX: ~(require|include)(_once)?\(([^)]+)~

FILE: system/library/template/tiwg.php

REGEX: ~(require|include)(_once)?\(([^)]+)~

MOD: Newsticker

FILE: admin/controller/common/column_left.php

CODE: if ($this->user->hasPermission('access', 'design/layout')) {

FILE: admin/language/en-gb/common/column_left.php

CODE: $_['text_affiliate']

CODE: if ($this->user->hasPermission('access', 'design/layout')) {

NOT FOUND - OPERATIONS ABORTED!
----------------------------------------------------------------

If you don’t see any error then click refresh.

refresh-button

Whenever you enable / disable or delete a modification you need to click the refresh button to rebuild your modification cache!

If you click refresh and see error then you have to delete folder inside system\storage\modification, don’t delete index.html, then check log again and solve it before you click refresh. If errors keep on showing then better not to use the module or hire experts.

Sometime you may get following errors while uploading module:

FTP needs to be enabled in the settings:

Your ftp is not enabled at your store, see this post how to enable it.

Invalid file type! :

You uploaded incorrect files and folders. Check whether the file name or zip ends with .ocmod.zip or ocmod.xml

While uploading the module if any files get overridden then it will show like below:

fileoverriden

Be sure you did not overridden your core files.

Could not connect as yoursitename.com:21

It means that it is unable to connect to your ftp. Check your ftp username, password and port.

For an OCMOD file to be uploaded the file, the file extension must be either *.ocmod.zip or ocmod.xml. I think this is done to prevent from uploading non OCMOD files from the store admin.

File structure of OCMOD compressed zip ocmod.zip files may look like below but can differ as per the functionalities of the module:

ocmod_file_structure

  • Upload folder (All files under this directory will be uploaded to the directory of your OpenCart installation)
  • sql (Database queries to add any create, drop, insert and update queries)
  • php (If the modification requires any custom PHP code then it needs to be placed here)
  • xml (The XML modification files which have similar structure to VQMOD but have some changes)

Another file that we can upload is xml file then make sure it ends with NAME.ocmod.xml.

After installing the module and following above steps, if you did not see any changes then you need to check the error logs of Ocmod at system/storage/logs

Modification requires a unique ID code!:

It means you have to open your .ocmod.xml file and change the text to unique text which is inside <code></code>

module-installer

 

 

The final step of the installation process is to apply the changes we have just made. In order to do so, go to Extensions -> Modifications and click the Refresh sign at the upper right corner of the page.

Installing a module:

Installing a module in OpenCart 2.x using the Extension installer is easy and intuitive. Go to Administration >> Extensions >> Modules in below OpenCart 2.3 but in above OpenCart 2.3 go to Administration >> Extensions then in the dropdown filter of “Choose the extension type”, select “Module”, you will see list of modules.

modue-filteration

Now you can install module by clicking, Green + sign to install, red – sign to uninstall and red delete sign to delete, blue +  sign to add another instance of module and blue pencil sign to edit the module.

module-install-uninstall

Uninstalling a module

Uninstalling is the easiest task that I have ever done. Go to Extensions >> Choose Modules, find the module that you want to uninstall in the Modules list and click on the uninstall red minus button. Then go to Extensions >> Modifications, click on the Uninstall button of the module that you want to uninstall and click Refresh sign. You are set and your module gets uninstalled.

Remove a module

First uninstall the module then you have to delete every files that you upload when you install the module to remove a module.

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here