1and1 Help Centre Categories

print article

How can I display a particular image if the image stored in the item is not available?

Problem: Your items have images. But for some reason if they don't show up,
the default "image not available" symbol shows up. And if you want a different
image to show up in such cases you can follow the instructions below:

Create your graphic and upload it under eShop -> Shop design -> Edit template files
-> Upload new image. Name it not_available.jpgEnter the code highlighted in red:
1. Now change the product display template (template_detail.template) as follows: (eShop -> Shop design -> Edit template files)


[...]
<table border="0">
<td width="40%" valign="top" align="left">

<?php
if (!file_exists(str_replace('../', '', $item_image)))
$item_detail_image = "$toshopdata/img/not_available.jpg";
php?>

<img src="$item_detail_image" <% EchoImageSize($item_detail_image) %> border=0>
</td>
[...]
2. Now change template_smalllist.template as follows:
(eShop -> Shop design -> Edit template files)

<tr>
<td align=right colspan=2>
<table border=0 width=100% cellspacing=2 cellpadding=2>
<tr>
<td colspan=3 bgcolor="$global_color1_bright">
<a href="<% URL_ITEM %>">
<font face="$global_fontface" size="$headlinetextsize" color="$global_fontcolor_bright">
$item_title
</font>
</a>
</td>
</tr>
<tr>
<td colspan=3 bgcolor="$global_color2_bright" valign=bottom>
<a href="<% URL_ITEM %>">

<?php if (!file_exists(str_replace('../', '', $item_image)))
$item_image = "$toshopdata/img/not_available.jpg"; php?>

<img src="$item_image" <% EchoImageSize($item_image) %> border=0 align=left>
[...]
3. Finally change template_search.template(eShop -> Shop design -> Manage shop templates)

<tr>
<td> </td>
<td align=right>
<table border=0 width=400 cellspacing=0 cellpadding=0>
<tr>
<td colspan=3 bgcolor="$global_color1_bright">
<a href="<% URL_ITEM %>">
$font
<font size="$headlinetextsize">
$item_title
</font>
$_font
</a>
</td>
</tr>
<tr>
<td colspan=3 bgcolor="$global_color2_bright" valign=bottom>
<a href="<% URL_ITEM %>">

<?php if (!file_exists(str_replace('../', '', $item_image)))
$item_image = "$toshopdata/img/not_available.jpg"; php?>

<img src="$item_image" <% EchoImageSize($item_image) %> border=0 align=left>
</a>
[...]
Please note: Upper and lower cases are important when you name your images.