• Welcome to KonaKart Community Forum. Please login or sign up.
 

Order Status Change email

Started by mtoon, April 07, 2008, 07:23:10 pm

Previous topic - Next topic

mtoon

On our order status email template, the following line:
               $osh.getComments()

seems to always render "$osh.getComments()" for the initial Pending status.  Subsequent status render the comments as applied in the admin tool.  It looks like velocity has a problem with null strings which will cause this.  is there any way to get a blank status inserted into the database or have this function $osh.getComments() return the empty string rather than null for Pending? 

Thank you



kate

Hi,

The simplest solutions are to check that for null (which I thought was actually already done in the OrderDetails velocity template that is shipped), or even to use the special "!" syntax which doesn't print anything if the object is null.

Have you customised this template already because this should not happen with the default installation.

Regards,
Kate

mtoon

We hadn't customized the template.  It looks like it was an issue with Velocity.  It really doesn't like null strings.  You can't even test for nulls -- at least not with something like #if ($null_variable == null) or #if ($null_variable != null)


ming

The reason I thought you'd customised the template is because in your other post you showed us your template code with an illegal syntax:

#if ($osh.getComments() != null)


There is no issue with Velocity here, it's just that you are using illegal syntax.

Read Kate's post below to find out how to test for nulls properly.

Ming

mtoon

Ah, that makes more sense.  Yes, I posted my updated code in that example (having no experience with velocity when I posted that, I was trying a logical attempt at a Java comparison).  Thanks again for all the help!