Introduction to Prestashop Database Tables

Introduction to Prestashop Database Tables

The database is definitely an important component of PrestaShop, where it holds all the data of your shop including Products and Customers information.

It is good for both users and developers to be familiar with the database tables, so to understand the data structure of PrestaShop for better shop development.

We are going to introduce some important tables on below.

Global

There are lots of tables having the same suffix, which to store multiple entry of a data. For example, different languages of the name of a single product or the availability of a single product across different shop (If multi-shop is applied).

3 suffixes are commonly used across the tables:

  • _lang: Store information in different languages, usually name
  • _shop: Store the availability of the products across different shop
  • _group: Store the availability of the products across different customer group

Let’s see the below picture for a better explanation:

We are using a single product as an example. The data are mainly stored as a single row entry in ps_product table, while the data that may have multiple entries are stored in other table and they may link up by the ID. SQL examples is on below.

If we want to retrieve the info of product ID, names and price of all product:

SELECT p.`id_product`, pl.`name`, p.`price` FROM `ps_product` p
LEFT JOIN `ps_product_lang` pl ON p.`id_product` = pl.`id_product`

If we want to know the name is written in what language as well:

SELECT p.`id_product`, l.`name`, pl.`name`, p.`price` FROM `ps_product` p
LEFT JOIN `ps_product_lang` pl ON p.`id_product` = pl.`id_product`
LEFT JOIN `ps_lang` l ON pl.`id_lang` = l.`id_lang`

List of Important Tables

Various of core tables which storing essential are showed below with short explanation. An asterisk is used as a wildcard that match the related name (e.g. ps_product* = ps_product, ps_product_lang, ps_product_shop etc.):

  • ps_access: The access permission of different user role in back office
  • ps_attribute*: Product attributes
  • ps_carrier*: Carrier info
  • ps_cart*: Shopping cart info
  • ps_category*: Category info
  • ps_cms*: The page design html codes and info
  • ps_configuration: Module developers may familiar with this, where Configuration::updateValue modify the data here
  • ps_currency*: Shop currency
  • ps_customer*: Customer info
  • ps_employee*: Back office accounts
  • ps_feature*: Product features
  • ps_guest, ps_connection*: Saving the info of visitors
  • ps_hook*: Store the information of registered hooks by modules
  • ps_image, ps_image_lang, ps_image_shop, ps_image_type: Image settings and info
  • ps_manufacturer*: Manufacturer info
  • ps_module*: Module setting and info
  • ps_order*: Orders info
  • ps_product*: Product info
  • ps_profile*: User role of back office
  • ps_search*: Storing the searching aliases set in back office
  • ps_shop*: Shop name and setting (There will be multiple rows if you are using multi-shop function)
  • ps_stock*: Stock info
  • ps_supplier*: Supplier info
  • ps_tab*: Controlling the tabs in left sidebar of back office
  • ps_tag: Product tag
  • ps_translation: All the translation except modules are stored here
Important Tables Group by Related Content
Item Table Name
Back Office Accounts ps_tab*
Back Office Layout ps_access, ps_employee*, ps_profile*
Cart ps_cart*
Carrier ps_carrier*
Currency ps_currency*
Customer ps_customer*
Image ps_image, ps_image_lang, ps_image_shop, ps_image_type
Manufacturer ps_manufacturer*
Module ps_configuration, ps_hook*, ps_module*
Orders ps_order*
Products ps_attribute*, ps_category*, ps_feature*, ps_manufacturer*, ps_product*, ps_stock*, ps_supplier*, ps_tag
Search aliases ps_search*
Shop Settings ps_cms*, ps_page, ps_shop*
Stock ps_stock*
Supplier ps_supplier*
Translation ps_translation
To be Careful If You Are Editing These Tables

Wrong editing these tables may mess your shop up!

  • ps_access: Even the Super Admin may face “Access Denied” in back office if this table is wrongly edited
  • ps_configuration: PrestaShop or some module may not be work if some rows are deleted wrongly
  • ps_hook: The shop layout may be messed, although you can simply re-registered the hook via [Design] ⇒ [Position]
Still confuse about the tables? Just leave you question below!


Start typing and press Enter to search

slot gacor dana slot deposit dana