Hi!
I have a assigned 2-6 images for a product and added custom image patterns, but as the number of images can vary I only want to display image patterns that really have an attached image. I'm defining the patterns in the product catalog module and that the product images will reside in Billeder/Products and e.g. if there's not an image 45454_Image2_Large.jpg in that folder I don't want to display that tag, now it's an empty image if the jpeg file don't exist.
Is this possible?
Best regards,
P
Developer forum
E-mail notifications
Check if an image exist
Per Ljung
Posted on 12/03/2012 13:27:09
Replies
Merethe Nielsen
Posted on 12/03/2012 14:42:52
Hi
What version do you use?
Can you attach an image of your paragraph settings and maybe your template?
Kind regards,
Merethe
Per Ljung
Posted on 12/03/2012 16:25:38
Hi!
Here is my code:
Here is my code:
<xsl:if test="Ecom.Product.Image2Large.Clean != ''"> <a> <xsl:attribute name="href"> <xsl:value-of select="Ecom.Product.Image2Large.Clean" disable-output-escaping="yes"/> </xsl:attribute> <img height="64" width="60" style="width: 60px; height: 54px; border: 0px;" > <xsl:attribute name="src"> <xsl:value-of select="Ecom.Product.Image2XSmall.Clean" disable-output-escaping="yes"/> </xsl:attribute> <xsl:attribute name="alt"> <xsl:value-of select="Ecom.Product.Name" disable-output-escaping="yes"/> </xsl:attribute> </img> </a> </xsl:if> /Per
Vladimir
Posted on 13/03/2012 02:29:53
Hi Per!
I hope that can help you:)
In global settings you can set the img that will shown if pattern img is absent
"/Globalsettings/Ecom/Picture/NoPicture/" & Pattern
for example, in your case:
"/Globalsettings/Ecom/Picture/NoPicture/2Large" -> "Billeder/NoPicture/x.jpg"
"/Globalsettings/Ecom/Picture/NoPicture/2XSmall" -> "Billeder/NoPicture/x.jpg"
and so on...
So you can always determine is pattern img exist or not.
Best regards,
Vladimir
I hope that can help you:)
In global settings you can set the img that will shown if pattern img is absent
"/Globalsettings/Ecom/Picture/NoPicture/" & Pattern
for example, in your case:
"/Globalsettings/Ecom/Picture/NoPicture/2Large" -> "Billeder/NoPicture/x.jpg"
"/Globalsettings/Ecom/Picture/NoPicture/2XSmall" -> "Billeder/NoPicture/x.jpg"
and so on...
So you can always determine is pattern img exist or not.
Best regards,
Vladimir
Per Ljung
Posted on 13/03/2012 08:44:39
Hi!
But I can only find settings for the patterns Small, Medium and Large, not the patterns of my own. There is a field to type in pattern, but no place to set the image if an image with that pattern doesn't exist.
Best regards,
Per
Vladimir
Posted on 13/03/2012 08:58:49
Do you have access to GlobalSetting.asph file?
If no, let's I self create these setting for you (I need to know address)
Best regards,
Vladimir
If no, let's I self create these setting for you (I need to know address)
Best regards,
Vladimir
Per Ljung
Posted on 13/03/2012 09:05:06
I think so, I have full access to the solution, it's a custom solution. Just tell me where this file is placed.
/Per
Vladimir
Posted on 13/03/2012 09:07:46
Ok, Files/GlobalSettings.aspx :)
Per Ljung
Posted on 13/03/2012 09:28:00
Hi!
I found it, but still a problem, my patterns are
2XSmall
3XSmall
4XSmall
5XSmall
But it seems like starting a node with a number is not valid xml. When I added these settings, the whole admin page became white with no content.
/Per
Per Ljung
Posted on 13/03/2012 09:39:04
Do you have an email?
Vladimir
Posted on 13/03/2012 11:04:01
hm.. you are right, xml node can't start with a number... this was the most right way I think...
Well... another way extend xslt with c# code... but it is better not to do so...
Well... another way extend xslt with c# code... but it is better not to do so...
Per Ljung
Posted on 13/03/2012 13:08:46
Hi! I think I can solve it in another way. But how do you write the xml code? I have tried this:
<Picture> <NoPicture> <Medium> </Medium> <Large_path> </Large_path> <Large> </Large> <Small_path> </Small_path> <Medium_path> </Medium_path> <Small> </Small> <Img2_XSmall></Img2_XSmall> <Img3_XSmall></Img3_XSmall> <Img4_XSmall></Img4_XSmall> <Img5_XSmall></Img5_XSmall> <Img2_XSmall_path></Img2_XSmall_path> <Img3_XSmall_path></Img3_XSmall_path> <Img4_XSmall_path></Img4_XSmall_path> <Img5_XSmall_path></Img5_XSmall_path> </NoPicture>
Vladimir
Posted on 14/03/2012 02:14:10
As I understand you change your pattern prefix to Img2_XSmall, Img3_XSmall etc?
In that case your xml should be, for example:
ps: don't forget to create this picture of course: /Files/Billeder/NoPicture/x.jpg
In that case your xml should be, for example:
<Picture> <NoPicture> <Medium> </Medium> <Large_path> </Large_path> <Large> </Large> <Small_path> </Small_path> <Medium_path> </Medium_path> <Small> </Small> <Img2_XSmall>Billeder/NoPicture/x.jpg</Img2_XSmall> <Img3_XSmall>Billeder/NoPicture/x.jpg</Img3_XSmall> <Img4_XSmall>Billeder/NoPicture/x.jpg</Img4_XSmall> <Img5_XSmall>Billeder/NoPicture/x.jpg</Img5_XSmall> </NoPicture>
ps: don't forget to create this picture of course: /Files/Billeder/NoPicture/x.jpg
Per Ljung
Posted on 28/03/2012 11:17:08
Hi again!
My pattern is {productnumber}_Img2_XSmall.jpg, how do write this in GlobalSettings.aspx?
Best regards,
P
Per Ljung
Posted on 01/04/2012 20:22:24
Hi!
I'm not getting this to work, any ideas how to write? I asked the support too, but they referred me back to the forum because it was a developer issue. The solution is viking.net.
Best regards,
Per
Vladimir
Posted on 02/04/2012 13:57:48
Hi Per!
No no, I talked about the values in left column - so to write them in GlobalSettings they should be started with letters like (Img2_XSmall, Img3_XSmall etx)
Best regards,
Vladimir
No no, I talked about the values in left column - so to write them in GlobalSettings they should be started with letters like (Img2_XSmall, Img3_XSmall etx)
Best regards,
Vladimir
Per Ljung
Posted on 02/04/2012 22:21:55
Hi again!
Yes I know, I've tried this and many other variants, but for some reason I can't make it work. No matter how I write I only get the path to the non existent pattern image file. I've looked in the template xml output and the a path to the "no-image"-file is missing.
Can you please take a look in the solution to see what's wrong, I gave you the solution name in a previous forum post.
If you do this
Best regards,
Per
Vladimir
Posted on 03/04/2012 03:19:23
Per, I open viking.net - but this is just static html page?
Per Ljung
Posted on 03/04/2012 08:42:19
Oh, sorry, I meant viking.net.dynamicweb.se. Can you go to admin and check?
Best regards,
Per
Vladimir
Posted on 05/04/2012 14:56:27
Hi Per,
it seems I found decision
1) paths in globalsetting should be without /files/, just: Billeder/no-image.gif
2) tags for this case should be ended with .Default.Clean postfix (instead of .Clean)
Best regards,
Vladimir
it seems I found decision
1) paths in globalsetting should be without /files/, just: Billeder/no-image.gif
2) tags for this case should be ended with .Default.Clean postfix (instead of .Clean)
Best regards,
Vladimir
You must be logged in to post in the forum