Keyword

How can I print output of an item's category?

More
11 years 5 months ago #112331 by Lee
Hello all,

I'm currently using K2Store, and on the table list of the products summary, I want to have a column that shows the item's category.

So after a few reluctant searches of how to call the category into this view, I found the following:
<?php 
                                                        $parent = JTable::getInstance('K2Category', 'Table');
                                                        $parent->load($item->category->parent);
                                                        echo $parent->name; 
                                                ?>

However this gives an undefined property error of category.

How can I call in an items category to anyview when using K2? I thought this being the K2Store, that it would automatically be able to read and call any K2 data anyway, obviously not!

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
11 years 5 months ago #112332 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: How can I print output of an item's category?
Hello Lee,

I am not a K2Store user but you can check your default K2 templates to see how the item's category is being outputted.

eg. in item.php the code is
					
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