Developer forum

Forum » Templates » Checking if ecom product images exist

Checking if ecom product images exist


Reply
 The senario is: I have a product that will have two images.
One pr. default and one that will sometimes be there, but not allways.
When a user clicks on any product in a list, he will be shown the product with (if any) product images. What I need to do is to check if there is a second images. I have tried to use a If Defined(Ecom:Product.ImageLarge.Default), but it does´nt seem to work..
The solution Im working on is: Dandryer.dk/admin
And the template is:
Product.html in Templates->ecom->product

Replies

 
Nicolai Høeg Pedersen
Reply
You need to do if defined on Ecom:Product.ImageLarge.Clean

Ecom:Product.ImageLarge.Default is the fallback image and will allways be there...
 
Reply
I have allready tried that.. The Code Im trying to use is:

If Defined(Ecom:Product.ImageLarge)
Ecom:Product.ImageLarge

EndIf(Ecom:Product.ImageLarge)


And that code in turn generates the result displayed in the image, on every product.
tilstand.png
 
Nicolai Høeg Pedersen
Reply
You have to use the extension .clean on your image in your if defined.
 
Reply
I tried to use .clean and its seems to be work. Thanks for the help
 
Reply
False alarm.. It still doesnt work.. I keep getting that "dead-link" images error when I use
If Defined(Ecom:Product.ImageLarge). 
 
Nicolai Høeg Pedersen
Reply
Well - you have to use: If Defined(Ecom:Product.ImageLarge.Clean)
 
Reply
Here is the code Im using both on the danish and german solution:

@If Defined(Ecom:Product.ImageLarge.Clean)

@Ecom:Product.ImageLarge

@EndIf(Ecom:Product.ImageLarge.Clean)



And this code generates a "broken link" image below the first image. I have used these dw-tag before without any problems.. It seems that the code or tag doesnt destinguish between weather or not an image exist on the product. It´s allmost as if the if/end if tag aren´t even visible or doesn´t work..



tilstand.png
 
Nicolai Høeg Pedersen
Reply

ok...

Have checked it out.

Go to management center, ecommerce, advanced, images and remove the autoscale checkbox for large images. It seems like there is a bug when this is set, and no "no-image" is set.

When you uncheck that, use your original code:

If Defined(Ecom:Product.ImageLarge)
Ecom:Product.ImageLarge

EndIf(Ecom:Product.ImageLarge)

 

 
Reply
thanks for the help. I appreaciate it.
 
Reply
I having the same problem right now. I can not get it only to show the image if one is selected. I get no output at all.


  <!--@If Defined(@Ecom:Product:Field.ExtraBillede3.Value.Clean)-->
  <!--@Ecom:Product:Field.ExtraBillede3.Value-->
  <!--@EndIf(@Ecom:Product:Field.ExtraBillede3.Value.Clean)-->
 
 
Reply
Hi there,

You don't need the @ in the If Defined tag in front of the tag you're testing....

Imar

 

You must be logged in to post in the forum