WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => Bakery Shop => Topic started by: Bug on May 17, 2011, 09:21:59 PM

Title: random thumb
Post by: Bug 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 ...


Title: Re: random thumb
Post by: Bug 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='http://www.domainname.com/media/bakery/thumbs/item".$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);