Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 04-23-2008 08:09:40

theblade24
Member
From: Tampa, Florida
Registered: 11-19-2003
Posts: 384
Website

Missing Image Featured Products

Throughout the cart if an item is missing an image then none.png is displayed instead of nothing.

This is not true for "featured products". In that array no image is displayed.

Can the code for featured products be modified to display none.png is there if no image found as well?

Last edited by theblade24 (04-23-2008 17:57:58)


CCP 5.1
CCP 5.1
CCP 5.1

Offline

 

#2 04-27-2008 06:51:05

theblade24
Member
From: Tampa, Florida
Registered: 11-19-2003
Posts: 384
Website

Re: Missing Image Featured Products

bump


CCP 5.1
CCP 5.1
CCP 5.1

Offline

 

#3 04-27-2008 07:16:53

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: Missing Image Featured Products

The category display view is what is used to show featured products and all of the default displays include logic to show the none image.  The test for whether or not an image is present is based on the small image for a product.  Unless you've customized the category display and removed the logic for detecting whether or not an image is present the none image should be displayed.

The displays in question are found in admin under Home > ClickCartPro (GBU) > Displays: Skins, Menus, XHTML Includes and Messages > Manage Catalog Product Displays: Category View

Offline

 

#4 04-27-2008 07:34:19

theblade24
Member
From: Tampa, Florida
Registered: 11-19-2003
Posts: 384
Website

Re: Missing Image Featured Products

The image is listed in the db for the product..........   but the image is not found on the server.

That is not how the logic works.... it only looks to see if there is a value for an image that is supposed to be there right?

If the value is there and the actual image isn't then it shows nothing.

Any way to get it to display none.png when no image is actually found?


CCP 5.1
CCP 5.1
CCP 5.1

Offline

 

#5 04-27-2008 07:59:50

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: Missing Image Featured Products

Not easily.  Testing for the presence of the images would add quite a bit of overhead since the logic would be used for every category displayed.  There isn't a base method available for testing whether or not a file is present so you'd have to "roll your own".

That said I'll point you towards the file_exists PHP function which you should be able to incorporate into the display you're using.  The path to the image is built for you already so it should be pretty easy to use file_exists to find out whether or not the file is actually there and handle accordingly.

Offline

 

#6 04-27-2008 09:59:47

theblade24
Member
From: Tampa, Florida
Registered: 11-19-2003
Posts: 384
Website

Re: Missing Image Featured Products

Gave this a try but getting nothing.

Code:

<?php if file_exists(/var/www/html/domain/media/ccp0/prodsm/$imgname) {

print "<a href='";
print $prodlink;
print "' title='";
print $prodname;
print "'>";
print $imgtag;
print "</a>";

} else {

print "Test";

}

?>

CCP 5.1
CCP 5.1
CCP 5.1

Offline

 

#7 04-27-2008 10:15:15

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: Missing Image Featured Products

You're probably getting a blank page because of a malformed if statement.

Code:

<?php if (file_exists('/var/www/html/domain/media/ccp0/prodsm/' . $imgname)) {

print "<a href='";
print $prodlink;
print "' title='";
print $prodname;
print "'>";
print $imgtag;
print "</a>";

} else {

print "Test";

}

?>

It also depends where you're putting that too of course.

Offline

 

#8 04-27-2008 13:45:26

theblade24
Member
From: Tampa, Florida
Registered: 11-19-2003
Posts: 384
Website

Re: Missing Image Featured Products

ok, got it to work.

In order to display none.png when an image is listed for a product in the database, but the image file is NOT on your server:

In Home > ClickCartPro > Displays: Skins, Menus, XHTML Includes and Messages > Manage Catalog Product Displays: Category View (then the view of your choice)

replace

Code:

$imgname  = $proddisp['imgsm'];
if (empty($imgname)) {$imgname = 'none.png';}

$imgwidth = $this->globals('khxc_settings.' . $app . '.imgsizeprodsm');
$imgurl   = 'media/' . $app . '/prodsm/' . $imgname;

$imgtag   = '<img src="' . $imgurl . '" ';
if ($imgwidth) {$imgtag .= 'width="' . $imgwidth . '" ';}
$imgtag  .= 'alt="' . $prodname . '" />';

// +--
// | Print the display.
// +--

?>

<div class="center">

     <a href="<?php print $prodlink; ?>" title="<?php print $prodname; ?>"><?php print $imgtag; ?></a>

with

Code:

$imgname  = $proddisp['imgsm'];
$imgnamenone = 'none.png';

if (empty($imgname)) {$imgname = 'none.png';}

$imgwidth = $this->globals('khxc_settings.' . $app . '.imgsizeprodsm');
$imgurl   = 'media/' . $app . '/prodsm/' . $imgname;
$imgurlnone   = 'media/' . $app . '/prodsm/' . $imgnamenone;

$imgtag   = '<img src="' . $imgurl . '" ';
if ($imgwidth) {$imgtag .= 'width="' . $imgwidth . '" ';}
$imgtag  .= 'alt="' . $prodname . '" />';

$imgtagnone   = '<img src="' . $imgurlnone . '" ';
if ($imgwidth) {$imgtagnone .= 'width="' . $imgwidth . '" ';}
$imgtagnone  .= 'alt="' . $prodname . '" />';

// +--
// | Print the display.
// +--

if (empty($imgwidth)) {$imgwidth = 100;}

?>

<table class="khxc_ghost"><tr><td class="khxc_ghost" style="width: <?php print $imgwidth; ?>px">

<?php if (file_exists('/var/www/html/prosportsmemorabilia/media/ccp0/prodsm/' . $imgname)) {

print "<a href='";
print $prodlink;
print "' title='";
print $prodname;
print "'>";
print $imgtag;
print "</a>";

} else {

print "<a href='";
print $prodlink;
print "' title='";
print $prodname;
print "'>";
print $imgtagnone;
print "</a>";

}

?>

Last edited by theblade24 (04-27-2008 13:46:36)


CCP 5.1
CCP 5.1
CCP 5.1

Offline

 

Board footer