How to remove "No Image available" ?

How to remove “No Image available” ?



Sometimes I have products with no photos and I do not like the default:



“No image available” box.



Is it easy to remove the boxes?

[quote name=‘Traveler’]How to remove “No Image available” ?



Sometimes I have products with no photos and I do not like the default:



“No image available” box.



Is it easy to remove the boxes?[/QUOTE]



Hello!



In order to delete “No Image Available” image you need to do the following:



1)Open the “image.php” file, which is located in the root directory of your CS-Cart installation;

2)Replace the following code:



if (empty($window)) {
$image_data = fn_get_image($image_id, $object_type, true);
if (!empty($image_data)) {
header("Content-type: $image_data[image_type]");
echo $image_data['image'];
} else {
header('Content-type: image/gif');
readfile($skins_dir.$skin_name.DS.AREA_NAME.DS.'images'.DS.'no_image.gif');
}
exit;




with this one:



if (empty($window)) {
$image_data = fn_get_image($image_id, $object_type, true);
if (!empty($image_data)) {
header("Content-type: $image_data[image_type]");
echo $image_data['image'];
// } else {
// header('Content-type: image/gif');
// readfile($skins_dir.$skin_name.DS.AREA_NAME.DS.'images'.DS.'no_image.gif');
}
exit;




3)Save the file.

4)Open the “skins/[CUSTOMER_ACTIVE_SKIN]/customer/common_templates/image.tpl” file;

5)Replace the following part of code:



{if $settings.General.images_location == "database"}
{assign var="image_src" value="$image_index?object_type=`$object_type`&image_id=`$images.image_id`"}
{else} {* image is stored in file system *}
{assign var="image_src" value=$images.icon.image_path|default:$no_image_path}
{/if}




with this one:



{if $settings.General.images_location == "database"}
{assign var="image_src" value="$image_index?object_type=`$object_type`&image_id=`$images.image_id`"}
{else} {* image is stored in file system *}
{assign var="image_src" value=$images.icon.image_path}
{/if}




6)Save the file.

Thank you.

Not at all.

I want to do the same with latest version, and there is no file “image.php” file, in the root directory.



How do I achieve this with latest version?

[quote name=‘jmccann’]I want to do the same with latest version, and there is no file “image.php” file, in the root directory.



How do I achieve this with latest version?[/quote]



Latest version will call for no_image.gif, in the present state “image.php” refers to the images in the database.

Hi



Does anyone have a nice way to do this and lose the dead space at the side etc?



I can edit image tpl and remove the default, but it still leaves all the clutter



Is it possible to do an ‘if image is blank don’t show the div’ kind of thing?



Also where would I put an override file for this?





Thanks



Lee

Any reason you don’t take an empty transparent image (empty_image.gif) and copy it over the no_image.gif file? Then ther are no code changes or any other modifications. It does however leave the alignment in place when there is no image which is desireable for lists, but not usually desirable for details.

Hi



Because the thumbnail width is set on this site it still shows, and I’d prefer to lose all the fluff code when there is no image to display



For example some categories have a header iimage then a load of variations as individual products. It looks silly with a load of ‘no image’ gifs all down the side





Lee

So if you replace no_image.gif with an empty image that is transparent of the same size then you’ll just see nothing in that space. I thought that was what you originally wanted.

Hi



The thumbnails are set to 120 wide in the admin, so although the image would be blank, there would be a 120 pixel gap all down the left side which would look odd.



There would also be all the html involved in the thumbnail still in there



I’d rather add some code to check if there is a thumbnail, and if not completely drop the image section. It would make the alignment better and clean up the source code



I have edited image.tpl and taken out the default image, but the alignment is still a little off and I also can’t get that to work as an override file which I’d much rather have



Lee

Use ‘Grid Layout’?

Hi



Thanks for the responses so far



I had tried various other layouts, and the option of using a blank gif with them, the best other layout (which I can default in the category) is compact list, but this is a big site (about 470 products and counting) and I’d like to keep it looking uniform



If it was php based I’d simply put something like





if $image = “” {

} else {

include image block

}



Thats the kind of thing I really need





Lee

Does anyone know how I can create a custom template for a category page so that I can experiment?



I only need about 2 pages to not show product images so I could just cut the code out of a template completely





Thanks





Lee

Hi



I have resolved this now.



For anyone else who may come across this here is my solution.



I duplicated product_list_templates/products_without_options.tpl

and renamed it products_without_options_noimage.tpl



I duplicated list_templates/products_list.tpl

and renamed it products_list_noimage.tpl and removed the entire image div from the source



I then renamed the contents of both files to add _noimage to the id’s etc and changed the include from product list to my new file



{include file=“blocks/list_templates/products_list_noimage.tpl”}





Once uploaded this gave me the option to add this view but the text looked a mess



I found adding a language string for the ID ({** template-description:list_without_options_noimage **}) and then set that as the custom default view in the category admin



Phew



Lee

[quote name=‘leeshields’]

I found adding a language string for the ID ({** template-description:list_without_options_noimage }) and then set that as the custom default view in the category admin



Phew



Lee[/QUOTE]



Thanks, Leeshields for sharing this info. I’d like to add my 50 cents to the issue.

I needed to variate image sizes for different categories and applied your solution with tiny modifications.

First, I added needed image size parameters: image_thumb_width=100 and image_thumb_height=100 in \skins[YOUR_SKIN]basic\customer\blocks\product_list_templates\products_without_options_image_100.tpl (that’s the name I gave to a copied products_without_options.tpl) and replaced in a new file (products_without_options_image_100.tpl) line:

{
template-description:list_without_options }

with the

{
template-description:list_without_options_image_100 **}

then added a lang variable string for “list_without_options_image_100” ID.

Next, I made a copy of the file /skins/[YOUR_SKIN]/customer/blocks/list_templates/products_list.tpl and named it /skins/[YOUR_SKIN]/customer/blocks/list_templates/products_list_image_alt.tpl

In the copy I replaced all the occurences of “$settings.Thumbnails.product_lists_thumbnail_width” with the new parameter, set in products_without_options_image_100.tpl: “$image_thumb_width”.

Same with the “$settings.Thumbnails.product_lists_thumbnail_height”: replaced with “$image_thumb_height”.

Very unprofessional, I admit, though I’m not), but it works for now. I can choose the new view for a product list. Same thing can be done to modify available standard views to set necessary image size or create your own.

I think it’d be better to provide the two parameters (image thumbnail width and image thumbnail height) as an option when assigning the views to a category. 0 in both width and height means no image, otherwise this gives the needed size for the thumbnails in a product list view. This should override the default values, set in Administration/Design/Appearance settings.