I would like to create a new shipping status and insert some php code into the email header that will grab the name of the product that has been ordered and the options associated with the product.
The order status will be used to send out reminder emails for customer who have purchased a single particular product that relates to an appointment date and time (the product option).
1. My first question is can php be added to an order status email header?
2. If so what code can I add to grab the name of the product and its associated option?
The intent would be that the status email would begin with something like;
This is a reminder about your order for {Product Name} at {Product Options} is due soon.
Thanks in advance for any suggestions
You would need to use something like the following:
{$oi.product}
{$oi.product_options}
Seems to be just processing it as text and enclosing with just returns a blank in the in email.
You can generate e-mail header (e.g. the header variable) in your php function and assign to e-mail. As example, please check the fn_order_notification function
http://prntscr.com/byy3zt
Then in your e-mail subject template just use the following code:
{$header}
That is all.
The problem with changing the php file is that would affect all order status emails where as I only want to insert the above info into one of the order statuses that I have created. This provides me a quick method of sending out predefined emails associated with an order as I only have to change the order status to trigger an email e.g. change status from "Processed" to "Reminder" and the customer receives my reminder email.
Go to Administration -> Order statuses page and add placeholder to the E-mail subject field. (e.g. [REMINDER_BODY])
Then open the following files:
design/themes/responsive/mail/templates/orders/order_notification_subj.tpl
design/backend/mail/templates/orders/order_notification_subj.tpl
and replace:
{$company_data.company_name nofilter}: {__("order")} #{$order_info.order_id} {$order_status.email_subj}
with
{capture name="reminder_mody"}
{if $order_info.status == 'D'}
{foreach from=$order_info.products item=p}
{* GENERATE REQUIRED CONTENT HERE *}
{/foreach}
{/if}
{/capture}
{$company_data.company_name nofilter}: {__("order")} #{$order_info.order_id} {$order_status.email_subj|replace:"[REMINDER_BODY]":$smarty.capture.reminder_body}
where D - is the letter ID of the reminder order status
Hope the logic is clear
According to Imac, it will all break at the next release of 4.4.1.