Ecommerce Blog - The #1 Source for Ecommerce News, Tips and Trends!

Get ecommerce updates, news, and insider tips from the experts at PrestaShop!

Ecommerce Blog - The #1 Source for Ecommerce News, Tips and Trends!
 

< Back to the Blog home

Take an Inside look at PrestaShop Modules

I. Module Installation and Configuration

a. Enhance your PrestaShop store with Modules

You’ve probably noticed that the instant you install PrestaShop, it comes fully equipped with a variety of modules. These modules deliver added functionality to your PrestaShop store such as payment processing, shipping solutions and marketing tools.

You can easily, add, install and configure these modules to fully customize your e-commerce store with the features you want.

b. Installing a module is easy!

All native modules are present in the solution during installation but only some are installed. To install a native module, all you need to do is login to your Back Office and navigate to the “Modules” tab. On a fresh install, you will find all of the native modules included in our solution. If you want to install a native module, simply locate it then click the “Install” button found on the right-hand side of the individual module block.

If you want to add a module that is separate from those included as native features inside PrestaShop, simply click the “Add new module” icon located at the top right-hand corner of your back office under the “Modules” tab, locate the module’s .zip file or tarball, then click “Upload this module.”

c. Module Configuration

After you install a module, you’ll want to make sure it’s configured properly. After all, a great module is useless until you correctly configure your modules’ settings.

Some modules, such as payment modules, require API credentials, a user ID and various other pieces of service information. In order to use these modules, you may need to sign up for a third-party subscription, after which you’ll be given the credentials needed for configuration. Other modules that do not require third-party subscription simply need to be optimized for your PrestaShop store. This process can be completed much the same way by clicking the configure tab after installation.

When configuration is complete, you will need to save your settings. Failing to do so will yield a non-working module.

If you have trouble finding a module, be sure to utilize our new Ajax Instant Search feature that can be found under the “Modules” tab in your PrestaShop Back Office.

d. Design your own modules

There are several ways to create your own module(s). First, you can customize a module that already exists, or you can design everything from scratch. Clearly, designing a module from scratch requires knowledge of the solution and the classes associated with modules (Module CarrierModule, PaymentModule, etc…).

A strong knowledge of older versions of PrestaShop will allow you to design a module capable of operating on all recent versions of PrestaShop, making the module more scalable and flexible.

II. Reusing an Existing Module

The easiest way to design your new module is by altering a module that already exists. When you are ready, simply copy and paste the module folder and rename it. Now, some steps are needed to ensure the proper functioning of your new module.

Structure of a module

After copying the module and changing the name of the directory, you need to change the name of the class file, the class name and its parameters.

To obtain a clear and organized file structure, our module, named “mymodule” for example, will be organized as follows:

  • Mymodule
    • css
    • img
      • logo.png
    • js
      • jquery.js
    • views
      • templates
        • back
          • config.tpl
        • front
          • about.tpl
    • config.xml
    • logo.gif
    • mymodule.php

You now have a class file with the same name as your module, mymodule.php. You just have to open it to change the code using a file editor like Notepad++. Many parameters can be added or changed, depending on the use of your module and how you want it to function.

You will need to structure the file “mymodule.php” like this:

<?php

/*
* License
*/

if (defined(‘_PS_VERSION_’) == false)
exit;

class MyModule extends Module
{
function __construct()
{
$this->name = ‘mymodule’;
$this->tab = ‘front_office_features’;
$this->version = 1.0;
$this->author = ‘My Name’;
$this->need_instance = 0;

parent::__construct();

$this->displayName = $this->l(‘My module’);
$this->description = $this->l(‘Description.’);
}

public function install()
{
return (parent::install() && $this->registerHook(‘rightColumn’));
}

public function hookRightColumn($param)
{
$this->smarty->display(’./views/templates/front/about.tpl’);
}
}

III. Starting from Scratch

You can also design your module from scratch. This would require that you clearly define all necessary parameters. These parameters are name, tab, version and author.

name: Serves as an internal identifier. Make it unique without special characters or spaces, and make sure to keep it lowercase.
tab: This is the title for the database table that will contain this module in the Back Office module list. You can use any name you want.
version: This is the version number for the module, displayed on the module list.
author: This is the author of the module, and it will be displayed on the PrestaShop module list.

Once you create your module, you can now add the final touches. You should include an Icon for your module which will be displayed next to the modules name. Having a logo attached to your module brings visible trust.

The icon file must respect these requirements:

In order to work with PrestaShop 1.5:

 IV. Publish and Sell your Module!

So, now that you’ve made an awesome PrestaShop module, what now? It’s simple! Start selling it on the PrestaShop Addons store today! Visit the PrestaShop Addons store, create a seller account, upload your module and set your prices. The module will go through a period of validation for security and bug testing. After it is validated and accepted, your module will be readily seen by thousands of customer’s each day. Using this service will help you publish your module so anybody can search, purchase and install your module in their PrestaShop store. If you chose to sell your module on PrestaShop Addons, you will be entitled to 70% of the total sales profit. PrestaShop will provide worldwide visibility to our 130,000+ merchant user base!

Visit the PrestaShop Addons store today!

Learn more about becoming a PrestaShop Addons Contributor

For more information on creating modules, consult our online documentation.

  1. Author: richard s

    Date: January 30, 2013 at 3:55 pm

    It is strange to me that there’s nothing about controllers and only views are mentioned. These changes to module structure (I am talking about controllers) are the essential part of PS1.5 update and there’s nothing about that. In addition, there are so many more necessary things for module development such as override capabilities are not mentioned, but we could treat this as a separate topic and it might not be mentioned on this kind of article.

  2. Author: Tauras

    Date: February 1, 2013 at 10:36 am

    Thank You Benjamin, but all this information is already available in developer’s guide. But what they missed is module for back-office, what should be more valueable. Now I have to look over the whole code to understand how everything works.

  3. I want to make it possible in the back als well in the front that the impact on productprices can have a third possibilty, namely a fixend price. Can domeinen tell me which modules I therefore have to change?

  4. Hello intelligent men,

    On Valentine’s Day I will lauch my webshop.. but there is a problem. On the left site of the shop I can see my pages but in the menu bar it does’nt exist??!!!

    Will you help me with the sollution? Please mail me at. info@steijnshouseofhappiness.com

    I only can make once, a first impression….

    Sparkling salute, Danielle Steijn

    • Author: benjamin utterback

      Date: May 22, 2013 at 6:52 pm

      Hello Danielle, actually the information given is not enough to give you a reliable solution. I suggest that you post a more detailed question, with any relevant info or URLs, to the PrestaShop forum. There are many active users who are ready to help and give advice. Check it out! http://www.prestashop.com/forums

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>