Keyword

Message if the category is empty

  • Matteo Luca Petitti
  • Matteo Luca Petitti's Avatar Topic Author
  • Offline
  • New Member
More
11 years 8 months ago - 11 years 8 months ago #111214 by Matteo Luca Petitti
Message if the category is empty was created by Matteo Luca Petitti
Hello, I need to show a message as "no items in this category" when there aren't articles in a category.
I remember that this function is avaiable on the "category management", but i don' t find this option in the K2 component.

Joomla ver 2.5.9 - K2 ver 2.6.5

Thanks for your help!! :woohoo:

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

More
6 years 8 months ago #167047 by MarcioD
Replied by MarcioD on topic Message if the category is empty
Have you found the answer to your question? I also need to post information when the category is empty.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
6 years 8 months ago #167059 by Krikor Boghossian
Replied by Krikor Boghossian on topic Message if the category is empty
Hello,

You will need to edit your template (or overrides a bit) getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates

This is the if statement that checks if items exist -> github.com/getk2/k2/blob/master/components/com_k2/templates/default/category.php#L132

You can add an else at the bottom and add your custom code inside.

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

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

More
6 years 8 months ago #167073 by MarcioD
Replied by MarcioD on topic Message if the category is empty
Thank you very much for your answer. Works perfectly!
It works if I have a category display in the menu like this: K2 »Item listings» Categories
How to do it for displaying categories this way: K2 »Latest products from (one or more) users or categories
The changes should probably be made in this file "latest.php" only how?

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
6 years 8 months ago #167089 by Krikor Boghossian
Replied by Krikor Boghossian on topic Message if the category is empty
Exactly, this is the file you should edit.

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