Keyword

[SOLVED] Next and prev. item buttons regardless of category

  • jozsefke
  • jozsefke's Avatar Topic Author
  • Offline
  • Junior Member
More
8 years 8 months ago - 8 years 8 months ago #146350 by jozsefke
Is it possible to make the next item and previous item buttons in the more in this category section link to the next or previous item by creation date, regardless of it's category?

So for example the next item button would lead me to the next item by date created in any category. I have deleted the more in this category text and I would like to be able to navigate amongst the latest blog post with these buttons. How could I implement this?
Last edit: 8 years 8 months ago by jozsefke.

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

More
8 years 8 months ago #146351 by grondo
its very interesting

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

  • Mohamed Abdelaziz
  • Mohamed Abdelaziz's Avatar
  • Offline
  • Platinum Member
  • Joomla Developer
More
8 years 8 months ago #146364 by Mohamed Abdelaziz
Replied by Mohamed Abdelaziz on topic Next and previous item buttons regardless of category
Which view or module do you want to implement this feature?

Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store

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

  • jozsefke
  • jozsefke's Avatar Topic Author
  • Offline
  • Junior Member
More
8 years 8 months ago - 8 years 8 months ago #146414 by jozsefke
On the bottom of the itemView where there is the part already saying "More in this category: « Previous item title - Next item title »". I would like to make these two links refer to the next and previous items by date created, no matter in which category it is.
Last edit: 8 years 8 months ago by jozsefke.

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

  • jozsefke
  • jozsefke's Avatar Topic Author
  • Offline
  • Junior Member
More
8 years 8 months ago - 8 years 8 months ago #146546 by jozsefke
I have figured out that I might have to modify the components/com_k2/models/item.php file somewhere between lines 1705 and 1794 where there are the functions for getting the previous and next items. I have tried to remove AND catid={$catid} from the $query parts but it didn't seem to work. Could anyone please point me in the right direction?
Last edit: 8 years 8 months ago by jozsefke.

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

  • Mohamed Abdelaziz
  • Mohamed Abdelaziz's Avatar
  • Offline
  • Platinum Member
  • Joomla Developer
More
8 years 8 months ago #146587 by Mohamed Abdelaziz
Replied by Mohamed Abdelaziz on topic Next and previous item buttons regardless of category
After removing AND catid={$catid}, did you get an error? or it works but not as you expect?

Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store

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

  • jozsefke
  • jozsefke's Avatar Topic Author
  • Offline
  • Junior Member
More
8 years 8 months ago #146609 by jozsefke
I didn't get any error, it just didn't work the way I expected. I also tried to set ORDER BY id or ORDER BY created, since it is ORDER BY ordering by default which means that it is ordered the way they can be set with drag and drop in the admin area. However, none of this worked well. I got to be able to jump to items in different categories though, but sometimes, it jumped from an item with id 8 to an item with id 5, while it should have been jumped to 7, by clicking on the previous item button.

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

  • Mohamed Abdelaziz
  • Mohamed Abdelaziz's Avatar
  • Offline
  • Platinum Member
  • Joomla Developer
More
8 years 8 months ago #146628 by Mohamed Abdelaziz
Replied by Mohamed Abdelaziz on topic Next and previous item buttons regardless of category
Some K2 plugins override the core files, models and views.
In case you have installed any of them, you should apply the modifications to the plugin files.

Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store

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

  • jozsefke
  • jozsefke's Avatar Topic Author
  • Offline
  • Junior Member
More
8 years 8 months ago - 8 years 8 months ago #146632 by jozsefke
Thank you for your support, Mohamed! I have a template that overrides some view files, but it doesn't override this particular models file, since after modifying it, I experienced differences, it just still doesn't work the way I thought it would. I don't use any K2 plugins either.

Edit: I have finally figured out the right way. In addition to the modifications I mentioned above, I also had to remove the parts ordering < {$ordering}. Now it works just as I expected.
Last edit: 8 years 8 months ago by jozsefke.

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


Powered by Kunena Forum