Show custom field content in category table view

  • Markus Schwendtner
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
11 years 2 weeks ago #59955 by Markus Schwendtner
Show custom field content in category table view was created by Markus Schwendtner
Hi community,

I am looking for a way to display certain custom fields in the category table view. I have already changed the code in category/tmpl/table.php and common/lists.php to e.g. display the location_country field, but I am struggeling with displaying any of the fields defined in fields.xml

The entry in fields.xml reads for example
<field name="field_Points" type="text" label="Points" size="50" description=""></field>

Can you point me in the right direction please ?

All the best,
Markus

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

More
11 years 2 weeks ago #59968 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Show custom field content in category table view
Hi Markus

You will need to edit the code in the file components/com_eventbooking/views/common/events_table.php to add the columns (fields) you want.

To display the value of the field above, in the for loop, you can use the code <?php echo $item->paramData; ?>

(If you know programming, you should understand what I say above, other well, tell your developer about my suggestion so that he can do it for you)

Tuan

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

  • Markus Schwendtner
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
11 years 2 weeks ago #59984 by Markus Schwendtner
Replied by Markus Schwendtner on topic Show custom field content in category table view
Hi Tuan,

I have tried that, but without success. If I add that line (I found it in another post) I just get a blank field, but no content.

Do I have to pre-load the custom fields somewhere ? I saw that in models/events the customs fields are explicitely loaded, but it doesnt seem to be the case for categories. I can only grab the core fields there.

Attached is my events_table.php

Cheers,
Markus

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

More
11 years 2 weeks ago #59992 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Show custom field content in category table view
I looked at the file you sent but I don't see you added any code ?

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

  • Markus Schwendtner
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
11 years 1 week ago #60024 by Markus Schwendtner
Replied by Markus Schwendtner on topic Show custom field content in category table view
Hi Tuan,

I had tried to add <?php echo $item->paramData; ?> in one of the table fields but didnt get any output. Given the fieldname "field_Points", is this really the only code to add ? I mean, if I only specify paramData, how does it know which of the 10 extra fields I want to display ? Or do I have to add anything more ?

Cheers,
Markus

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

More
11 years 1 week ago #60034 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Show custom field content in category table view
Hmm

Seems the code is stripped when I wrote it. With the custom field field_Points, you can use the following code:
Code:
<?php echo $item->paramData['field_Points']['value']; ?>

Tuan

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

  • Markus Schwendtner
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
11 years 1 week ago #60049 by Markus Schwendtner
Replied by Markus Schwendtner on topic Show custom field content in category table view
Perfect, works like a charm !

Thanks so much - awesome !

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

More
11 years 1 week ago #60062 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Show custom field content in category table view
Great. Thanks for confirming

Tuan

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

More
10 years 4 months ago #72568 by Enrico
Hi Tuan,

I tried the same modify but doesn't work.
I attach my file.

File Attachment:

File Name: events_table.zip
File Size:2.33 KB


Regards.

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

More
10 years 4 months ago #72587 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Show custom field content in category table view
Hi Enrico

What version of the extension you are using ? I am afraid of you are using a quite old version and the same modification won't work

You should use latest version of Events Booking (2.1.0) for now if you want to use this modification

Tuan

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

Moderators: Tuan Pham Ngoc