Target Non-US In Customer Order Notification Email Template

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
dave@givemore.com
Ensign (ENS)
Ensign (ENS)
Posts: 20
Joined: Tue Jan 13, 2009 11:11 am

Target Non-US In Customer Order Notification Email Template

Post by dave@givemore.com » Mon Mar 22, 2010 8:06 am

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!
Give More Media
http://www.givemore.com/

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Target Non-US In Customer Order Notification Email Template

Post by mazhar » Mon Mar 22, 2010 12:06 pm

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

dave@givemore.com
Ensign (ENS)
Ensign (ENS)
Posts: 20
Joined: Tue Jan 13, 2009 11:11 am

Re: Target Non-US In Customer Order Notification Email Template

Post by dave@givemore.com » Tue Mar 23, 2010 8:16 am

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!
Give More Media
http://www.givemore.com/

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Target Non-US In Customer Order Notification Email Template

Post by mazhar » Tue Mar 23, 2010 9:03 am

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.

dave@givemore.com
Ensign (ENS)
Ensign (ENS)
Posts: 20
Joined: Tue Jan 13, 2009 11:11 am

Re: Target Non-US In Customer Order Notification Email Template

Post by dave@givemore.com » Tue Mar 30, 2010 8:07 am

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.
Give More Media
http://www.givemore.com/

dave@givemore.com
Ensign (ENS)
Ensign (ENS)
Posts: 20
Joined: Tue Jan 13, 2009 11:11 am

Re: Target Non-US In Customer Order Notification Email Template

Post by dave@givemore.com » Wed Nov 03, 2010 11:18 am

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!
Give More Media
http://www.givemore.com/

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Target Non-US In Customer Order Notification Email Template

Post by mazhar » Thu Nov 04, 2010 4:29 am

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

dave@givemore.com
Ensign (ENS)
Ensign (ENS)
Posts: 20
Joined: Tue Jan 13, 2009 11:11 am

Re: Target Non-US In Customer Order Notification Email Template

Post by dave@givemore.com » Thu Nov 04, 2010 7:06 am

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
Give More Media
http://www.givemore.com/

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Target Non-US In Customer Order Notification Email Template

Post by mazhar » Thu Nov 04, 2010 7:32 am

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.

Post Reply