Jump to content

Pass Order Variables To Merchant Mail


blackflow

Recommended Posts

Ok, so dose any one know how to pass variables from admin order to emails?
When your customer places an order, merchant receives an email with the order: "Somebody made an order in your shop, bla,bla,bla"
In that email merchant receives info from the order like customer name, adress, email and so on. 
But unfortunately if I customize my product with an upload field (so customer can upload image) presta shows the link in the order page but doesn’t attach this link to the email with that order.

So basically I’m wondering how presta processes those emails and can I add variables from order (like the link with the uploaded image) to my emails.

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

If I understand your question correctly and you are trying to do this from a module then, yes, it is possible.  You have 3 hooks available to you:

 

actionEmailAddBeforeContent

   - Here you can change or amend template_html & template_txt before your email template is loaded.

 

actionEmailAddAfterContent

   - Here you can change or amend template_html & template_txt afteryour email template is loaded.

 

actionGetExtraMailTemplateVars

  - Here you can assign your own variables to be used in the original or amended template.

 

Not completely clear when you want to do this from your original question, but you can send an email automatically when you change the order status, which will trigger the above hooks.

Link to comment
Share on other sites

If I understand your question correctly and you are trying to do this from a module then, yes, it is possible.  You have 3 hooks available to you:

 

actionEmailAddBeforeContent

   - Here you can change or amend template_html & template_txt before your email template is loaded.

 

actionEmailAddAfterContent

   - Here you can change or amend template_html & template_txt afteryour email template is loaded.

 

actionGetExtraMailTemplateVars

  - Here you can assign your own variables to be used in the original or amended template.

 

Not completely clear when you want to do this from your original question, but you can send an email automatically when you change the order status, which will trigger the above hooks.

 

Ok, I'll check it out.

 

To be more descriptive

 

 

I realize that “order page” must be misleading.

 

 

When your customer places an order, merchant receives an email with the order: "Somebody made an order in your shop, bla,bla,bla"

In that email merchant receives info from the order like customer name, adress, email and so on. 

But unfortunately if I customize my product with an upload field (so customer can upload image) presta shows the link in the order page but doesn’t attach this link to the email with that order.

 

So basically I’m wondering how presta processes those emails and can I add variables from order (like the link with the uploaded image) to my emails.

 

Link to comment
Share on other sites

ah got it.

The merchant email on a new order comes from the mailalerts module I believe, in which case he above still holds true.  These hooks are called whenever an email is sent, in Mail.php -> send.

 

Alternatively hook into actionValidateOrder and send your own email, as here it'll be easier to get the order object (which is what the mailalerts module does so you can just copy that)

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