Back to PhocacartRoute class

Method getJsItemsRoute

public static
getJsItemsRoute
(mixed $activeCategory = 0)

Method getJsItemsRoute - Source code

public static function getJsItemsRoute($activeCategory = 0)
{
    $a = PhocacartRoute::getIdForItemsRoute();
    // Three cases
    if ($activeCategory == 0) {
        // 1) We don't want to include category in filter, e.g. mod_phocacart_filter does not
        // allow to include category filtering (deselecting category)
        // so don't include category
        $urlItemsView = Route::_(PhocacartRoute::getItemsRoute());
    } else {
        // 2) We want to include category filter and user stays on page where category is active
        // Then he/she will be re-directed to items view but it will include category filtering
        //
        // 3) But if user stays on site where there is no active category, he gets ID = 0 (id of category)
        // so no filtering of category will be done - it is active but user didn't stay on category active page
        $urlItemsView = Route::_(PhocacartRoute::getItemsRoute($a['id'], $a['alias']));
    }
    $urlItemsView = str_replace('&', '&', $urlItemsView);
    // Cause URL problems
    //$urlItemsView	= str_replace(JUri::root(true), '', $urlItemsView);
    //$urlItemsView	= ltrim($urlItemsView, '/');
    return $urlItemsView;
}