Back to PhocacartRoute class

Method getQuestionRoute

public static
getQuestionRoute
(mixed $id = 0, mixed $catid = 0, mixed $idAlias = '', mixed $catidAlias = '', mixed $suffix = '')

Method getQuestionRoute - Source code

public static function getQuestionRoute($id = 0, $catid = 0, $idAlias = '', $catidAlias = '', $suffix = '')
{
    $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' && $view == 'question') {
        $needles = array('question' => '', 'item' => (int) $id, 'category' => (int) $catid, 'categories' => (int) $activeId, 'items' => (int) $catid);
    } else {
        $needles = array('question' => '', 'item' => (int) $id, 'category' => (int) $catid, 'categories' => '', 'items' => '');
    }
    if ($idAlias != '') {
        $id = (int) $id . ':' . $idAlias;
    }
    if ($catidAlias != '') {
        $catid = (int) $catid . ':' . $catidAlias;
    }
    $link = 'index.php?option=com_phocacart&view=question';
    if ($catid != 0) {
        $link .= '&catid=' . $catid;
    }
    if ($id != 0) {
        $link .= '&productid=' . $id;
    }
    if ($id != 0) {
        $link .= '&id=' . $id;
    }
    if ($suffix != '') {
        $link .= '&' . $suffix;
    }
    return self::_buildLink($link, $needles);
}