Keyword

Subcategory Ordering

  • Tomasz Bieliński
  • Tomasz Bieliński's Avatar
  • Offline
  • Senior Member
More
14 years 6 months ago #72950 by Tomasz Bieliński
Replied by Tomasz Bieliński on topic Subcategory Ordering
- I have link in the menu to items from multiple categories (more then one category) - I cant see "the category description field" in the front (image of the category)
- when I link through the page (image of root category) to the same items from the same muliply category - I can see the category image
- this is only for multiple categories, for one category is OK

Is this normal? I checked it with one category and one or more sub-categories.

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

More
14 years 6 months ago #72951 by Lars
Replied by Lars on topic Subcategory Ordering
I had the same problem and have a workaround for it:

My intention is to display a list of news 'most recent first', which can be accessed through a menu entry. The articles are all in the category 'News'.

Article ordering can be set (and it works on my system) when setting on the menu entry of type K2 - Item listings - Categories.
Only problem I have, is, that at least two categories have to be chosen to be able to change the ordering drop down box.

To solve this, I created a second category 'News2' which contains no articles. In the menu entry I choose both categories. Therefore the ordering drop down gets accessible and I can choose 'Most recent first'.

The second (empty) category has no side effect for my configuration and everything runs fine.

Lars

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

  • gianpiero sfameni
  • gianpiero sfameni's Avatar Topic Author
  • Offline
  • New Member
More
14 years 6 months ago #72952 by gianpiero sfameni
Replied by gianpiero sfameni on topic Subcategory Ordering
Trying to clarify.

This is my scenario:

1) Create New K2 Category
Title= Category1
Parent category= Top
Inherit parameter options from category= None
Extra Fields= None
Other layout options
Catalog mode= No
Featured Items= Show
Item ordering = Most Recent First


2) Create New K2 Item
Title= item1
Category=Category1
Creation date=2009-09-30 08:38:36

3) Create New K2 Item
Title= item2
Category=Category1
Creation date=2009-09-30 08:40:46

4) Create New K2 Item
Title= item3
Category=Category1
Creation date=2009-09-30 08:45:06

5) Create New Menu Item
Menu item type= K2 -> Item Listing -> Categories
Title= category1
Select categories= Category1

6) Debug Mode ON

This is my query:
SELECT i.*, c.name AS categoryname,c.id AS categoryid, c.alias AS categoryalias, c.params AS categoryparams
FROM jos_k2_items AS i
LEFT JOIN jos_k2_categories AS c
ON c.id = i.catid
WHERE i.published = 1
AND i.access <= 0
AND i.trash = 0
AND c.published = 1
AND c.access <= 0
AND c.trash = 0
AND ( i.publish_up = '0000-00-00 00:00:00' OR i.publish_up <= '2009-09-30 08:49:01' )
AND ( i.publish_down = '0000-00-00 00:00:00' OR i.publish_down >= '2009-09-30 08:49:01' )
AND c.id IN (25)
GROUP BY i.id
ORDER BY i.created DESC
LIMIT 0, 14

This is the result:
id title alias catid published introtext fulltext video gallery extra_fields extra_fields_search created
110 item1 item1 25 1 NULL NULL [] 2009-09-30 08:38:36
111 item2 item2 25 1 NULL NULL [] 2009-09-30 08:40:46
112 item3 item3 25 1 NULL NULL [] 2009-09-30 08:45:06


Most Recent item in this list is item3 and it is in last position!

Workaround found for this issue:
1) Add a subcategory to category1
2) Select 2 categories from the options "Select categorie" in the Menu
In this 2 cases the query change from "AND c.id IN (25) to "AND c.id IN (24,25)" and everything work fine!
3)Removing Group By, LINE 183 in \components\com_k2\models\itemlist.php (//$query .= " GROUP BY i.id";)

Last solution work fine but i don't know the impact of this change in other functionality of K2.

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

  • Tomasz Bieliński
  • Tomasz Bieliński's Avatar
  • Offline
  • Senior Member
More
14 years 6 months ago #72953 by Tomasz Bieliński
Replied by Tomasz Bieliński on topic Subcategory Ordering
Lars said:I had the same problem and have a workaround for it:
My intention is to display a list of news 'most recent first', which can be accessed through a menu entry. The articles are all in the category 'News'.

Article ordering can be set (and it works on my system) when setting on the menu entry of type K2 - Item listings - Categories.
Only problem I have, is, that at least two categories have to be chosen to be able to change the ordering drop down box.

To solve this, I created a second category 'News2' which contains no articles. In the menu entry I choose both categories. Therefore the ordering drop down gets accessible and I can choose 'Most recent first'.

The second (empty) category has no side effect for my configuration and everything runs fine.

Lars


I have done like you. Do you have "category description" field visible in such configuration (with linking from the menu)? I cant activate it from menu link only from page...

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

More
14 years 6 months ago #72954 by Lars
Replied by Lars on topic Subcategory Ordering
I have the category description turned off.
I could imagine that it is not possible to turn it on in the menu in this constellation, because the system would not know, which categories' description to display.

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

More
14 years 6 months ago #72955 by Lars
Replied by Lars on topic Subcategory Ordering
@Gianpiero, I don't know what this query generator code is used for, else.
I would mainly check for scenarios, where the number of articles in a category is calculated and displayed.

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

  • Tomasz Bieliński
  • Tomasz Bieliński's Avatar
  • Offline
  • Senior Member
More
14 years 6 months ago #72956 by Tomasz Bieliński
Replied by Tomasz Bieliński on topic Subcategory Ordering
Lars said:I have the category description turned off. I could imagine that it is not possible to turn it on in the menu in this constellation, because the system would not know, which categories' description to display.

Don't worry about the system, it knows :-). To show you what I mean check the attached files. As you see in "menu_view.jpg" K2 don't display category description, but when the same category is called from page (not from menu) you see the description (page_viw.jpg).
By the way: I can set one category A and sub categories 1,2, description can be in category A and link from the menu to category A with subcategories - I think it is OK to the system :-)
Attachments:

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

