KonaKart Community Forum

Installation / Configuration => Programming of KonaKart => Topic started by: mtoon on April 07, 2008, 07:23:10 pm

Title: Order Status Change email
Post by: mtoon on April 07, 2008, 07:23:10 pm
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


Title: Re: Order Status Change email
Post by: kate on April 08, 2008, 09:25:54 am
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
Title: Re: Order Status Change email
Post by: mtoon on April 10, 2008, 04:36:33 am
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)

Title: Re: Order Status Change email
Post by: ming on April 10, 2008, 05:59:22 am
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
Title: Re: Order Status Change email
Post by: mtoon on April 10, 2008, 03:12:30 pm
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!