Prestashop: Searching orders by the products they contain via mysql

Source: https://www.prestashop.com/forums/topic/437518-searching-orders-by-the-products-they-contain/?tab=comments#comment-2033625

SELECT product_id, product_attribute_id, product_name, GROUP_CONCAT(id_order SEPARATOR ‘, ‘) AS orders FROM ps_order_detail group by product_name order by product_id, product_attribute_id

Can add where product_id = to the number you want to narrow down the specific product

SELECT product_id, product_attribute_id, product_name, GROUP_CONCAT(id_order SEPARATOR ‘, ‘) AS orders FROM ps_order_detail where product_id = XYZ group by product_name order by product_id, product_attribute_id

This entry was posted in database and tagged , , . Bookmark the permalink.