How to add custom SQL Queries in PrestaShop 1.5

Our first article in our course on Working with SQL Manager discusses the ability for you to work with custom SQL queries. It is a complex technical feature and should only be used by those familiar with the SQL database query language, however, it can be a very powerful tool if used properly.

Adding SQL queries in PrestaShop 1.5

  1. Log into your PrestaShop 1.5 dashboard.
  2. Using the top menu bar, hover over the Advanced Parameters tab and click on the SQL Manager option from the menu.
  3. You are now on the SQL Manager page. To add a new custom query, click on the green Add New button found in the upper right hand corner of the screen.
    add-query
  4. This brings you to the query build screen. There are two fields here, Name and Request. Both are required. The Name field is simply the name you want to give your query. The Request field is where you type your SQL query code in. Our query is a very simple one that selects data from all the fields from the ps_product table.
    build-query

     
    Below that is an area where you see a list of all the tables within your PrestaShop 1.5 database. You can highlight any table and see the fields associated with that table on the right. This way you can get the field names you need to help build a complex query. table-list

  5. Once you have your query constructed, click the Save button located underneath the Request field. This will save your query and return you to the Query list page. You will see your new query in the list.
    add-query-after

Comments

It looks like this article doesn't have any comments yet - you can be the first. If you have any comments or questions, start the conversation!

Was this article helpful? Let us know!