Custom field display in category listing

  • Posts: 65
  • Thank you received: 1
  • Hikashop Business
1 week 1 day 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: 65
  • Thank you received: 1
  • Hikashop Business
1 week 1 day ago #315576

Solved!

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

  • Posts: 68132
  • Thank you received: 10158
  • MODERATOR
1 week 13 hours 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.

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

Time to create page: 0.052 seconds
Powered by Kunena Forum