Ehsanai Posted February 23, 2020 Share Posted February 23, 2020 Hi, I want to get all out of stocks products with SQL Request for a week ago. Is it possible? Link to comment Share on other sites More sharing options...
Ehsanai Posted March 2, 2020 Author Share Posted March 2, 2020 Now we check all order and out of stocks product and copy the details to excel but I want to export these products from sql request. Link to comment Share on other sites More sharing options...
Ehsanai Posted March 6, 2020 Author Share Posted March 6, 2020 I Create these code: SELECT DISTINCT a.`id_order` , od.product_id, od.product_name , s.quantity FROM `ps_orders` a LEFT JOIN `ps_order_detail` od ON (od.`id_order` = a.`id_order`) LEFT JOIN `ps_order_state` os ON ( os.`id_order_state` = a.`current_state` ) LEFT JOIN `ps_order_state_lang` osl ON ( os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = 1 ) LEFT JOIN ps_product_lang pl ON (od.`product_id` = pl.id_product) LEFT JOIN ps_product_attribute pa ON (od.`product_id` = pa.id_product) LEFT JOIN ps_product_attribute_combination pac ON (pac.id_product_attribute = pa.id_product_attribute) LEFT JOIN ps_attribute_lang al ON (al.id_attribute = pac.id_attribute) LEFT JOIN `ps_stock_available` s ON (od.`product_id` = s.id_product AND (s.id_product_attribute = pa.id_product_attribute OR CASE WHEN pa.id_product_attribute is null THEN s.id_product_attribute = 0 END) ) WHERE 1 AND s.quantity <= 0 AND a.`id_order` >= '1000' ORDER BY a.`id_order` DESC But it show the zero quantity for Product that have attributes. Can you check it? 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