View Single Post
  #11  
Old 01-20-2006, 08:35 AM
  moneysaver67's Avatar 
moneysaver67 moneysaver67 is offline
 

Advanced Member
  
Join Date: Nov 2005
Posts: 74
 

Default NightFire 50% Answer

Quote:
Originally Posted by NightFire
Got a question about the random images. Is it also possible to include the product title above the random image? And maybe the product price. That would be very nice.

As for the title, that's an easy one...

Go to random_image.tpl and add the following line above (or within) the a href= tag...


Just guessing, but I assumed the rand was returning outside the bounds of $config.Modules.number_of_randomproducts

Sure enough, this occurred as I had expected.
$config.Modules.number_of_randomproducts was set to 3, and occassionaly $rand resulted as 3, but arrays are an option base 0, so 3 is outside of the boundaries. To modify my above temporary fix, I account for this, and subtract 1 if necessary, resulting in the following:

Code:
{assign var="rand" value="0"|mt_rand:$config.Modules.number_of_randomproducts} {if $rand eq $config.Modules.number_of_randomproducts} {math assign="rand" equation="x-1" x=$rand} {/if} {$r_products[$rand].product} <a href=product.php?productid={$r_products[$rand].productid}>{include file="product_thumbnail.tpl" productid=$r_products[$rand].productid image_x=$config.Appearance.thumbnail_width product=$r_products[$rand].product tmbn_url=$r_products[$rand].tmbn_url}</a>
__________________
X-Cart 4.0.16-.19 Gold [unix] / DSEFU
Reply With Quote