How to add custom SQL Queries in PrestaShop 1.5Written by Scott Mitchell
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
- Log into your PrestaShop 1.5 dashboard.
- Using the top menu bar, hover over the Advanced Parameters tab and click on the SQL Manager option from the menu.
- 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.
- 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.
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.
- 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.