Child pages
  • Diving into PrestaShop Core development

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of contents

Table of Contents
maxLevel3

Diving into PrestaShop Core development

Fundamentals

Concepts

 

Info

You should be familiar with PHP and Object-Oriented Programming before attempting to write your own module.

PrestaShop was conceived so that third-party modules could easily build upon its foundations, making it an extremely customizable e-commerce software.

...

More than 1600 add-ons are also available at the official add-ons site.
These additional modules were built by the PrestaShop company or members of the PrestaShop community, and are sold at affordable prices.
As a developer, you can also share your modules on this site, and receive 70% of the amounts associated with the sale of your creations. Sign up now!

PrestaShop's technical architecture

PrestaShop is based on a 3-tier architecture:

...

Method name and parameters

Description

getValidationRules($className = _CLASS_)

Return object validation rules (fields validity).

getFields()

Prepare fields for ObjectModel class (add, update).

__construct($id = NULL, $id_lang = NULL)

Build object.

save($nullValues = false, $autodate = true)

Save current object to database (add or update).

add($autodate = true, $nullValues = false)

Save current object to database (add or update).

add($autodate = true, $nullValues = false)

Add current object to database.

update($nullValues = false)

Update current object to database.

delete()

Delete current object from database.

deleteSelection($selection)

Delete several objects from database.

toggleStatus()

Toggle object's status in database.

validateFields($die = true, $errorReturn = false)

Check for fields validity before database interaction.

The DBQuery class

The DBQuery class is a query builder, which helps you creation SQL queries. For instance:

...

Code Block
INSERT INTO `ps_hook` (`name`, `title`, `description`) VALUES ('nameOfHook', 'The name of your hook', 'This is a custom hook!');

 

 

 

$template

template name for page content.

$css_files

array list of css files

$js_files

array list of javascript files

$errors

An array of errors that have occurred.

$guestAllowed

Whether a customer who has signed out can access the page

$initialized

Whether the init() function has been called.

$iso

The iso code of the currently selected language.

$n

The number of items per page.

$orderBy

The field used to sort.

$orderWay

Whether to sort ascending or descending ("ASC" or "DESC").

$p

The current page number.