You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Joomla category created - "Sample Category"
Custom fields group created for category - "Sample Group"
Custom fields type text created and assigned to "Sample Group" and to all categories - "Sample Custom Text Field"
Populated the Default value for the "Sample Custom Text Field" - "The default value of the sample custom text field"
Set the "Sample custom field" to be displayed AfterDisplay (It does not matter where. Is displayed just to check is correct. Using overrides it suppose to be hidden.
Edit the Sample Category by adding "The sample category custom text field" in the "Sample Custom Text Field"
Created overrides
/httpdocs/templates/protostar/html/com_content/category/blog.php
/httpdocs/templates/protostar/html/com_content/category/default.php
add
<?php
$category = JRequest::getInt('id');
echo 'cat id is: '. $category;
$currentCatFields = FieldsHelper::getFields('com_content.categories', $category, true);
echo '<pre>',print_r($currentCatFields,1),'</pre>';
?>
$currentCatFields->value is not existing at all. Strangely, some of the array is filled up, excepting the current values.
The rendering attempt have no results at all. See warning.
Warning: Invalid argument supplied for foreach() in /mnt/data/vhosts/casite-986486.cloudaccess.net/httpdocs/templates/protostar/html/com_content/category/blog.php on line 75
System information (as much as possible)
Joomla 3.9.1
PHP 7.0.32 (but it does not work on another versions as well.
Additional comments
How is suppose to access category's custom fields? The above trials where just a few from 2 days attempts of getting this work. There is no reference on internet excepting on how to get Article's custom fields on category list display. I need to access category's custom fields.
The text was updated successfully, but these errors were encountered:
The $category passed as the second param of getFields should not be the category id, but instead the category object itself. eg. in the blog.php override
Steps to reproduce the issue
Joomla category created - "Sample Category"
Custom fields group created for category - "Sample Group"
Custom fields type text created and assigned to "Sample Group" and to all categories - "Sample Custom Text Field"
Populated the Default value for the "Sample Custom Text Field" - "The default value of the sample custom text field"
Set the "Sample custom field" to be displayed AfterDisplay (It does not matter where. Is displayed just to check is correct. Using overrides it suppose to be hidden.
Edit the Sample Category by adding "The sample category custom text field" in the "Sample Custom Text Field"
Created overrides
/httpdocs/templates/protostar/html/com_content/category/blog.php
/httpdocs/templates/protostar/html/com_content/category/default.php
add
add
Expected result
The $currentCatFields->value is suppose to be "The sample category custom text field".
The jcfields suppose to be rendered.
see the result at:
http://unicserv.joomla.com/joomla/category-blog.html
http://unicserv.joomla.com/joomla/category-list.html
Actual result
$currentCatFields->value is not existing at all. Strangely, some of the array is filled up, excepting the current values.
The rendering attempt have no results at all. See warning.
Warning: Invalid argument supplied for foreach() in /mnt/data/vhosts/casite-986486.cloudaccess.net/httpdocs/templates/protostar/html/com_content/category/blog.php on line 75
System information (as much as possible)
Joomla 3.9.1
PHP 7.0.32 (but it does not work on another versions as well.
Additional comments
How is suppose to access category's custom fields? The above trials where just a few from 2 days attempts of getting this work. There is no reference on internet excepting on how to get Article's custom fields on category list display. I need to access category's custom fields.
The text was updated successfully, but these errors were encountered: