Page 1 of 1

Howto build any html based module

Posted: Wed Feb 03, 2010 3:36 pm
by saccarrep
For this, you need to download Simple HTML Module first here http://www.opencart.com/index.php?route ... ion_id=396
because this is based on this module.

This is to show that you can easily make your own module as long as it is based on html code. For this example I will make Yahoo Pingbox module and it is easily configured for other like instant messanging status, counter, ads, announcement, etc.

Before we start you also need Yahoo Pingbox code, if you haven't yet you can get it here http://messenger.yahoo.com/pingbox/

Ok lets start.

1. extract simple HTML module and you will get these files

mymodule\admin\controller\module\mymodule.php
mymodule\admin\language\english\module\mymodule.php
mymodule\admin\view\template\module\mymodule.tpl
mymodule\catalog\controller\module\mymodule.php
mymodule\catalog\language\english\module\mymodule.php
mymodule\catalog\view\theme\default\template\module\mymodule.tpl

2. rename all files to your module name. For this I rename mymodule to yahoo_pingbox so the files become

yahoo_pingbox\admin\controller\module\yahoo_pingbox.php
yahoo_pingbox\admin\language\english\module\yahoo_pingbox.php
yahoo_pingbox\admin\view\template\module\yahoo_pingbox.tpl
yahoo_pingbox\catalog\controller\module\yahoo_pingbox.php
yahoo_pingbox\catalog\language\english\module\yahoo_pingbox.php
yahoo_pingbox\catalog\view\theme\default\template\module\yahoo_pingbox.tpl

3. open yahoo_pingbox\admin\controller\module\yahoo_pingbox.php on line 2 rename MyModule to YahooPingbox
before : class ControllerModuleMyModule extends Controller {
after : class ControllerModuleYahooPingbox extends Controller {
search text mymodule and replace it with yahoo_pingbox

4. open yahoo_pingbox\admin\language\english\module\yahoo_pingbox.php
search text My Module and replace it with Yahoo Pingbox
search text HTML Code to Yahoo Pingbox Code

5. open yahoo_pingbox\admin\view\template\module\yahoo_pingbox.tpl
search text mymodule and replace it with yahoo_pingbox

6. open yahoo_pingbox\catalog\controller\module\yahoo_pingbox.php on line 2 rename MyModule to YahooPingbox
before : class ControllerModuleMyModule extends Controller {
after : class ControllerModuleYahooPingbox extends Controller {

7.open yahoo_pingbox\catalog\language\english\module\yahoo_pingbox.php
replace text My HTML Module with Yahoo Pingbox

8. no need to change yahoo_pingbox\catalog\view\theme\default\template\module\yahoo_pingbox.tpl

That's it. Upload to your opencart, install and enable it from admin area. Just paste the code from yahoo pingbox to the yahoo pingbox code area.

Now if you want to make other module, for example module to show ads just follow the above step accordingly.

Note: if your site multilingual, don't forget to make the language file too.

Cheers ;)
Yahoo Pingbox.png

Yahoo Pingbox Module - Yahoo Pingbox.png (15.04 KiB) Viewed 8965 times


Re: Howto build any html based module

Posted: Wed Feb 10, 2010 9:54 am
by Ben
Hi, thanks for this module and guide, I love it. But I cannot get the latest version to work (v1.3 02/02/2010).

When I add a title and content in the admin section, it will not show up on the front end - it will only display default values.

The previous version works fine (v1.1 28/01/2010).

Re: Howto build any html based module

Posted: Fri Feb 12, 2010 10:42 pm
by saccarrep
Ben wrote:When I add a title and content in the admin section, it will not show up on the front end - it will only display default values.

The previous version works fine (v1.1 28/01/2010).
Well that's strange, it seems ok in my case ???

Re: Howto build any html based module

Posted: Sun Feb 28, 2010 3:58 am
by bugsjr
Is there a way to make this module for 1.3.2 version of opencart? I have install the 1.4.x module version but when i hit the edit button it's shows me a black page... ???
Thanks

Re: Howto build any html based module

Posted: Tue Mar 09, 2010 7:05 pm
by saccarrep
bugsjr wrote:Is there a way to make this module for 1.3.2 version of opencart? I have install the 1.4.x module version but when i hit the edit button it's shows me a black page... ???
Thanks
Unfortunately it is for oc 1.4 only

Re: Howto build any html based module

Posted: Thu Apr 01, 2010 4:38 pm
by dramony
me also, i need this for my 1.3.2.

Thanks!

Re: Howto build any html based module

Posted: Sat May 22, 2010 5:08 pm
by American
You need to amend your instructions:
6. open yahoo_pingbox\catalog\controller\module\yahoo_pingbox.php on line 2 rename MyModule to YahooPingbox
before : class ControllerModuleMyModule extends Controller {
after : class ControllerModuleYahooPingbox extends Controller {
And add:
search text mymodule and replace it with yahoo_pingbox
so it reads:
6. open yahoo_pingbox\catalog\controller\module\yahoo_pingbox.php on line 2 rename MyModule to YahooPingbox
before : class ControllerModuleMyModule extends Controller {
after : class ControllerModuleYahooPingbox extends Controller {
search text mymodule and replace it with yahoo_pingbox
Otherwise if you have another of your modules installed it will want to use the content from that module.

Re: Howto build any html based module

Posted: Tue Jun 01, 2010 3:33 pm
by gunset
solved...