public static function getActiveCategoryId()
{
$app = Factory::getApplication();
$option = $app->input->get('option', '', 'string');
$view = $app->input->get('view', '', 'string');
$catid = $app->input->get('catid', '', 'int');
// ID in items view is category id
$id = $app->input->get('id', '', 'int');
$c = $app->input->get('c', '', 'string');
// Category ID in items view - filter options (does not work with ajax)
if ($option == 'com_phocacart' && ($view == 'items' || $view == 'category')) {
if ((int) $id > 0) {
return $id;
}
}
if ($option == 'com_phocacart' && $view == 'item') {
if ((int) $catid > 0) {
return $catid;
}
}
// If in filtering only one category is selected, make active the selected category in e.g. tree (not working in ajax)
if ($option == 'com_phocacart' && $view == 'items') {
if ($c != '') {
$cA = explode(',', $c);
if (isset($cA[0]) && count($cA) == 1) {
return (int) $cA[0];
}
}
}
return 0;
}