Bug with pagination and "random ordering"

  • Darren Forster
  • Darren Forster's Avatar Topic Author
  • Offline
  • New Member
2 weeks 1 day ago #178091 by Darren Forster
Bug with pagination and "random ordering" was created by Darren Forster
I've just found a bug with pagination and random ordering. If you turn random ordering on and you have more than one page you might never see some of the items in the category.

It seems that at each page the system randomises the items again and again rather than randomising initially and storing that list between pages to ensure all items are shown.

For example if I had 6 items called item-1,2,3,4,5,6 and the order was set as random with 2 items per page this could happen..

item 1 and 6 on page 1
item 6 and 2 on page 2
item 3 and 4 on page 3

in this instance item 5 would never be shown and item 6 is shown twice.

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

  • Fotis
  • Fotis's Avatar
  • Online
  • Administrator
  • JoomlaWorks Support Team
1 week 5 days ago #178125 by Fotis
Replied by Fotis on topic Bug with pagination and "random ordering"
You're right. This is because of this:

So try this please, since you're all setup already. Edit the file /components/com_k2/models/itemlist.php and change line 316 from:
                $orderby = 'RAND()';

                $orderby = 'RAND('.JRequest::getInt('itemid').')';

This should cause the randomized set to stick to the same order for a given menu item.

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory:

IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

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

Powered by Kunena Forum