SQL templates/PrestaShop

Top selling products in PrestaShop

Find your best-selling PrestaShop products by units sold and revenue.

PrestaShop · PostgreSQL
SELECT pl.name AS product,
       SUM(od.product_quantity) AS units_sold,
       ROUND(SUM(od.total_price_tax_incl), 2) AS revenue
FROM ps_order_detail od
JOIN ps_product_lang pl
  ON od.product_id = pl.id_product AND pl.id_lang = 1
GROUP BY pl.name
ORDER BY revenue DESC
LIMIT 20;

How it works

Joins order details to the product name table and aggregates quantity and revenue per product. Run it on a cloned copy of your store so the heavy GROUP BY never touches production.

Run this on your own database

BeQuery mirrors your PrestaShop MySQL database to an isolated PostgreSQL copy, so you can run queries like this one without ever touching production.

Start free No credit card