Managing order statuses in PrestaShop 8 is a key aspect of effective administration of orders and product availability. This article explains how to create, edit, and use order statuses, as well as their relationship to product quantities.

What are states of order?

PrestaShop Order States

Order states represent the different stages an order goes through in its lifecycle, from confirmation to shipment and completion. Each state has specific implications for order management and visibility for the customer.

Creating and Editing Order States

To manage order states in PrestaShop 8, log into the back-office and follow the path: Store Parameters -> Order Settings -> States

Here you can:

  • Create a new status.

  • Edit an existing status.

  • Define specific settings for each state.

Order State Settings

Creating Order Status

Each order status can have different configuration options:

  • Considerthis order status as validated: the order is considered confirmed and valid.

  • Allow a customer to download and look at PDF versions of their invoices: allows access to PDF documents.

  • Hide this status in all customer orders: useful for internal statuses not visible to the customer.

  • Send an email to the customer when the order status is changed: automates communication with the customer.

  • Attach PDF of invoice to email: facilitates documentation management.

  • Attach the PDF of the delivery note to the email: useful for logistics.

  • Marks order as shipped: status is considered as order being shipped.

  • Marksorder as paid: order is considered paid.

  • Show delivery PDF: allows viewing of the delivery document.

Filtering and Editing Order States

To view orders by their status or change an order status: Access Orders -> Orders, from here you can:

  • Filter orders by status.

  • Manually edit the status of an order.

  • Apply bulk changes to multiple orders at once.

Relationship between Order States and Product Availability

Under Catalog -> Warehouse -> Warehouse Management, you can see which products have reserved quantities in orders that have not yet been completed or shipped. This helps you manage the warehouse more accurately.

PrestaShop Warehouse Handling

To monitor stock movements, go to: Catalog -> Inventory Management -> Stock Movements, where changes in product quantities can be viewed.

Query to View Reserved Quantities in Unfinished Orders

To locate products with reserved quantities in orders that are still open, the following SQL query can be used:

[code=language-sql] SELECT p.id_product, p.reference, pl.name, SUM(od.product_quantity) AS quantity_reserved FROM ps_orders o JOIN ps_order_detail od ON o.id_order = od.id_orderJOIN ps_product p ON od.product_id = p.id_productJOIN ps_product_lang pl ON p.id_product = pl.id_productWHERE o.current_state NOT IN ( SELECT id_order_state FROM ps_order_state WHERE shipped = 1 OR id_order_state = 6 ) GROUP BY p.id_product;[/code]

This query provides a summary of products with reserved quantities in orders that have not yet shipped, enabling more efficient inventory management.

Example query to filter unclosed orders for a given product:

[code=language-sql] SELECT o.id_order, p.id_product, p.reference, pl.name, SUM(od.product_quantity) AS quantity_reserved FROM ps_orders o JOIN ps_order_detail od ON o.id_order = od.id_orderJOIN ps_product p ON od.product_id = p.id_productJOIN ps_product_lang pl ON p.id_product = pl.id_productWHERE o.current_state NOT IN ( SELECT id_order_state FROM ps_order_state WHERE shipped = 1 OR id_order_state = 6 ) AND p.id_product = 6816 GROUP BY o.id_order, p.id_product;[/code]

Conclusion

Proper management of order statuses in PrestaShop 8 enables better control over the sales process and product availability. By taking advantage of available settings and monitoring reserved quantities, you can optimize logistics and improve the customer experience.

Author: Loris Modena

SENIOR DEVELOPER

Per Ind Loris Modena owner of Arte e Informatica, began working in the computer industry in 1989 as a systems engineer in charge of maintenance and installation of computer systems. He starts programming for the web in 1997 dealing with CGI programming in PERL and later moving to programming in PHP and JavaScript. During this period he approaches the Open source world and Linux server management.

Product added to wishlist