Page 1 of 1
Target Non-US In Customer Order Notification Email Template
Posted: Mon Mar 22, 2010 8:06 am
by dave@givemore.com
I would like some text to be inserted into the Customer Order Notification email template only when the customer is located outside of the US.
How do you target Non-US customers in the Customer Order Notification email template?
Thanks!
Re: Target Non-US In Customer Order Notification Email Template
Posted: Mon Mar 22, 2010 12:06 pm
by mazhar
What about comparing country code in Email template for example
Code: Select all
#If($customer.PrimaryAddress.CountryCode!="US")
MESSAGE FOR NON US BASED CUSTOMER HERE
#end
Re: Target Non-US In Customer Order Notification Email Template
Posted: Tue Mar 23, 2010 8:16 am
by dave@givemore.com
Mazhar,
Thanks once again! I implemented the code below into our "Customer Order Notification" template, but it caused the email to output a bunch of random characters.
Have any idea why?
Here is an example of another customization we have used (for reference):
Code: Select all
#if (!${order.User.IsAnonymous})
You can track the progress of <a href="http://www.Blah.com/">your purchase here</a>.
#end
Thanks again for you help!
Re: Target Non-US In Customer Order Notification Email Template
Posted: Tue Mar 23, 2010 9:03 am
by mazhar
Seems like you edited the Email template in FCK editor by clicking on edit icon next to Email template text area. There is a warning mentioned on FCK editor that it corrupts the NVelocity scrips if you use its design mode and save the data. Try making change simply into text area at proper location without using FCK editor.
Re: Target Non-US In Customer Order Notification Email Template
Posted: Tue Mar 30, 2010 8:07 am
by dave@givemore.com
Mazhar, once again you were exactly right! There was some corruption when working within the editor.
I ended up needing to slightly adjust the code above.
Here is the final code that targeted non-US customers:
Code: Select all
#if($order.User.PrimaryAddress.CountryCode!="US")
Thanks again for the help.
Re: Target Non-US In Customer Order Notification Email Template
Posted: Wed Nov 03, 2010 11:18 am
by dave@givemore.com
Does anyone know the syntax for pulling the ship address country code in email templates?
Here is what I am guessing "$order.User.shipAddress.CountryCode" ...but this does not work.
Thanks!
Re: Target Non-US In Customer Order Notification Email Template
Posted: Thu Nov 04, 2010 4:29 am
by mazhar
Shipping address relates to order. For customer its an address but upon order placement you can take one address as shipping or billing address. So you need to have order to get this information. See following code
Code: Select all
#foreach ($orderShipment in $order.Shipments)
$orderShipment.ShipToCountryCode
#end
Re: Target Non-US In Customer Order Notification Email Template
Posted: Thu Nov 04, 2010 7:06 am
by dave@givemore.com
Thanks Mazhar!
So, for anyone who needs it... to see if someone's shipping address is outside the US in an email template, you would do:
Code: Select all
#foreach ($orderShipment in $order.Shipments)
#if($orderShipment.ShipToCountryCode!="US")
Your order is being shipped outside the US...
#end
#end
Re: Target Non-US In Customer Order Notification Email Template
Posted: Thu Nov 04, 2010 7:32 am
by mazhar
Yeah it would be something like that. Just one thing that one order can contain multiple shipments so it means if order contains two shipment one local and one for some different country then your message shouldn't say order will be shipped out side the country. It should tell him that shipment#blah would be sent out side of US.