Jump to content

Reserved Stock? PrestaShop 1.7.8.8


sampsonzak

Recommended Posts

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

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

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:

 

image.thumb.png.dda4ebff5f1c1fe605400a10bec55189.png

Link to comment
Share on other sites

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

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...