Support Forums


Go Back   68 Classifieds Forums > Help & Support > v4.1 Questions & Support

Notices

 
LinkBack Thread Tools Display Modes
Old 08-27-2009, 05:06 PM   #1
Member
 
Join Date: Jun 2009
Posts: 32
Rep Power: 1
vertyal is on a distinguished road
Default How to get random listing order?

Can anyone help me how to make the listings appear in random order within a category when browsing the category, and in the search results? I looked at the includes/classes/kernel/Listings.php file and found the section where the sorting is coded (around row 461), and tried to add the RAND() sorting, but then my site did not work properly, so I restored it to the original.

It would be quite important for me to do this, so any help is highly appreciated.

Thanks in advance.

I am running 4.1.4 Developer version.
vertyal is offline   Reply With Quote
Old 08-27-2009, 05:24 PM   #2
All Hands On Deck
 
 
Join Date: Mar 2008
Posts: 1,307
Rep Power: 33
seymourjames has a spectacular aura about
Default

Please be more specific. Do you want them random all the time, from search, in browse , what?
__________________
TemplateCodes.com
seymourjames is offline   Reply With Quote
Old 08-27-2009, 05:56 PM   #3
Member
 
Join Date: Jun 2009
Posts: 32
Rep Power: 1
vertyal is on a distinguished road
Default

Hi James,
I want them to be random all the time.
I want it to be random when someone browses a given category, and I also want it random, when someone runs a search, so that the search results display in random order.
vertyal is offline   Reply With Quote
Old 08-29-2009, 03:38 PM   #4
Member
 
Join Date: Jun 2009
Posts: 32
Rep Power: 1
vertyal is on a distinguished road
Default

So does anyone have a clue how this could be done? To make it clear again, my goal is the following:
- I would like the order of the listings to be random by default instead of ASC or DESC;

I do not know how I could be more specific about this...
vertyal is offline   Reply With Quote
Old 08-29-2009, 09:05 PM   #5
All Hands On Deck
 
 
Join Date: Mar 2008
Posts: 1,307
Rep Power: 33
seymourjames has a spectacular aura about
Default

About line 462 in your includes/classes/kernelListings.php file

change

$listingSQL=$sSQL .' '. $where .' ORDER BY '. $sqlsort .' '. $sortorder;
to

$listingSQL=$sSQL .' '. $where .' ORDER BY RAND() '. $sortorder;



Do test thoroughly that you do not get strange side effects.

By the way I think this is not a great way to proceed from an SEO perspective. It looks to the search engines that nearly all of your site is random (changing constantly). No stability. The other thing to remember is this is a core file change and you will need to remember it, if and when you upgrade.
__________________
TemplateCodes.com
seymourjames is offline   Reply With Quote
Old 08-30-2009, 06:34 AM   #6
Member
 
Join Date: Jun 2009
Posts: 32
Rep Power: 1
vertyal is on a distinguished road
Default

Thank you very much for the help. The point you made regarding SEO is something I have to consider. It is not something I thought of...
Thanks again.
Bye,
Vert
vertyal is offline   Reply With Quote
Old 08-30-2009, 10:34 PM   #7
All Hands On Deck
 
 
Join Date: Mar 2008
Posts: 1,307
Rep Power: 33
seymourjames has a spectacular aura about
Default

Happy to have helped.
__________________
TemplateCodes.com
seymourjames is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Featured Ads in random order jaybarber1 v4.1 Questions & Support 1 07-26-2009 01:49 PM
Display Featured Ads in Random Order MrGForce v4.1 Questions & Support 3 07-15-2009 09:09 AM
listing ads in descending order tidy v4.1 Questions & Support 7 06-23-2009 04:23 PM
Set the order of RSS feed to random? PeterB v4 Questions & Support 5 02-05-2009 12:09 PM
Extra field - Random Listing Horizontal oktanedesign Modules / Plugins / Modifications 2 12-05-2008 02:11 PM


All times are GMT -4. The time now is 09:00 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0