Jump to content

create a new module backoffice


Recommended Posts

Hello, i want create a new module backoffice for prestashop 1.5.3. I read official guide for developers, but not understand all.


I want understand how to create a simple module, for example a module that show 'Hello world' in new page of backoffice.


Tank you.

Link to comment
Share on other sites

Do you want to make a page like "configure" in your module?


There are a few functions you have to call and fill with your fields to show.

To start, look at a default prestashop module. I took blocklink the first time. It has a back office page ('config' link on module) where it creates a simple page where you can add a picture and add a link.


The main functions to look at are:

public function install()

things to do here:

create fields in ps_configuration, like:

Configuration::updateGlobalValue('<modulename>_<fieldname>', '<initial value>');


(N.B. in the standart prestashop ps_configuration table you can keep the 'current values' of your config screen or values you need for your module to work. In the example above you add a record to this table


public function uninstall()

things to do here:

delete fields in ps_configuration, like:



(when you uninstall the module, please keep the ps_configuration file clean...)


public function getContent()


if(Tools::isSubmit('submit')) // you press save in config screen


// update values in database with values from screen


htmlentities(Tools::getValue('id of accompanying field in config'), ENT_QUOTES, 'UTF-8'), True);



$this->_generateForm(); // show the config form

return true;



private function _generateForm()


// create fields, add id's, limit input etc., like rado buttons, check boxes, number fields etc, whatever you need on your screen to change the vaules for your module.

Probably starts with something like:


// general form header stuff

$this->formtoshow .= '<form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).

'" method="post" enctype="multipart/form-data">';


$this->formtoshow .= '<fieldset> <legend>'.$this->l('MySuperModule block configuration').'</legend>';



(n.b. formtoshow is an example of a varriable. It will conatain the html tags etc for your config screen. You can define this variable at the top, just under class <MySuperModule> extends Module


public $formtoshow;




protected function initialize()


// get current values out of ps_configuration table, before you show the form

$this->VarForMyFieldX = Configuration::get('Accompanying ID of field on config screen');





So, this shows a little bit of what should be done.

Have a look at modules/BlockLink/blocklink.php. Don't worry too much about the other functions you see here., like addlink, getlinks, deletelink, updatetitle etc. Those are for uploading an image etc., not for the basic config page.



Hpe it helped,


  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...