Author Topic: two templates responsible for sending emails, possible?  (Read 197 times)

ioslok

  • Beginner
  • *
  • Posts: 2
  • A beginner
two templates responsible for sending emails, possible?
« on: August 24, 2018, 12:23:17 pm »
I am asking for help, because I am losing faith if I am able to solve the problem myself.
But to the point, is it possible to have two different templates for an email?
I have modified the file /components/com_virtuemart/views/cart/tmpl/mail_html.php ( so that in the e-mail sent after the purchase the customer received in the mail in the product field not only the product name but also all selected custom fields  and their prices.
The problem is  when I would like to change in the product price of the custom field (eg the price list has changed) in orders that have already been submitted at the time of changing the order status to customer will be sent mail not with prices after which the customer ordered but there will occur currently inserted prices  (becausee VM does not have them „somewhere saved“ but takes them  directly from the database -> _virtuemart_product_customfields)
 And that's why I would like to make/have two templates:
One, as it is now, with all data + custom fields  and their prices
Second: for communication with the customer at the moment of changing the status, with only custom fields without prices in product field
Unfortunately, I do not know where to look for the code responsible for communication  with client when changing the order status.



Joomla: 3.8.7
Virtuemart: 3.2.14

StefanSTS

  • Global Moderator
  • Jr. Member
  • *
  • Posts: 211
  • VirtueMart Version: VM 4.2 on Joomla 4.5
Re: two templates responsible for sending emails, possible?
« Reply #1 on: August 24, 2018, 13:15:38 pm »
Hello,

you could make different mails per status name, confirmed, shipped and so on.

Just find out the status:
$statusname = $this->orderDetails['details']['BT']->order_status_name;

Then you tell your custom fields to appear for status XYZ and not for the rest.

Hope that helps
Stefan
--
Stefan Schumacher
www.jooglies.com - VirtueMart Invoice Layouts

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3458
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3.0.x.y
Re: two templates responsible for sending emails, possible?
« Reply #2 on: August 25, 2018, 16:21:11 pm »
The order status change mail is in the folder /components/com_virtuemart/views/invoice/tmpl/mail_html.php