# Fundamentals

/\*\<!\[CDATA\[\*/\
div.rbtoc1597308499220 {padding: 0px;}\
div.rbtoc1597308499220 ul {list-style: disc;margin-left: 0px;}\
div.rbtoc1597308499220 li {margin-left: 0px;padding-left: 0px;}\
\
/\*]]>\*/

* [Fundamentals](#Fundamentals-Fundamentals)
  * [Concepts](#Fundamentals-Concepts)
  * [PrestaShop's technical architecture](#Fundamentals-PrestaShop%27stechnicalarchitecture)
  * [Database schema](#Fundamentals-Databaseschema)

## Fundamentals <a href="#fundamentals-fundamentals" id="fundamentals-fundamentals"></a>

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

PrestaShop's customization is based on three possibilities:

* Themes,
* Modules,
* Overriding.

Themes are explored in full in the Design Guide: <http://doc.prestashop.com/display/PS15/Designer+Guide>.\
Modules and the override system are explored in this Developer Guide, starting with the "Concepts" section below. You can learn more about each in the following chapters:

* <http://doc.prestashop.com/display/PS15/Creating+a+PrestaShop+module>
* <http://doc.prestashop.com/display/PS15/Overriding+default+behaviors>

By default, PrestaShop is provided with more than 100 modules, enabling you to launch your online business quickly and for free.

More than 2000 modules are also available at the official [add-ons site](http://addons.prestashop.com/).\
&#x20;These additional modules were built by the PrestaShop company or members of the PrestaShop community, and are sold at affordable prices.\
&#x20;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](http://addons.prestashop.com/en/authentication.php#createnow)!

### Concepts <a href="#fundamentals-concepts" id="fundamentals-concepts"></a>

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

A module is an extension to PrestaShop that enables any developer to add the following:

* Provide additional functionality to PrestaShop.
* View additional items on the site (product selection, etc.).
* Communicate with other e-commerce services (buying guides, payment platforms, logistics, etc.).
* etc.

Overriding is a system in itself. PrestaShop uses completely object-oriented code. One of the advantages of this is that, with the right code architecture, you can easily replace or extend parts of the core code with your own custom code, without having to touch the core code. Your code thus overrides the core code, making PrestaShop behave as you prefer it to.

### PrestaShop's technical architecture <a href="#fundamentals-prestashopstechnicalarchitecture" id="fundamentals-prestashopstechnicalarchitecture"></a>

PrestaShop is based on a [3-tier architecture](http://en.wikipedia.org/wiki/Multitier_architecture#Three-tier_architecture):

* **Object/data**. Database access is controlled through files in the "classes" folder.
* **Data control**. User-provided content is controlled by files in the root folder.
* **Design**. All of the theme's files are in the "themes" folder.

![](https://2105846932-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Fprestashop-1-5-documentations%2F-MEb-VxROPH9tze7tOJR%2F-MEb-hA6ttYe0TPHg-z5%2F13697026.png?generation=1597308610828673\&alt=media)

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 to use a PHP framework, such as Zend Framework, Symfony or CakePHP, so as to allow for better readability, and thus faster editing.\
This also makes for better performances, since the software is only made of the lines of code it requires, and does not contain a bunch of supplemental generic libraries.

A 3-tier architecture has many advantages:

* It's easier to read the software's code.
* Developers can add and edit code faster.
* Graphic designer and HTML integrators can work with the confines of the `/themes` folder without having to understand or even read a single line of PHP code.
* Developers can work on additional data and modules that the HTML integrators can make use of.

#### Model <a href="#fundamentals-model" id="fundamentals-model"></a>

A model represents the application's behavior: data processing, database interaction, etc.

It describes or contains the data that have been processed by the application. It manages this data and guarantees its integrity.

#### View <a href="#fundamentals-view" id="fundamentals-view"></a>

A view is the interface with which the user interacts.

Its first role is to display the data that is been provided by the model. Its second role is to handle all the actions from the user (mouse click, element selection, buttons, etc.), and send these events to the controller.

The view does not do any processing; it only displays the result of the processing performed by the model, and interacts with the user.

#### Controller <a href="#fundamentals-controller" id="fundamentals-controller"></a>

The Controller manages synchronization events between the Model and the View, and updates both as needed. It receives all the user events and triggers the actions to perform.

If an action needs data to be changed, the Controller will "ask" the Model to change the data, and in turn the Model will notify the View that the data has been changed, so that the View can update itself.

### Database schema <a href="#fundamentals-databaseschema" id="fundamentals-databaseschema"></a>

![](https://2105846932-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Fprestashop-1-5-documentations%2F-MEb-VxROPH9tze7tOJR%2F-MEb-hA8kWjkp3VFzmNY%2F10125315.png?generation=1597308610798926\&alt=media)

You can download the PrestaShop 1.5 SQL schema [in PDF form (3.76 Mb)](https://app.gitbook.com/s/-MEazRSQmcgwfj3eA7DD/english-documentation/developer-guide/PS15/attachments/9404440/17530900.pdf), or [in the original MySQL Workbench file format](https://app.gitbook.com/s/-MEazRSQmcgwfj3eA7DD/english-documentation/developer-guide/PS15/attachments/9404440/17530898.mwb) (you will need [MySQL Workbench](http://wb.mysql.com/) to view it).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.prestashop-project.org/1-5-documentation/english-documentation/developer-guide/fundamentals.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
