View Single Post
  #34  
Old 01-01-2004, 04:09 PM
 
dealsondeals dealsondeals is offline
 

eXpert
  
Join Date: Dec 2002
Location: Dallas, Texas, USA
Posts: 231
 

Default

TelaFirma,

First I would like to thank you for your code. Next, I would like to request your assitance. By the way I'm using x-cart 3.5.x

I have made a slight change so that when implemented, the query will randomly select an image from the amongst thumbnail images as opposed to the detailed image as you originally coded. All seems to be fine, everytime I refresh the page a different product is referenced except that the thumbnail images themselves are not displayed, I get the default "No Image Available" image being shown. I believe the "Get thumbnail's URL" area is where the problem lies. I took the liberty to open up "featured_products.php" to see how it pulls back the thumnail's url. It does it like so:
Quote:
#
# Get thumbnail's URL (uses only if images stored in FS)
#
$f_products[$f_v]["tmbn_url"] = func_get_thumbnail_url($f_products[$f_v]["productid"]);

It appears to using the function: func_get_thumbnail_url. I have tried to use it as well with no success.

Here is the code I currently have for "random.php"(without func_get_thumbnail_url) :

Quote:
<?
// give it all available products to work with
// $image_id = func_query("SELECT productid FROM $sql_tbl[thumbnails]);

// set the variables
// $str = "";
// $numberRandoms=1; // set this to how many you want to show

// srand((double)microtime()*1000000);
// $rnd = rand(0, count($image_id)-1);
$images = func_query("select * from $sql_tbl[thumbnails] ORDER BY RAND() limit 1");
if ($current_area != "C" && is_array($images)) {
foreach($images as $k=>$v) {
$images[$k]["type"] = (eregi("gif",$v["image_type"])?"GIF"eregi("png",$v["image_type"])?"PNG":"JPG"));
}
}
#
# Get thumbnail's URL (uses only if images stored in FS)
#
if ($config["Images"]["det_images_location"] == "FS")
if ($current_area == "C" && is_array($images)) {
foreach($images as $k=>$v)
if (eregi("^(http|ftp)://", $v["image_path"]))
# image_path is an URL
$images[$k]["tmbn_url"] = $v["image_path"];
elseif (eregi($xcart_dir, $v["image_path"])) {
# image_path is an locally placed image
$images[$k]["tmbn_url"] = $http_location.ereg_replace($xcart_dir, "", $v["image_path"]);
}
}
$smarty->assign("images",$images);
?>

Any assitance would be greatly appreciated. Anybody else with some ideas on this, please share your thoughts.

Thanks,

Glen
__________________
Never understimate stupidity.
--------
X-Cart Version: 3.5.2
Hosting:mind-in-design.net
Configuration: Virtual Dedicated Server || Intel Pentium 4 2.4 GHZ CPU || 1024MB PC2100 DDR RAM || Linux || PHP 4.3.2 || MySQL server 4.0.14
Reply With Quote