Email Placeholder Options

4 posts by 2 authors in: Forums > CMS Builder
Last Post: September 4, 2015   (RSS)

By Perchpole - August 27, 2015

Hello, All -

I've been putting together a couple of new email templates and an annoying issue has emerged...

Is it possible to (somehow) make a placeholder conditional? At the moment, if a value does not exist the placeholder leaves a blank line in the email. This is a bit of an annoyance!

:0/

Perch

By Dave - September 3, 2015

Hi Perch, 

There's no easy way to do that.  

One solution is to have the conditional login in your PHP code.  If you don't want the blank link after the placeholder just remove it in the email template and add a \n to the placeholder value.

Hope that helps!

Dave Edis - Senior Developer
interactivetools.com

By Perchpole - September 4, 2015

Hi, Dave -

The issue is more to do with rendering addresses than anything else. The placeholders look like this:

#order.shipping_first_name# #order.shipping_last_name#
#order.shipping_address_line_1#
#order.shipping_address_line_2#
#order.shipping_city#
#order.shipping_province#
#order.shipping_postal_code#
#order.shipping_country#

The problem is: #order.shipping_address_line_2#.

Only a small number of people will enter data into this field. As a result, the email will often render the address like this:

Joe Bloggs
29 Ponsenby Drive

Royston Vasey
Smithersdale
NN1 1GP
England

It leaves an ugly gap. My client uses some sort of accounting software and needs to copy and paste each address into a template. The gap in the address is causing him a lot of grief!

I just wondered if there was a way of skipping the field if no data is provided.

:0/

Perch