Book Image

PrestaShop Module Development

By : Serny
Book Image

PrestaShop Module Development

By: Serny

Overview of this book

If you are a developer who is new to PrestaShop and wants to get a good foundation in development on the PrestaShop framework, this book is for you. It's assumed that you will have some experience with PHP5, jQuery, and HTML/CSS (no need to be an expert on it).
Table of Contents (13 chapters)
12
Index

Creating your own order state


You are probably asking yourself, why create your own order state when there are already order states we need in PrestaShop? Yes, you're right, but there will always be a moment when you need to create one for a specific need. And the most important of all, you can associate e-mail sending with order states.

We will start by coding a method named installOrderState in your mymodpayment module's main class. This method is very simple; we just have to instantiate an OrderState object model, fill it in, and call the add method.

Here are the different variables of an OrderState object model:

  • send_email: This is a flag that indicates whether an e-mail has to be sent (we will set it to false for now).

  • module_name: The field speaks for itself.

  • invoice: This is a flag that indicates whether an invoice has to be created by PrestaShop when the order state is attributed to the order.

  • color: The hexadecimal color code, which will be displayed for the order on the order's...