Keyword

Bug with pagination and "random ordering"

  • Darren Forster
  • Darren Forster's Avatar Topic Author
  • Offline
  • New Member
More
3 years 1 month 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.

More
3 years 1 month ago #178125 by JoomlaWorks
Replied by JoomlaWorks on topic Bug with pagination and "random ordering"
You're right. This is because of this: github.com/getk2/k2/blob/master/components/com_k2/models/itemlist.php#L316

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()';

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

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

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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


Powered by Kunena Forum