More
14 years 6 months ago #72957 by Lefteris
Replied by Lefteris on topic Subcategory Ordering
Hi. So the ordering setting from the category edit page doesn't work for you. I 'm trying to reproduce the bug but no luck yet. Are you sure you are using the latest version of K2? Also try to turn off the cache and see what happens. By the way the query K2 produces seems to be correct.

Gianpiero said:Trying to clarify. This is my scenario:

1) Create New K2 Category
Title= Category1
Parent category= Top
Inherit parameter options from category= None
Extra Fields= None
Other layout options
Catalog mode= No
Featured Items= Show
Item ordering = Most Recent First


2) Create New K2 Item
Title= item1
Category=Category1
Creation date=2009-09-30 08:38:36

3) Create New K2 Item
Title= item2
Category=Category1
Creation date=2009-09-30 08:40:46

4) Create New K2 Item
Title= item3
Category=Category1
Creation date=2009-09-30 08:45:06

5) Create New Menu Item
Menu item type= K2 -> Item Listing -> Categories
Title= category1
Select categories= Category1

6) Debug Mode ON

This is my query:
SELECT i.*, c.name AS categoryname,c.id AS categoryid, c.alias AS categoryalias, c.params AS categoryparams
FROM jos_k2_items AS i
LEFT JOIN jos_k2_categories AS c
ON c.id = i.catid
WHERE i.published = 1
AND i.access <= 0
AND i.trash = 0
AND c.published = 1
AND c.access <= 0
AND c.trash = 0
AND ( i.publish_up = '0000-00-00 00:00:00' OR i.publish_up <= '2009-09-30 08:49:01' )
AND ( i.publish_down = '0000-00-00 00:00:00' OR i.publish_down >= '2009-09-30 08:49:01' )
AND c.id IN (25)
GROUP BY i.id
ORDER BY i.created DESC
LIMIT 0, 14

This is the result:
id title alias catid published introtext fulltext video gallery extra_fields extra_fields_search created
110 item1 item1 25 1 NULL NULL [] 2009-09-30 08:38:36
111 item2 item2 25 1 NULL NULL [] 2009-09-30 08:40:46
112 item3 item3 25 1 NULL NULL [] 2009-09-30 08:45:06


Most Recent item in this list is item3 and it is in last position!

Workaround found for this issue:
1) Add a subcategory to category1
2) Select 2 categories from the options "Select categorie" in the Menu
In this 2 cases the query change from "AND c.id IN (25) to "AND c.id IN (24,25)" and everything work fine!
3)Removing Group By, LINE 183 in \components\com_k2\models\itemlist.php (//$query .= " GROUP BY i.id";)

Last solution work fine but i don't know the impact of this change in other functionality of K2.

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

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

  • gianpiero sfameni
  • gianpiero sfameni's Avatar Topic Author
  • Offline
  • New Member
More
14 years 6 months ago #72958 by gianpiero sfameni
Replied by gianpiero sfameni on topic Subcategory Ordering
My be a MYSQL issue? character set.... collation?? Running the same query on phpmyadmin the result is the same..... it work only by putting 2 categories on the HAVING clause or by removing GROUP BY.
Thanks.

Lefteris Kavadas said:By the way the query K2 produces seems to be correct.

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

More
14 years 6 months ago #72959 by Lefteris
Replied by Lefteris on topic Subcategory Ordering
Hi. Can you please post some info about your MySQL ( version, collation etc ) ? Also if it is possible try to attach an sql export of these K2 tables.

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