Back to PhocacartRoute class

Method getItemRoute

public static
getItemRoute
(mixed $id, mixed $catid = 0, mixed $idAlias = '', mixed $catidAlias = '', mixed $lang = array(), mixed $forceView = 0)

Method getItemRoute - Source code

public static function getItemRoute($id, $catid = 0, $idAlias = '', $catidAlias = '', $lang = array(), $forceView = 0)
{
    $app = Factory::getApplication();
    $menu = $app->getMenu();
    $active = $menu->getActive();
    $option = $app->input->get('option', '', 'string');
    $view = $app->input->get('view', '', 'string');
    if ($forceView == 1) {
        $view = 'item';
        // We link the view from administration - to preview the product
    }
    /*$catidCurrent	= $app->input->get( 'id', 0, 'int' );
    
    		if ($catidCurrent > 0) {
    			$catid = $catidCurrent;
    		}*/
    $activeId = 0;
    if (isset($active->id)) {
        $activeId = $active->id;
    }
    if ((int) $activeId > 0 && $option == 'com_phocacart' && $view == 'item') {
        $needles = array('item' => (int) $id, 'category' => (int) $catid, 'categories' => (int) $activeId, 'items' => (int) $activeId);
    } else {
        $needles = array('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=item&id=' . $id . '&catid=' . $catid;
    return self::_buildLink($link, $needles, $lang);
    //return self::_buildLink($link, $needles). '#'.$idAlias;
}