Author Topic: random thumb  (Read 1489 times)

Offline Bug

  • Posts: 237
random thumb
« on: May 17, 2011, 09:21:59 PM »
anyone knwo a simple way to get a random thumbnail from a product

I am making a t-shirt-shop with t-shirtdesigns available on different colors.. I would love it if the view overview would look different each pageload ...

Offline Bug

  • Posts: 237
Re: random thumb
« Reply #1 on: May 19, 2011, 05:45:15 PM »
what i did for now:

is there any way I can automatically can create the array that should be randomized?

now I need to have all images named in the same way

Code: [Select]
$thumbrandlist= array("-green.jpg", "-white.jpg", "-blue.jpg", "-black.jpg", "-yellow.jpg");
//echo $thumbrandlist[rand(0,4)];
$thumbrand = "<a href='".$item_link."'><img src='".$item_id."/".$item['sku'].$thumbrandlist[rand(0,4)]."' border='0'/></a>";

// Replace vars with values
$vars = array('[THUMB]', '[THUMBS]', '[THUMBRAND]', '[IMAGE]', '[IMAGES]', '[TITLE]', '[PRICE]', '[DESCRIPTION]', '[CURRENCY]', '[LINK]', '[TXT_PRICE]');
$values = array($thumb, $thumbs, $thumbrand, $image, $images, stripslashes($item['title']), stripslashes($item['price']), stripslashes($item['description']), $setting_shop_currency, $item_link, $MOD_showroom['TXT_PRICE']);
echo str_replace($vars, $values, $setting_item_loop);