Keyword

K2 Category Item Feature Request

  • Red Evolution
  • Red Evolution's Avatar Topic Author
  • Offline
  • Premium Member
More
4 years 5 months ago #175967 by Red Evolution
K2 Category Item Feature Request was created by Red Evolution
Hi Fotis,

Came across something today and on the face of it, it seems like it should be an easy enough addition but you'll obviously know much better than me. Client site has just over 500 menu items, many of the 'Category Listing' ones. Most of those menu items just pull from one category but there are quite a few that pull from multiple categories. For the styling layouts of these pages, we have a 'Master Category', which all of the categories on the site inherit their styling from, so they all have the exact same layout. This means when we create the menus, the single category ones use the settings from the category but the multiple category ones don't (even though the parameters are all inherited from the same master category). So the feature request is, in the section for 'Layout options for multiple category selection', would it be possible to have a dropdown at the top saying 'Inherit layout options from category' and then have a selection box where we can pick the category we want the options to be inherited from?

Thanks,
Dave

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

More
4 years 5 months ago - 4 years 5 months ago #175979 by JoomlaWorks
Replied by JoomlaWorks on topic K2 Category Item Feature Request
There's a reason this was never implemented.

And you probably don't see it because your current categories all have the same layout.

At the moment, when you combine different categories, the only thing that is essentially overwritten is the grid. Beyond that however, you must expect that when you click a given item, that item inherits its category's display settings. So if it's a regular article, the image is e.g. right after the title. If it's a video, the image is replaced by the video player right after the title (either by using different overrides or different content settings - e.g. the content and image could be completely hidden in that case).

If these 2 different entities inherited from a single custom-chosen category, you'd eventually view them with the same layout. And what happens if there's another K2 menu item pointing to a different set of categories, some of which are common to the first menu item? Can you see where this goes?

With the current setup (and contrary to Joomla articles' layout inheritance based on the menu item ID), the resulting URL and layout will ALWAYS be common.

Even so, K2 gives you the tools to perform a possibly different layout as you ask. You'd just have to create a different set of overrides. And then make a new K2 menu pointing to the categories you want and just assign that override set to them.

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Last edit: 4 years 5 months ago by JoomlaWorks.

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

  • Red Evolution
  • Red Evolution's Avatar Topic Author
  • Offline
  • Premium Member
More
4 years 5 months ago #175987 by Red Evolution
Replied by Red Evolution on topic K2 Category Item Feature Request
Creating overrides for the menu items would work for a lot of issues but we use the default layout for everything so that bit isn't the issue. The issue we have is setting the number of articles to appear. It defaults to 2 leading, 4 primary, 4 secondary and 4 links. The layout we use though is 16 leading and 0 for the others, which means it has to be manually changed for every menu link. This in turn means that if down the line we wanted to have 20 leading articles showing, we would have to change the main layout category then go through all the menu items finding the ones with the multi category options.

What would even work in this instance is if there was global settings for the number of articles that shows, a bit like the global settings for the image sizes. The article number settings in each menu items could then be set to 'Inherit from global' but also have a unique number added if required.

Hope that makes sense.
Dave

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

More
4 years 5 months ago #175991 by JoomlaWorks
Replied by JoomlaWorks on topic K2 Category Item Feature Request
Yes, global settings is a better option and is something that will come with v4. Exactly as you have common settings now for the generic views, you'll also be able to configure default settings for categories and expanded details for tags, users etc. The point is to normalize the output so that category, tag etc. all share the same HTML and display options.

We'll get there :)

As for the specific example you mention, sure it makes sense, but how often would you change your grid settings? Since you have 500 menus, the simplest way to change the grid now is to run an SQL query to replace the old grid with the new one, en masse.

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

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

  • Red Evolution
  • Red Evolution's Avatar Topic Author
  • Offline
  • Premium Member
More
4 years 5 months ago #175993 by Red Evolution
Replied by Red Evolution on topic K2 Category Item Feature Request
You're correct that it probably isn't something that would happen very often but may come as part of a redesign or slight layout change as we try to make improvements to the site. So potentially it could be something that happened every 3 or 4 years, which I know isn't a lot but it means the client is reliant on us making those changes.

The reason this has come to light is the client has been setting up menu items themselves and didn't realise about these settings to change, so we're not sure exactly how many exactly would need to be updated, so a quick method of updating would be handy in circumstances like this.

Any idea when v4 could be headed our way? Weeks? Months? Next year?

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

More
4 years 5 months ago #175997 by JoomlaWorks
Replied by JoomlaWorks on topic K2 Category Item Feature Request
Surely after the summer for v4 as it will be J4 compatible as well. v3 is skipped... :)

What you could do in the meantime is create a simple K2 plugin that hooks on the "onK2BeforeSetQuery" event and modifies the query's limit to the new value you want & additionally resets the leading/primary/secondary/links group limits.

The plugin would require a menu selector (so you can choose where to apply this filter) and new grid settings in the form of leading count & columns, primary count & columns etc. These would be your XML fields for the plugin.

Adding the values from the new grid gets you the new query limit which you can enforce using the "onK2BeforeSetQuery" event. That event modifies the actual query (see github.com/getk2/k2/blob/master/components/com_k2/models/itemlist.php#L335). Use JRequest::setVar('limit', $limit); there to reset the query limit. It should work.

Finally use the "onK2BeforeViewDisplay" event to reset the leading/primary/secondary/links group limits.

Use the example K2 plugin as a basis for that (github.com/getk2/k2-example-plugin). It'll just be the XML file options (standard fields) plus the main plugin file hooking up code to the 2 events I previously mentioned.

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