I am displaying item availability on a product page using the Basic repeater web part and this code in the Product Detail transformation:
<%if ( EvalInteger("SKUAvailableItems") >= 1 )
{ %>
<span class="stock green">In stock</span>
<%}
else
{ %>
<span class="stock red">Out of stock</span>
Available Today: <%# EvalInteger("SKUAvailableItems").ToString() %>
<%} %>
This outputs:
<span class="stock red">Out of stock</span>Available Today: 10
This output shows the EvalInteger("SKUAvailableItems") returns 10 when output so how does the first if statement not evaluate as (10 >= 1) and show the in stock message?
I also tried creating a custom transformation function and passing in the value of SKUAvailableItems field using this as a parameter to the function:
CMS.GlobalHelper.ValidationHelper.GetInteger(Eval("SKUAvailableItems"), -1)
And then in the custom function I output the value of this parameter to the the system log and it is passing in the -1 default instead of the value of the SKUAvailableItems field, which is 10. Any ideas/help would be greatly appreciated.
Thanks,
Matt