PrestaShop Developer Guide The technical documentation is currently being updated. Some aspects of it might not yet be fully updated. Do not hesitate
after said creation/duplication. updateproduct AdminProducts.php No Called when a product is update with a new picture, right after said update.
to. Carriers Hook name File location Visible Description updateCarrier AdminCarriers.php No Called during a carrier's update, right after
Module file tree All PrestaShop modules are found in the /modules folder, which is at the root of the PrestaShop main folder. This is true for both d
there's only one such file, it is good practice to give it the same name as the folder and main file: mymodule.tpl. The mymodule.php file must st
public function __construct() Defines the class' constructor. $this->name = 'mymodule'; $this->tab = 'Test'; $this-&g
public function install() { return ( parent::install() ); } In this first and extremely simplistic incarnation, this method is useless, since a
PrestaShop automatically creates a small config.xml file in the module's folder, which stores a few configuration information. You should NEVER
if ( parent::install() == false OR !$this->registerHook( 'leftColumn' ) ) return false; return true; We changed the original line to a
In the transplantation form, find "My module" in the modules drop-down menu, then choose "Left column blocks" in the "Hook in
Displaying content Now that we have access to the left column, we should display something there. As said earlier, the content to be displayed in the
This is the same principle as the Model–view–controller (MVC) architecture, only in a simpler and more accessible way. Our developer team chose not t
basic line, and call that file from mymodule_page.php, which will add the theme's header, footer, etc. You should strive to use explicit and rec
If you make multiple changes and reloads to your homepage, it may seem said changes do not apply. This is because Smarty caches a compiled version of
$mymodule = new MyModule(); $message = $mymodule->l( 'Welcome to my shop!' ); $smarty->assign( 'messageSmarty', $message );
currencies The various available currencies. id_currency_cookie ID of the current currency. currency Currency object (currently used currency).
Strings in TPL files will need to be turned into dynamic content, which Smarty will replace by the translation for the chosen language. In our sample
using the l() method), simply find your module in the list (use the browser's in-page search), and fill the empty fields. Once all strings for y
Now that we have a translation, we can click on the French flag in the front-office (provided the language has indeed been installed), and get the exp
protected $fieldsValidate = array( 'test' => 'isGenericName' ); protected $table = 'test'; protected $identifie
<form action="' . $currentIndex . '&submitAdd' . $this->table . '=1&token=' . $this->token . &ap
Some forums keep certain threads pinned on top of all threads; they contain some useful information, so be sure to read them through. Our bug-tracker
Database schema You can download the PrestaShop 1.4 SQL schema in PNG form (1 Mb), or in the original MySQL Workbench file format (you will need MySQ
Variable names 1. Corresponding to data from databases: $my_var 2. Corresponding to algorithm: $my_var 3. The visibility of a member variable does
10. When a method/function returns a boolean and the current method/function return depends on it, the if statement has to be avoided 11. 12. pub
Objects / Classes 1. Object name must be singular 2. 3. class Customer 4. Class name must follow the CamelCase practice except that the first le
7. $a = 17 + 23; // A comment inside my exemple function 8. Outside funcions and methods, only the "/" and "/" comment tags are
Tags 1. An empty line has to be left after the PHP opening tag 2. 3. <?php 4. 5. require_once('my_file.inc.php'); 6. The PHP end
Security 1. All user datas (datas entered by users) have to be casted. 2. 3. $data = Tools::getValue('name'); 4. 5. $myObject->st
2. 3. SELECT `firstname` 4. FROM `'. _DB_PREFIX_.'customer` 5. Back quotes ("`") must be used around field names and table na
enables you to handle the module's display in various ways, according to the current theme. Let's see an example with PrestaShop's bloc
When one of the site's pages is loaded, the PrestaShop engine check which are the modules to call for each of the hooks that make up the page. He
Ideal location for the content of a tab that has been defined using the productTab hook. Cart Hook name File location Visible Description cart C
authentication authentication.php No Called right after the client identification, only if the authentication is valid (e-mail address and password
backBeforePayment order.php No Called when displaying the list of available payment solutions. Ideal location to redirect the user instead of displ
"Payment accepted". updateOrderStatus Class: OrderHistory.php No Called when an order's status is changed, right before it is actua
Comments to this Manuals