I've built a custom component in Joomla 3.6. The component itself is working fine, but I'm having trouble accessing user state variables from custom fields inside the component and from a separate module. When I try, I get nothing returned.
Here's my code from populatestate() in the model:
$app = JFactory::getApplication();
$filter_product_group_category = $app->getUserStateFromRequest('filter.product_group_category', 'filter[product_group_category]', '', 'string');
$this->setState('filter.product_group_category', $filter_product_group_category);
$filter_product_group_type = $app->getUserStateFromRequest('filter.product_group_type', 'filter[product_group_type]', '', 'string');
$this->setState('filter.product_group_type', $filter_product_group_type);
$filter_search = $app->getUserStateFromRequest('filter.search', 'filter[search]', '', 'string');
$this->setState('filter.search', $filter_search);
Here's the code I'm using from within the custom field and the module:
$mainframe =JFactory::getApplication();
$filter_product_group_category = $mainframe->getUserState("filter.product_group_category");
$filter_product_group_type = $mainframe->getUserState("filter.product_group_type");
$filter_search = $mainframe->getUserState("filter.search");
echo $filter_product_group_category;
echo $filter_product_group_type;
echo $filter_search;
I'm obviously doing something wrong, but I've exhausted my knowledge and spent hours of Google research without getting any closer. Any help appreciated!