public static
getItemsRoute
(mixed $catid = '', mixed $catidAlias = '', mixed $parameter = '', mixed $value = '')
/* Items route can be without id or with id, if id, then it is a category id
*/
public static function getItemsRoute($catid = '', $catidAlias = '', $parameter = '', $value = '')
{
$app = Factory::getApplication();
$menu = $app->getMenu();
$active = $menu->getActive();
$option = $app->input->get('option', '', 'string');
$view = $app->input->get('view', '', 'string');
$activeId = 0;
if (isset($active->id)) {
$activeId = $active->id;
}
if ((int) $activeId > 0 && $option == 'com_phocacart') {
if (isset($catid) && (int) $catid > 0) {
$needles = array('items' => (int) $catid, 'category' => (int) $catid, 'categories' => (int) $activeId);
} else {
$needles = array('items' => '', 'category' => '', 'categories' => '');
}
} else {
if (isset($catid) && (int) $catid > 0) {
$needles = array('items' => (int) $catid, 'category' => (int) $catid, 'categories' => '');
} else {
$needles = array('items' => '', 'category' => '', 'categories' => '');
}
}
if ($catidAlias != '') {
$catid = $catid . ':' . $catidAlias;
}
if ($catid != '') {
$link = 'index.php?option=com_phocacart&view=items&id=' . $catid;
} else {
if ($parameter != '' && $value != '') {
$link = 'index.php?option=com_phocacart&view=items&' . htmlspecialchars($parameter) . '=' . htmlspecialchars($value);
} else {
$link = 'index.php?option=com_phocacart&view=items';
}
}
return self::_buildLink($link, $needles);
}