Jump to content

how to get all products from all orders id for customer by sql in prestashop 1.7


gitexperts

Recommended Posts

  • 2 weeks later...
On 8/9/2022 at 10:04 PM, Knowband Plugins said:

Use the below SQL :

Select * from ps_orders o left join ps_order_detail od on (o.id_order = od.id_order) left join product p on (p.id_product = od.product_id) where o.id_customer = {id_customer}

 

Hello 
@Knowband Team,

Thanks for your reply, It's working after some modification
 
"SELECT `OD`.`product_id` as product_id FROM "._DB_PREFIX_."order_detail OD INNER JOIN "._DB_PREFIX_."orders O ON O.id_order = OD.id_order WHERE O.id_customer = ".$customer_id." AND O.valid = 1"; 

  • Thanks 1
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...