Keyword

[SOLVED] How to load items SUBcategory ID?

  • Promotions Media Kft.
  • Promotions Media Kft.'s Avatar Topic Author
  • Offline
  • New Member
More
10 years 11 months ago - 10 years 11 months ago #119848 by Promotions Media Kft.
[SOLVED] How to load items SUBcategory ID? was created by Promotions Media Kft.
Hi all!

I would like to ask for a small code snippet, that I was not able to find anywhere.

Loading an item's main category name is OK, with using this snippet:
<?php
$parent = JTable::getInstance('K2Category', 'Table');
$parent->load($item->category->parent);
?>

But this not loads the subcategory name/id.

Maybe someone knows how it's possible to load the item's subcategory ID or at least the name when listing the items in category.php

Thanks for your help in advance!

Best Regards,
PePe

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
10 years 11 months ago #119849 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: How to load items SUBcategory ID?
Hello Pepe,

Each item has one category so that category will display. If you are using a 3rd party extension which supports multi categorisation then they must have some snippets.

If you just want to list the subcategories inside the category there is a setting for this in the category settings.

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

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

  • Promotions Media Kft.
  • Promotions Media Kft.'s Avatar Topic Author
  • Offline
  • New Member
More
10 years 11 months ago #119850 by Promotions Media Kft.
Replied by Promotions Media Kft. on topic Re: How to load items SUBcategory ID?

Krikor Boghossian wrote: Hello Pepe,

Each item has one category so that category will display. If you are using a 3rd party extension which supports multi categorisation then they must have some snippets.

If you just want to list the subcategories inside the category there is a setting for this in the category settings.


Hello Krikor,

Meanwhile I solved my problem. I was working on to implement a filtering option (mixitup.io) in a category list page, in such a category, which has a few subcategories. That was the reason I wanted to add an identifier filter class for the items opening block.

Morning I had the idea to not just add the main category to the menuitem, but also choose the subcategories as well, then I changed the default template's category.php to the modified one in my template's html folder.

Now it's working perfectly.

Thanks for the help anyway!

Greets,
PePe

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


Powered by Kunena Forum