Show sub-category in event detail

  • Enrico
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
11 years 3 months ago #53614 by Enrico
Show sub-category in event detail was created by Enrico
Hello,
I would like to enter the name of the sub-category under the title of the event in the event detail view.
I tried to edit the file com_eventbooking> views> event> tmpl> default.php inserting <? php echo $item-> category-> name; ?> But it does not work.
Have you any suggestions?
Thanks in advance to those who will want to help me.

Best regards.
Enrico

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

More
11 years 3 months ago #53672 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Show sub-category in event detail
Hi Enrico

What's the sub-category ? Could you please make a screenshot explain so that I can help you write some code to get that information ?

Regards,

Tuan

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

  • Enrico
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
11 years 3 months ago - 11 years 3 months ago #53753 by Enrico
Replied by Enrico on topic Show sub-category in event detail
I apologize to you for my English,
i want insert the event's category name, in event's detail view.
How can i do?
surely you can understand more from the image.
thanks
Last edit: 11 years 3 months ago by Enrico.

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

More
11 years 3 months ago #53815 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Show sub-category in event detail
Ah

So you want to display the category name of the event in that position ? In this case, you will need to modify code to display that data. Do you know programming so that I can point you to the file need to be modified ?

Tuan

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

  • Enrico
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
11 years 3 months ago #53848 by Enrico
Replied by Enrico on topic Show sub-category in event detail
I think the file to edit is:
/com_eventbooking/views/event/ tmpl/default.php
i tried same code but without resoult!
becouse I'm not a good programmer.

can you suggest me something?

thanks a lot

Enrico

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

More
11 years 3 months ago #53866 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Show sub-category in event detail
Hi Enrico

In your system, one even can be assigned to multiple categories or just one category ? Please let me know so that I can guide you

Tuan

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

  • Enrico
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
11 years 3 months ago #53897 by Enrico
Replied by Enrico on topic Show sub-category in event detail
in this system an event has only one category.

Enrico

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

More
11 years 3 months ago #53909 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Show sub-category in event detail
OK Enrico. You can try this code:

$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('a.name FROM #__eb_categories AS a')
->innerJoin('#__eb_event_categories AS b ON a.id = b.category_id')
->where('b.event_id = '. $this->item->id);
$db->setQuery($query);
$categoryName = $db->loadResult();

That will return the category name. I think you can do the rest ?

Tuan

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

Moderators: Tuan Pham Ngoc