gitexperts Posted August 9, 2022 Share Posted August 9, 2022 how to get all products from all orders id for customer on frontend by sql in prestashop 1.7 Link to comment Share on other sites More sharing options...
Knowband Plugins Posted August 9, 2022 Share Posted August 9, 2022 (edited) 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} Edited August 9, 2022 by Knowband Plugins (see edit history) 1 Link to comment Share on other sites More sharing options...
ventura Posted August 9, 2022 Share Posted August 9, 2022 * Get customer orders. * @param int $id_customer Customer id * @param bool $show_hidden_status Display or not hidden order statuses * @return array Customer orders Order::getCustomerOrders((int) $id_customer); 3 Link to comment Share on other sites More sharing options...
gitexperts Posted August 24, 2022 Author Share Posted August 24, 2022 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"; 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now