Jump to content

Conditional confirmation email sending


ppokrovsky

Recommended Posts

Hi.

 

What would be to your opinion the best way to work around this situation:

 

If customer chose to pay with cash (cashondelivery module) - standard confirmation email needs to be sent immediatelly

If order is paid with something, other than cash (e.g. credit card) - standard confirmation email needs to be sent only after order is set to specific status ('paid' for instance)?

 

I'm thinking about few ways, such as overriding PaymentModule class, validateOrder method, but they seem to be too complicated for such primitive task.

 

Any suggestions?

 

Thanks!

Link to comment
Share on other sites

in 1.6.0.8 method validateOrder is implemented in PaymentModule class and is supposed to be called from any payment module. This method actually converts cart to order and among everything it has this piece of code

						if (Validate::isEmail($this->context->customer->email))
							Mail::Send(
								(int)$order->id_lang,
								'order_conf',
								Mail::l('Order confirmation', (int)$order->id_lang),
								$data,
								$this->context->customer->email,
								$this->context->customer->firstname.' '.$this->context->customer->lastname,
								null,
								null,
								$file_attachement,
								null, _PS_MAIL_DIR_, false, (int)$order->id_shop
							);

Which, I presume, actually sends email everytime this method is called.

Link to comment
Share on other sites

what version are you using? In my case status is set to 'In preparation'. This status has no notification emails attached in BO, nevertheless email with order_conf template is sent each time order is created. This template, btw, is not attached to any order status in BO either.

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