Jump to content

Edit History

Pandal

Pandal

Basically you can't.
The function that sends the order email is inside the classes/PaymentModule.php > validateOrder()

In my version row is 827:

 

Mail::Send(
  (int)$order->id_lang,
  'order_conf',
  Context::getContext()->getTranslator()->trans(
  'Order confirmation',
  array(),
  'Emails.Subject',
  $orderLanguage->locale
  ),
  $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
);


The problem is that the vars used inside the template are created in this enormous function, and you can't call this function just to send email because the same function does a lot of other things related to order creation (stock updating, hooks, etc).

The one of the 2 solutions you have, is to re-build your own function copying the pieces of code you need from this validateOrder function.

So, basically, you will have 2 order confirmation "building" in the same prestashop, and that's a really bad thing because you have to mantain two different functions, if one day you decide to edit some variables or some piece of code in the order confirmation email you'll have to remember this and do the job 2 times.

The best solution (talking about code) is to edit prestashop class and add a sendConfirmationEmail() function, take all these pieces of code inside the validateOrder and place that inside this new function.

Then, inside validateOrder function you can call your new function $this->sendConfirmationEmail(xxx);

But this is bad because you won't be able to update prestashop anymore.

So.. 

Solution 1: basically you don't re-send the email confirmation but you send an email which use order confirmation template (order_conf) and you manually create all the variables needed to populate this template.

Solution 2: you edit the prestashop class with all his consequences.

I think the best solution (the same that the module someone linked uses) is the first one, you can do it by creating a module and the company must have a developer ready to fix it after a prestashop update for any changes in this template variables or other updates.

Pandal

Pandal

Basically you can't.
The function that sends the order email is inside the classes/PaymentModule.php > validateOrder()

In my version row is 827:

 

Mail::Send(
  (int)$order->id_lang,
  'order_conf',
  Context::getContext()->getTranslator()->trans(
  'Order confirmation',
  array(),
  'Emails.Subject',
  $orderLanguage->locale
  ),
  $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
);


The problem is that the vars used inside the template are created in this enormous function, and you can't call this function just to send email because the same function does a lot of other things related to order creation (stock updating, hooks, etc).

The one of the 2 solutions you have, is to re-build your own function copying the pieces of code you need from this validateOrder function.

So, basically, you will have 2 order confirmation "building" in the same prestashop, and that's a really bad thing because you have to mantain two different functions, if one day you decide to edit some variables or some piece of code in the order confirmation email you'll have to remember this and do the job 2 times.

The best solution (talking about code) is to edit prestashop class and add a sendConfirmationEmail() function, take all these pieces of code inside the validateOrder and place that inside this new function.

Then, inside validateOrder function you can call your new function $this->sendConfirmationEmail(xxx);

But this is bad because you won't be able to update prestashop anymore.

So.. 

Solution 1: basically you don't re-send the email confirmation but you send an email which use order confirmation template (order_conf) and you manually create all the variables needed to populate this template.

Solution 2: you edit the prestashop class with all his consequences.

I think the best solution (the same that the module someone linked uses) is the first one, you can do it by creating a module and the company has to have a developer ready to fix it after a prestashop update for any changes in this template variables or other updates.

Pandal

Pandal

Basically you can't.
The function that sends the order email is inside the classes/PaymentModule.php > validateOrder()

In my version row is 827:

 

Mail::Send(
  (int)$order->id_lang,
  'order_conf',
  Context::getContext()->getTranslator()->trans(
  'Order confirmation',
  array(),
  'Emails.Subject',
  $orderLanguage->locale
  ),
  $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
);


The problem is that the vars used inside the template are created in this enormous function, and you can't call this function just to send email because the same function does a lot of other things related to order creation (stock updating, hooks, etc).

The one of the 2 solutions you have, is to re-build your own function copying the pieces of code you need from this validateOrder function.

So, basically, you will have 2 order confirmation "building" in the same prestashop, and that's a really bad thing because you have to mantain two different functions, if one day you decide to edit some variables or some piece of code in the order confirmation email you'll have to remember this and do the job 2 times.

The best solution is edit prestashop class and add a sendConfirmationEmail() function, take all these pieces of code inside the validateOrder and place that inside this new function.

Then, inside validateOrder function you can call your new function $this->sendConfirmationEmail(xxx);

But this is bad because you won't be able to update prestashop anymore.

So.. 

Solution 1: basically you don't re-send the email confirmation but you send an email which use order confirmation template (order_conf) and you manually create all the variables needed to populate this template.

Solution 2: you edit the prestashop class with all his consequences.

I think the best solution (the same that the module someone linked uses) is the first one, you can do it by creating a module and the company has to have a developer ready to fix it after a prestashop update for any changes in this template variables or other updates.

Pandal

Pandal

Basically you can't.
The function that sends the order email is inside the classes/PaymentModule.php > validateOrder()

In my version row is 827:

 

Mail::Send(
  (int)$order->id_lang,
  'order_conf',
  Context::getContext()->getTranslator()->trans(
  'Order confirmation',
  array(),
  'Emails.Subject',
  $orderLanguage->locale
  ),
  $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
);


The problem is that the vars used inside the template are created in this enormous function, and you can't call this function just to send email because the same function does a lot of other things related to order creation (stock updating, hooks, etc).

The only one solution is to re-build your own function copying the pieces of code you need from this validateOrder function.

So, basically, you will have 2 order confirmation "building" in the same prestashop, and that's a really bad thing because you have to mantain two different functions, if one day you decide to edit some variables or some piece of code in the order confirmation email you'll have to remember this and do the job 2 times.

The best solution is edit prestashop class and add a sendConfirmationEmail() function, take all these pieces of code inside the validateOrder and place that inside this new function.

Then, inside validateOrder function you can call your new function $this->sendConfirmationEmail(xxx);

But this is bad because you won't be able to update prestashop anymore.

So.. 

Solution 1: basically you don't re-send the email confirmation but you send an email which use order confirmation template (order_conf) and you manually create all the variables needed to populate this template.

Solution 2: you edit the prestashop class with all his consequences.

I think the best solution (the same that the module someone linked uses) is the first one, you can do it by creating a module and the company has to have a developer ready to fix it after a prestashop update for any changes in this template variables or other updates.

×
×
  • Create New...