Email Placeholder Options

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

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

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

By Dave - September 4, 2015

Hi Perch, 

No, there's no way to skip it.  Probably what I'd do in the code is something like this: 

$placeholders['shipping_address_lines'] = implode("\n", array($placeholders['shipping_address_line_1'], $placeholders['shipping_address_line_2'])); 

And then replace this:

#order.shipping_address_line_1#
#order.shipping_address_line_2#

With this: 

#order.shipping_address_lines#

Let me know if that works for you.

Dave Edis - Senior Developer
interactivetools.com