Hi All,

We've been using TT2 for our ecommerce application for the last couple of years. Until recently we were running version 2.14 and have just upgraded to the latest version (2.19). We checked the changes log for any gotcha's and since there didn't seem to be any, we proceeded with the upgrade.

The problem we have now is with the template treating single element arrays as scalar object. For example we use the following to display the first of a products images:

[% product.images.first.filename %]

which should give us the filename of the first image in the product.images array. Until the recent upgrade this did work for all instances, but now, if we have a product that only has one image, the template is treating it as a scalar object, so 'first' returns an empty object and no value gets displayed in the template.

Is this a known issue, and if so is there a fix? I realise we could do something like:

[% IF product.images.size > 1 %]
[% product.images.first.filename %]
[% ELSE %]
[% product.images.filename %]
[% END %]

however, the application we have is installed on many different sites on several different servers, so making a change like this would not be trivial. Any help from the list would be much appreciated.

Regards,

David

Reply via email to