Keyword

Next & Previous link order is all scrambled?

  • Uzi
  • Uzi's Avatar Topic Author
  • Offline
  • Premium Member
More
7 years 5 months ago - 7 years 5 months ago #162629 by Uzi
Hello,

I have a problem regarding the next and previous links that are below an item.

It's a weird thing, the next and previous links are not taking the article order into account? The next and previous links are all scrambled, it's not like the order it's on the front page. The order is all weird. How can I change this?
Last edit: 7 years 5 months ago by Uzi.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 5 months ago #162632 by Krikor Boghossian
Replied by Krikor Boghossian on topic Next & Previous link only main category?
Hello,

The Next / Previous links are the next (and previous) items within the same category.

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

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

  • Uzi
  • Uzi's Avatar Topic Author
  • Offline
  • Premium Member
More
7 years 5 months ago #162633 by Uzi
Yeah but what is the next one? The next ID? The next one based on creation date?

I have an article with ID 13594, the next and previous link give me the following article ID's: 13272 and 13263

These are not even remotely close to being the next or previous link. Is it possible it has something to do when you copy articles? That is the only thing I can make up as a possible reason.

It's supposed to be: 13595 and 13593

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 5 months ago #162635 by Krikor Boghossian
Replied by Krikor Boghossian on topic Next & Previous link only main category?
Do these items belong to the same category?

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

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

  • Uzi
  • Uzi's Avatar Topic Author
  • Offline
  • Premium Member
More
7 years 5 months ago #162640 by Uzi

Krikor wrote: Do these items belong to the same category?


Yes, these are articles in the same category.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 5 months ago #162656 by Krikor Boghossian
Replied by Krikor Boghossian on topic Next & Previous link only main category?
It will pull the next item from the same category if there is no ordering value. Otherwise it will respect the component's ordering.

github.com/getk2/k2/blob/master/components/com_k2/models/item.php#L1847-L1854

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

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

  • Uzi
  • Uzi's Avatar Topic Author
  • Offline
  • Premium Member
More
7 years 4 months ago - 7 years 4 months ago #162658 by Uzi

Krikor wrote: It will pull the next item from the same category if there is no ordering value. Otherwise it will respect the component's ordering.

github.com/getk2/k2/blob/master/components/com_k2/models/item.php#L1847-L1854


Where can I configure the ordering of the items? I cannot find it in the category itself...?

Found it! It's in the menu options.

Hmm, it's still not working. I have a category which is sorted by publication date. Now the previous and next links are not working correctly, it looks like it's not using the publication date, but maybe the ID or something? I cannot find the sorting it's using now. It looks like it's all scrambled.

EDIT: Ok, I think I found something. Which is, if I get the articles to order by publish date I think it can work. I think the ordering of the articles for the next and previous links are not the same as how I configured the rest, namely by date.

EDIT 2: I found it. It uses the ordering of the items in the k2 items manager. Always. So there has to be a core hack for to fix it, and sort it by date.
Last edit: 7 years 4 months ago by Uzi.

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

  • Uzi
  • Uzi's Avatar Topic Author
  • Offline
  • Premium Member
More
7 years 4 months ago #162660 by Uzi

Yuzi wrote:

Krikor wrote: It will pull the next item from the same category if there is no ordering value. Otherwise it will respect the component's ordering.

github.com/getk2/k2/blob/master/components/com_k2/models/item.php#L1847-L1854


Where can I configure the ordering of the items? I cannot find it in the category itself...?

Found it! It's in the menu options.

Hmm, it's still not working. I have a category which is sorted by publication date. Now the previous and next links are not working correctly, it looks like it's not using the publication date, but maybe the ID or something? I cannot find the sorting it's using now. It looks like it's all scrambled.

EDIT: Ok, I think I found something. Which is, if I get the articles to order by publish date I think it can work. I think the ordering of the articles for the next and previous links are not the same as how I configured the rest, namely by date.

EDIT 2: I found it. It uses the ordering of the items in the k2 items manager. Always. So there has to be a core hack for to fix it, and sort it by date.


Ok I tried to change the item.php model to change the getPreviousItem method. But if I use the publish_up instead of ordering to sort, it's not working as intended.

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

  • Uzi
  • Uzi's Avatar Topic Author
  • Offline
  • Premium Member
More
7 years 4 months ago #162663 by Uzi
Anyone got an idea? I found an old topic regarding this issue, but that is 3-4 years ago.

www.joomlaworks.net/forum/k2-en/45668-item-navigation-order-alphabetically

Cannot seem to make it work by hacking the core code..

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 4 months ago #162685 by Krikor Boghossian
Replied by Krikor Boghossian on topic Next & Previous link order is all scrambled?

Ok I tried to change the item.php model to change the getPreviousItem method. But if I use the publish_up instead of ordering to sort, it's not working as intended.


Can you send me the code you used?

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