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.
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`
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 officeps_attribute*
: Product attributesps_carrier*
: Carrier infops_cart*
: Shopping cart infops_category*
: Category infops_cms*
: The page design html codes and infops_configuration
: Module developers may familiar with this, where Configuration::updateValue modify the data hereps_currency*
: Shop currencyps_customer*
: Customer infops_employee*
: Back office accountsps_feature*
: Product featuresps_guest, ps_connection*
: Saving the info of visitorsps_hook*
: Store the information of registered hooks by modulesps_image, ps_image_lang, ps_image_shop, ps_image_type
: Image settings and infops_manufacturer*
: Manufacturer infops_module*
: Module setting and infops_order*
: Orders infops_product*
: Product infops_profile*
: User role of back officeps_search*
: Storing the searching aliases set in back officeps_shop*
: Shop name and setting (There will be multiple rows if you are using multi-shop function)ps_stock*
: Stock infops_supplier*
: Supplier infops_tab*
: Controlling the tabs in left sidebar of back officeps_tag
: Product tagps_translation
: All the translation except modules are stored here
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 |
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 editedps_configuration
: PrestaShop or some module may not be work if some rows are deleted wronglyps_hook
: The shop layout may be messed, although you can simply re-registered the hook via [Design] ⇒ [Position]
Related Post
Alipay in Stripe Setup and implementation for Consumption Voucher Scheme (Prestashop)
Deprecated: Function create_function() is deprecated in /opt/lampp/htdocs/genkiware/wp-content/themes/optima/single.php on line 185
I think many merchants in Hong Kong are so busy…
How to configure “Traffic & SEO” in Prestashop
Deprecated: Function create_function() is deprecated in /opt/lampp/htdocs/genkiware/wp-content/themes/optima/single.php on line 185