Keyword

Display items of parent category in item page.

  • Michael Yaeger
  • Michael Yaeger's Avatar Topic Author
  • Offline
  • Premium Member
More
9 years 1 month ago #140596 by Michael Yaeger
Display items of parent category in item page. was created by Michael Yaeger
I have created a custom template for the item view. At the bottom of this template, I want to show all other items within the item's category. I know I can get the item titles/links just prior and after this item by using nextTitle and previousTitle. However, this only gives me two items in the parent category and I want ALL.

This should be very similar to the "Related items by tag" feature except I want to list "Related items by category". I've tried to borrow the category code using "$this->item->category->secondary" and similar, but the data is not accessible this way.

Quick help is appreciated!

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 1 month ago #140638 by Krikor Boghossian
Replied by Krikor Boghossian on topic Display items of parent category in item page.
There are two settings you need to possibly change.
Make sure that the "Show items from children categories" is set to yes (menu item) and also make sure that you have not enabled the "Catalog Mode" in the category's settings.

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

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

  • Michael Yaeger
  • Michael Yaeger's Avatar Topic Author
  • Offline
  • Premium Member
More
9 years 1 month ago #140674 by Michael Yaeger
Replied by Michael Yaeger on topic Display items of parent category in item page.
I've checked and both of those:
Menu item - Fetch items from children categories = yes
Category - Catalog mode = no

What would be the code to pull the other sibling items onto the item page?

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 1 month ago #140693 by Krikor Boghossian
Replied by Krikor Boghossian on topic Display items of parent category in item page.
No code is required to display items from children categories.
Which extensions are you using?
Also are these children to your menu item or to your K2 category?
Finally make sure that the parent category does not inherit its setting from another category.

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

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

  • Michael Yaeger
  • Michael Yaeger's Avatar Topic Author
  • Offline
  • Premium Member
More
9 years 1 month ago - 9 years 1 month ago #140760 by Michael Yaeger
Replied by Michael Yaeger on topic Display items of parent category in item page.
No extensions. All are in K2 categories.

I have items in categories like this:
cat1
/ \
cat2 cat3
/ | \ / | \
itm1 itm2 itm3 itm4 itm5 itm6

I want the page (item.php) for itm1 to show the title, image and extras for itm1, itm2, itm3 for comparison. I want the page (item.php) for itm4 to show the title, image and extras for itm4, itm5, itm6 for comparison.
Last edit: 9 years 1 month ago by Michael Yaeger.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 1 month ago #140769 by Krikor Boghossian
Replied by Krikor Boghossian on topic Display items of parent category in item page.
Sorry I mislead you in my previous answers.
This can only be done via K2 Content modules.
Publish a K2 Content module and you can manually select the items you want to appear on that module.

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

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

  • Michael Yaeger
  • Michael Yaeger's Avatar Topic Author
  • Offline
  • Premium Member
More
8 years 10 months ago #144444 by Michael Yaeger
Replied by Michael Yaeger on topic Display items of parent category in item page.
I need to do the same thing for about 100 categories, so it isn't plausible to build that many modules manually. Plus, this method is no longer dynamic, so I can never add more items to the categories without manually updating the modules, too.

Also, how can I call a module in a K2 template?

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 10 months ago #144467 by Krikor Boghossian
Replied by Krikor Boghossian on topic Display items of parent category in item page.
<?php foreach (JModuleHelper::getModules('MODULE_NAME') as $module) {                                
echo JModuleHelper::renderModule($module, array('style' => 'MODULE_STYLE'));            
}?>

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