Jump to content

Finding out who has bought a particular item


Recommended Posts

On my PrestaShop v1.6.0.14 test site, I was able to go to the Stats tab in the Back Office and then click the "Best-selling products" section to see how many of each product has been sold and the number of page views. I don't see an option to see which customers bought a particular product though. To do that, you'd have to go to the Advanced Parameters > SQL Manager tab and write an SQL query to do that. Something like the following should work:

SELECT DISTINCT c.`id_customer`, c.`firstname`, c.`lastname` FROM `ps_customer` c LEFT JOIN `ps_orders` o ON (c.`id_customer` = o.`id_customer`) LEFT JOIN `ps_order_detail` od ON o.`id_order` = od.`id_order` WHERE od.`product_id` = 1

Change ps_ to your database prefix and 1 to the ID of the product you want to get the customers for. After saving the SQL query, you can click the Export button to open a CSV file with the results. When you need to export another product, you can click the down arrow next to the Export button, choose the Edit option and then change the product ID to another one.

  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...