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