Welcome, Guest ( Customer Panel | Login )




 All Forums
 VPCart Forum
 Problems and bugs
 CINT Function large DB
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

dencom
Starting Member

New Zealand
2 Posts

Posted - April 12 2006 :  19:40:23  Show Profile  Reply with Quote
FYI
I have found in shoprandom.asp at line 161 an 163 you are using CINT functions which is great if you have only 32767 products. I would recommend changing this to Clng.

Also the Sub DisplayRandomprodcuts loops through the entire database, not practical with a large database. I am having to rewrite this feature.

support
Administrator

4679 Posts

Posted - April 12 2006 :  21:10:15  Show Profile  Visit support's Homepage  Reply with Quote
Hi there,

You can limit the number of products the script chooses from by just generating random products of the latest 100 products, for example.

To do that, edit the following lines in shoprandomproducts.asp:

line 136:
sqlstr="SELECT catalogid FROM products where hide=0"

replace with:
sqlstr="SELECT TOP 100 catalogid FROM products where hide=0"

Then add another line below line 148:
sqlstr = sqlstr & " ORDER BY catalogid DESC"

So it should look like:
sqlstr = sqlstr & " AND (highercatalogid is null)"
sqlstr = sqlstr & " ORDER BY catalogid DESC"

If you are using MySQL, ignore the first change, and add the following under line 148:
sqlstr = sqlstr & " LIMIT 0,100 ORDER BY catalogid desc"

So it looks like:
sqlstr = sqlstr & " AND (highercatalogid is null)"
sqlstr = sqlstr & " LIMIT 0,100 ORDER BY catalogid desc"

Hope that helps.

Regards,
Joseph


Edited by - support on April 12 2006 21:48:23
Go to Top of Page

dencom
Starting Member

New Zealand
2 Posts

Posted - April 12 2006 :  21:58:05  Show Profile  Reply with Quote
Great. Worked a treat.
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