drstuey
07-02-08, 04:09 AM
Hi,
I have a foreach loop in a Latu's Wow Wow Widgets block of code that displays some special products on the homepage. I am trying to add the product custom fields to those product listings.
I have two product custom fields: 'tagline' and 'tombstone'.
If the product has a 'tombstone' entered then it shows up correctly in the product listing. If the product has neither a 'tagline' nor a 'tombstone' entered then the product listing correctly shows nothing.
But if the product has a 'tagline' entered but not a 'tombstone' then it shows the tombstone for the wrong product!
Presumably this is because the first time through the foreach it sets the value of tombstone and it reuses this on subsequent times through the foreach.
The fact that it correctly hides it if there is no tagline, and shows it if there is a tagline suggests that (a) when one custom field is added to the database for a product it creates a new blank line in the database for the other custom field for that product and (b) my if exists code is not testing for a value in the custom field it is testing for the presence of a line in the database for that custom field. Yes?
My if exists code is: if expr="NOT ISNULL 1.settings:product:customfield_values:customfields :tombstone"
Is there a way to alter my if exists code to get it to only be true if there is real content in the custom field?
I have a foreach loop in a Latu's Wow Wow Widgets block of code that displays some special products on the homepage. I am trying to add the product custom fields to those product listings.
I have two product custom fields: 'tagline' and 'tombstone'.
If the product has a 'tombstone' entered then it shows up correctly in the product listing. If the product has neither a 'tagline' nor a 'tombstone' entered then the product listing correctly shows nothing.
But if the product has a 'tagline' entered but not a 'tombstone' then it shows the tombstone for the wrong product!
Presumably this is because the first time through the foreach it sets the value of tombstone and it reuses this on subsequent times through the foreach.
The fact that it correctly hides it if there is no tagline, and shows it if there is a tagline suggests that (a) when one custom field is added to the database for a product it creates a new blank line in the database for the other custom field for that product and (b) my if exists code is not testing for a value in the custom field it is testing for the presence of a line in the database for that custom field. Yes?
My if exists code is: if expr="NOT ISNULL 1.settings:product:customfield_values:customfields :tombstone"
Is there a way to alter my if exists code to get it to only be true if there is real content in the custom field?