- Posts: 79
- Thank you received: 2
Custom field display in category listing
6 years 7 months ago #315561
by rkuiper
Custom field display in category listing was created by rkuiper
-- 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
-- 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.
6 years 7 months ago #315576
by rkuiper
Replied by rkuiper on topic Custom field display in category listing
Solved!
Please Log in or Create an account to join the conversation.
6 years 7 months ago #315562
by nicolas
Replied by nicolas on topic Custom field display in category listing
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.
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.
6 years 7 months ago #315945
by rkuiper
Replied by rkuiper on topic Custom field display in category listing
Hi Nicolas,
Thank you for the explanation. I did it pretty fast and overlooked some things.
Thanks again
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.209 seconds