static function getResortCategoryTree($Categories, $AllCategories, &$Query)
 {
     foreach ($Categories as $Category) {
         $SubCategories = _getCategoryParent($AllCategories, $Category->category_id);
         foreach ($SubCategories as $SubCategory) {
             $Query[] = $SubCategory->category_id;
         }
         if (count($SubCategories)) {
             plgJshoppingProductsTo_Parent_Category::getResortCategoryTree($SubCategories, $AllCategories, $Query);
         }
     }
 }
Beispiel #2
0
/**
* get Tree category
* @param int $publish
* @return array
*/
function getTreeCategory($publish = 1, $access = 1)
{
    $jshopConfig = JSFactory::getConfig();
    $db = JFactory::getDBO();
    $user = JFactory::getUser();
    $lang = JSFactory::getLang();
    $where = array();
    if ($publish) {
        $where[] = "category_publish = '1'";
    }
    if ($access) {
        $groups = implode(',', $user->getAuthorisedViewLevels());
        $where[] = ' access IN (' . $groups . ')';
    }
    $add_where = "";
    if (count($where)) {
        $add_where = " where " . implode(" and ", $where);
    }
    $query = "SELECT `" . $lang->get('name') . "` as name, category_id, category_parent_id FROM `#__jshopping_categories` " . $add_where . " ORDER BY category_parent_id, ordering";
    $db->setQuery($query);
    $allcats = $db->loadObjectList();
    $cats = _getCategoryParent($allcats, 0);
    _getResortCategoryTree($cats, $allcats);
    return $cats;
}
Beispiel #3
0
function getTreeCategory($publish = 1, $access = 1)
{
    $allcats = JSFactory::getTable('category', 'jshop')->getAllCategories($publish, $access, 'name');
    $cats = _getCategoryParent($allcats, 0);
    _getResortCategoryTree($cats, $allcats);
    return $cats;
}