Jump to content

Skip Lines with Blank Address Variables in Email Messages


Recommended Posts

I'd like to modify the email templates so if the variable for Company and Address2 are blank, there will be no blank line displayed in the email sent, and it closes the gap currently displayed. Below is code from order_conf.html - is it possible to include some conditional statements so that the company and address2 lines are skipped and the blank line space is closed up?

                        
                           {delivery_company}

{delivery_firstname} {delivery_lastname}

{delivery_address1}

{delivery_address2}

{delivery_city}, {delivery_state}  {delivery_postal_code}

{delivery_country} 

{delivery_phone}

{delivery_other}

Link to comment
Share on other sites

I'd like to modify the email templates so if the variable for Company and Address2 are blank, there will be no blank line displayed in the email sent, and it closes the gap currently displayed. Below is code from order_conf.html - is it possible to include some conditional statements so that the company and address2 lines are skipped and the blank line space is closed up?

                        
                           {delivery_company}

{delivery_firstname} {delivery_lastname}

{delivery_address1}

{delivery_address2}

{delivery_city}, {delivery_state}  {delivery_postal_code}

{delivery_country} 

{delivery_phone}

{delivery_other}



Try commenting out the ones you don't want to show:
<!--  
{delivery_address2} -->

Link to comment
Share on other sites

OK - would have been helpful if that was in your initial post :)

then instead of commenting out you need to use an if not empty statement.

<?php
if (isset($delivery_address2))
{
?>

{delivery_address2}
<?php
}
?>



Note tested but you wioll get an idea of where to start :)

Link to comment
Share on other sites

×
×
  • Create New...