Custom field display in category listing

  • Posts: 79
  • Thank you received: 2
4 years 2 months ago #315561

-- HikaShop version -- : 4.2.2
-- Joomla version -- : 3.9.15
-- PHP version -- : 7.2

I created a custom field for the category call info.
Now i want to display this field in the category listing.
The file that i am editing is category / listing_image_description.php
I tried to use the code echo $this->element->info;
But that doesnt seem to be working.
Can you tell me why its not picking that up?

Thanks,
Rogier

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

  • Posts: 79
  • Thank you received: 2
4 years 2 months ago #315576

Solved!

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

  • Posts: 81504
  • Thank you received: 13063
  • MODERATOR
4 years 2 months ago #315562

Hi,

In $this->element you have the data of the main category of the listing.
If you want to use the data of each category on the listing, you should use $this->row instead.
And "info" needs to be the same as the column name of your custom field of the table "category".
Finally, There are many view files to display the block of a category in a categories listing.
You might not be editing the correct one.
So make sure that it's the correct one thanks to the "Display view files" setting of the HikaShop configuration.
And finally, supposing that it's the correct view file you're editing, make sure you're editing it for the correct frontend template and not another one or you won't see any change.

The following user(s) said Thank You: rkuiper

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

  • Posts: 79
  • Thank you received: 2
4 years 1 month ago #315945

Hi Nicolas,

Thank you for the explanation. I did it pretty fast and overlooked some things.
Thanks again

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

Time to create page: 0.056 seconds
Powered by Kunena Forum