Welcome, Guest ( Customer Panel | Login )




 All Forums
 VPCart Forum
 Customization
 How to randomize the featured products?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

responderpse
Starting Member

USA
6 Posts

Posted - August 14 2008 :  16:38:35  Show Profile  Visit responderpse's Homepage  Reply with Quote
In this sub: TopTenProduceDetail, I would like to know how to make the recordset randomized so the featured products will change from page to page.

Kidd
VP-CART Super User

Australia
373 Posts

Posted - August 20 2008 :  01:17:54  Show Profile  Reply with Quote
mm youll need to store all the record set in an array then create a random number and use that random number as the array number
Go to Top of Page

SDCPieter
VP-CART New User

United Arab Emirates
57 Posts

Posted - August 20 2008 :  06:06:39  Show Profile  Reply with Quote
Or try the easy way?

On line 1230 (approx, my code is customized) in that TopTenProduceDetail Sub, try changing

strsql=strsql & " ORDER BY sum(o.numitems) DESC"

to

strsql=strsql & " ORDER BY NEWID() DESC"

That should randomize the records returned by the database. I think this might only work for SQL Server though. So instead of ordering by the amount of times this product has been bought, you will randomly display 10 products. you might want to add a "having" clause to only select the most popular products though

-
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000
0 Item(s)
$0.00