Keyword

Random catalog and pagination

  • Hubert Bonisseur De La Batte
  • Hubert Bonisseur De La Batte's Avatar Topic Author
  • Offline
  • New Member
More
13 years 8 months ago #92526 by Hubert Bonisseur De La Batte
Random catalog and pagination was created by Hubert Bonisseur De La Batte
Hi,

the pagination of category list is broken when you choose random ordering, cause the ordering is computed on each new page.

In mysql you can use a seed, this way the random order is allways the same

the seed I propose you is based on the session id

this way, the order will be random between each visitors and each distinct visit

 

in file models/itemlist.php @ line 249change the case 'rand' :

 

            case 'rand':                $currentSession = &JFactory::getSession();                                $sessionNum = substr(preg_replace('/[^0-9]/i','',$currentSession->getId()),2,3);                $orderby = 'RAND('.$sessionNum.')';                break;

 

:)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum