Jump to content

Assigning an order status to payment option


Recommended Posts

Can someone explain to me how to assign a certain order status to a payment option?

 

For instance:

- Customer chose to pay by Check - order status is set to "check payment" and customer gets email A

- Customer chose to pay by Bank Transfer -  order status is set to "bank transfer" and customer gets email B

 

 

In case someone got me wrong, I am not trying to assign an email template to an order status, I'm trying to make Prestashop assign a predefined order status to an order depending on what payment method was chosen. I already know how to add email templates and assign them to statuses. 

 

Link to comment
Share on other sites

Using bankwire as an example, open the file validation.php and search for the validateOrder execution

$bankwire->validateOrder($cart->id, Configuration::get('PS_OS_BANKWIRE'), $total, $bankwire->displayName, NULL, array(), (int)$currency->id, false, $customer->secure_key);

In that function call, you will see "Configuration::get('PS_OS_BANKWIRE')", which is the module saying which order status to use when creating the order.  Just update that to whatever the new order status is.  You can use order status Id directly if you wish, or you can use the configuration name.

 

You could do the same thing for Check, and most other payment modules.

Link to comment
Share on other sites

Using bankwire as an example, open the file validation.php and search for the validateOrder execution

$bankwire->validateOrder($cart->id, Configuration::get('PS_OS_BANKWIRE'), $total, $bankwire->displayName, NULL, array(), (int)$currency->id, false, $customer->secure_key);

In that function call, you will see "Configuration::get('PS_OS_BANKWIRE')", which is the module saying which order status to use when creating the order.  Just update that to whatever the new order status is.  You can use order status Id directly if you wish, or you can use the configuration name.

 

You could do the same thing for Check, and most other payment modules.

 

Thanks so much for the help. You say it is possible to use status ID's. If I'd like to use for instance ID 5 then what do I enter in the function?

Link to comment
Share on other sites

I've applied this line of code and it assigns the correct order status but messes something else up.

 

Now after placing the order, the customer does not get an important message with what to do next, instead he gets the following:

ovmn.png

Despite the above error, the order is placed correctly, the customer gets the right email and the order status is the one I want it to be. However, there should be certain crucial information displayed on this step and it's not being displayed.

 

I'm editing the validation file in: bankwire\controllers\front\ since editing the one in the root folder doesn't make any difference to which status is assigned to the order. I have however edited that too just in case.

 

This is the line of code I'm using in bankwire\controllers\front\validation.php:

$this->module->validateOrder($cart->id, 22, $total, $this->module->displayName, NULL, $mailVars, (int)$currency->id, false, $customer->secure_key);
Link to comment
Share on other sites

  • 1 month later...

Likely you created an order status that is not "valid".  Take a screen shot of the order status details whose Id is 22, and attach it here

 

Hello I tried the same as Inur, but get the same mistake. 

 

my code of modules\bankwire\controllers\front\validation.php

$this->module->validateOrder($cart->id, 1, $total, $this->module->displayName, NULL, $mailVars, (int)$currency->id, false, $customer->secure_key);

Is this the correct change?

There is also a document modules\bankwire\validation.php, wich has a similair Code line. Do I need to change something there?

 

Just to make sure ID=1 is the standard status of cheque-modul.

 

Btw: I am testing on 1.6 alpha. But I think this is not the problem...

Edited by wakabayashi (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...