sampsonzak Posted March 1, 2023 Share Posted March 1, 2023 Hi, I have noticed some items in my store show 'Reserved Stock' over 0, even though all orders have been complete, and there's no pending/awaiting processing. I can't figure out how to find where this "reserved stock" is hidden? It is affecting my stock buying and starting to annoy me now. How can I find the orders/issue with Reserved Stock easily?? Thank you Link to comment Share on other sites More sharing options...
idnovate.com Posted March 2, 2023 Share Posted March 2, 2023 Can you upload a screenshot where "Reserved stock" appear? Link to comment Share on other sites More sharing options...
sampsonzak Posted March 2, 2023 Author Share Posted March 2, 2023 1 hour ago, idnovate.com said: Can you upload a screenshot where "Reserved stock" appear? Hi, it's on the Catalogue -> Stocks page. Thank you Link to comment Share on other sites More sharing options...
idnovate.com Posted March 3, 2023 Share Posted March 3, 2023 Execute this query and let me know if the result matches with what you see in the BO: SELECT id_product, sa.reserved_quantity = ( SELECT SUM(od.product_quantity - od.product_quantity_refunded) FROM ps_orders o INNER JOIN ps_order_detail od ON od.id_order = o.id_order INNER JOIN ps_order_state os ON os.id_order_state = o.current_state WHERE o.id_shop = 1 AND os.shipped != 1 AND ( o.valid = 1 OR ( os.id_order_state != 8 AND os.id_order_state != 6 ) ) AND sa.id_product = od.product_id AND sa.id_product_attribute = od.product_attribute_id GROUP BY od.product_id, od.product_attribute_id ) FROM ps_stock_available sa WHERE sa.id_shop = 1 Link to comment Share on other sites More sharing options...
sampsonzak Posted March 3, 2023 Author Share Posted March 3, 2023 5 hours ago, idnovate.com said: Execute this query and let me know if the result matches with what you see in the BO: SELECT id_product, sa.reserved_quantity = ( SELECT SUM(od.product_quantity - od.product_quantity_refunded) FROM ps_orders o INNER JOIN ps_order_detail od ON od.id_order = o.id_order INNER JOIN ps_order_state os ON os.id_order_state = o.current_state WHERE o.id_shop = 1 AND os.shipped != 1 AND ( o.valid = 1 OR ( os.id_order_state != 8 AND os.id_order_state != 6 ) ) AND sa.id_product = od.product_id AND sa.id_product_attribute = od.product_attribute_id GROUP BY od.product_id, od.product_attribute_id ) FROM ps_stock_available sa WHERE sa.id_shop = 1 Hi, I've ran this in phpmyadmin and it's showing this: Link to comment Share on other sites More sharing options...
idnovate.com Posted March 3, 2023 Share Posted March 3, 2023 If you check a product ID with some reserved stock in the BO, does it appear the same value in the query? Link to comment Share on other sites More sharing options...
sampsonzak Posted March 3, 2023 Author Share Posted March 3, 2023 1 hour ago, idnovate.com said: If you check a product ID with some reserved stock in the BO, does it appear the same value in the query? I forgot which product it was showing on, and I tried sorting by the sa.reserved_quantity in that script but it wasn't working. I don't think the script worked correctly else it should have let me sort by this column right? Link to comment Share on other sites More sharing options...
idnovate.com Posted March 3, 2023 Share Posted March 3, 2023 Add at the end: ORDER BY sa.reserved_quantity DESC 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