Hi,
I'm trying to do something very simple but it's not working.
Inside the "Order Shipped" email, we reference $trackingNumber.TrackingNumberData, which is the tracking number for the order. I want to put in some conditional code to check if the string is blank. In all of the below cases, the condition evaluates to false whether the tracking number is blank or set. In other words, the email is printing out:
bp2
bp4
bp6
Regardless of the value of the tracking number. Any thoughts?
#if($trackingNumber.TrackingNumberData.length() > 0)
<b>bp1</b><br>
#else
<b>bp2</b><br>
#end
#if($trackingNumber.TrackingNumberData.Length > 0)
<b>bp3</b><br>
#else
<b>bp4</b><br>
#end
#if($trackingNumber.TrackingNumberData == "")
<b>bp5</b><br>
#else
<b>bp6</b><br>
#end
Simple nVelocity Question
Re: Simple nVelocity Question
try it like
Code: Select all
#if($trackingNumber.TrackingNumberData !="")
your text here
#end
Re: Simple nVelocity Question
Hi Mazhar,
Thanks for the response. However, this didn't work:
#if($trackingNumber.TrackingNumberData !="")
<strong>Tracking Number:</strong> $trackingNumber.TrackingNumberData
#end
What I got in both cases was literally:
Tracking Number: $trackingNumber.TrackingNumberData
Not only did the conditional evaluate to true in both cases, it also didn't render the data in this case.
Is there any readable tutorial or language reference for nVelocity?
Thanks for the response. However, this didn't work:
#if($trackingNumber.TrackingNumberData !="")
<strong>Tracking Number:</strong> $trackingNumber.TrackingNumberData
#end
What I got in both cases was literally:
Tracking Number: $trackingNumber.TrackingNumberData
Not only did the conditional evaluate to true in both cases, it also didn't render the data in this case.
Is there any readable tutorial or language reference for nVelocity?
Re: Simple nVelocity Question
this means most probably $trackingNumber is not available in context where you are attempting to use it. Have a look at this thread viewtopic.php?f=42&t=9329
You can attempt to get tracking number information by doing something like this.
You can attempt to get tracking number information by doing something like this.