For this you often use an external addon, or a custom made module which will for example allow to add an additional HTML block to the location of your choice, with a different content for each product.
Most of the time, this type of module adds a new table to the database, to store the contents of the field.
In other cases, it just adds a new topic to an already existing PrestaShop table, such as the "product" or "product_shop" table.
The question that you often ask us is: is it possible to display the contents of this type of
non-standard fields in PrestaPricing or Merlin Backoffice ®, to see and modify its content for each product ?
The answer is yes, of course, thanks to the "Custom" columns.
For this tutorial, we will take a very concrete case, with the use of a colleague's module: "Products Stock Threshold". This addon does not add a field to the display but a numeric parameter to each product. In this case a quantity threshold, which triggers an alert when it is reached. Once installed, this addon adds a new tab entry in the product listing back office to enter this "Stock threshold":
The principle remains the same, this module has added its own table in the database (pss_products_stock_threshold), and saves the values in a field called "quantity". This information is rarely documented, but most of the time, the name of the added table or tables refers to the name of the module. It is therefore quite easy, in PHPMyAdmin, to find this information. If you do not find this info, simply ask the developer of the module: "What are the names of the table and the field containing the values of the custom field?".
For the module used in this tutorial, here is a cature of PHPMyAdmln, showing the structure of the table found in the database, after its installation:
Warning, the name of the table must be entered without its prefix (here I removed the prefix pss_):
You can also (2), give the title you want to your column.
Change of title given to the column:
From there, it is possible to:
It is not possible (for the moment):
Additional note: The above case was fairly simple because the pss_products_stock_threshold table contained an id_product colmn. This is called a direct link. Sometimes it will require to enter sql code to define a connection between the tables of the database. You may alos need to define filters by language, by shop ... All this requires a good technical knowledge of the sql syntax and was not covered in this tutorial. But be aware that it is feasible ....
Category's other articles