We believe Simplicity is the ultimate sophistication.

How to create a Prestashop module with minic skeleton

First of all i would like to inform you that this is my very first tutorial and blog post as well. I`m not a writer so do not expect a high quality for now

This is a simple Prestashop module creation tutorial intorduce the advantages of our skeleton module. We created this module to speed up our module development process, because starting from the ground can take away lots of time.

You might think this is a lot to read, but believe me, isn’t. If you don’t know these basic things about Prestashop development you can turn and do not waste your time with this short tutorial.

Lets start

I assume you have a development environment and a good text editor (I use Sublime Text 2).

So lets download the module, can be found on our blog (here) on the Prestashop forum and on Github (if you downloaded from Github you have to rename the unzipped folder, remove the -master from the end of the folder name).

After download, unzip the content of the .zip file, and move it into your Prestashop modules folder, go to the backend of you store and you already can see that the module is there.

You can install if you want and see, that its working well, of course there are no configuration for the module.

Renaming / Replacing

If you wish, and you should, you have to rename the module. This mean a little search & replace job, with a good text editor can be done within no time.

First of all lets rename the module folder and module class (if you installed the module then uninstall it now).

Go into the module folder and rename the minicskeleton folder, here i`ll call it minictutorial. When you are done, browse the folder and you should rename 4 files:

minicskeleton.php – located in the root of the module folder

minicskeleton.css – located in the views/css/ folder

minicskeleton.js – located in the views/js/ folder

minicskeleton.tpl – located in the views/templates/admin/ folder

Now open the newly renamed php file, and change the class name.

class MinicTutorial extends Module

Do no close the file, there are other places where you should replace the name. Go and start with the __construct() function.

After this a few little thing is remained. You have to change the names in the .tpl files, to respect the translation standards. Basically you’ll change the content of 2 files, the minictutorial.tpl which was renamed previously, and the home.tpl.

The third file is the quick_link.tpl which is located in the views/templates/hooks/ folder and needed by the dashboard on the backend. In this file you can add a custom icon to show up on the dashboard, a name and a description (this doesn’t show up by default).

Feel free to change everything as you need, the only important thing is to change the minicskeleton to minictutorial.

As you can see i have changed the package_add.png to the module logo, so on the dashboard that will be appear.

Finishing touches

There are a few non-important / important thing, which depends on your goals with this module. These are the license, the logoand the changelog/readme. The module contains the GPLv3 license, the full license text can be found in the license.txt. The module main php file (now minictutorial.php) contains a notice of the license with the copyright holder which is Minic Studio S.R.L. , its strongly recommended to change at least this to your name / company.

The changelog and readme files can be removed if you do not wish to use them. The logo can be changed to yours as well, a 32×32 px PNG and a 16×16 px GIF icon is needed, these appear in the module list and in the module search.

Conclusion

Basically we are done.

You have your own module which at the moment do nothing, you can install / uninstall it but thats all. If you read the tutorials on the Prestashop documentation page you can find your path to make awesome modules in the future.

Our skeleton modules basically do nothing just a little help for those who develop modules frequently and want to speed up things.

I`m planning to continue this tutorial in the future with a simple module which can do “things”, handle multilanguage and multistore.

Finally
I`m open to module ideas, so feel free to add an advice in the comments.

Very nice idea, thank you.
It would be nice to have a “how to” for a database manipulation, for instance (very simple) to change the status of orders ticking a list, so changing all “sent” orders to “delivered”.
With Prestashop you have to do that one by one.
All the best