src/ShopBundle/objects/db/TShopCategoryList.class.php
public static function getParentCategoryList($categoryId)
    {
        $categoryList = new TIterator();
        $aTmpList = array(); // we store the list in a tmp array so we can reverse the order
        $currentCategoryId = $categoryId;
        $bDone = false;
        $requestInfoService = self::getRequestInfoService();
        $languageService = self::getLanguageService();
        if ($requestInfoService->isBackendMode()) {
            $languageId = $languageService->getActiveEditLanguage()->id;
        } else {
            $languageId = $languageService->getActiveLanguageId();
        }
        do {
            $category = TdbShopCategory::GetNewInstance();
            $category->SetLanguage($languageId);
            if (!$category->Load($currentCategoryId)) {
                $category = null;
                $bDone = true;
            } else {
                $category = $category->GetParent();
                if (!is_null($category)) {
                    $aTmpList[] = $category;
                    $currentCategoryId = $category->id;
                } else {
                    $bDone = true;
                }
            }
        } while (!$bDone);

        $aTmpList = array_reverse($aTmpList);
        foreach ($aTmpList as $tempCategory) {
            $categoryList->AddItem($tempCategory);
        }

        return $categoryList;
    }
public static function getParentCategoryList($categoryId)
    {
        $categoryList = new TIterator();
        $aTmpList = array(); // we store the list in a tmp array so we can reverse the order
        $currentCategoryId = $categoryId;
        $bDone = false;
        $requestInfoService = self::getRequestInfoService();
        $languageService = self::getLanguageService();
        if ($requestInfoService->isBackendMode()) {
            $languageId = $languageService->getActiveEditLanguage()->id;
        } else {
            $languageId = $languageService->getActiveLanguageId();
        }
        do {
            $category = TdbShopCategory::GetNewInstance();
            $category->SetLanguage($languageId);
            if (!$category->Load($currentCategoryId)) {
                $category = null;
                $bDone = true;
            } else {
                $category = $category->GetParent();
                if (!is_null($category)) {
                    $aTmpList[] = $category;
                    $currentCategoryId = $category->id;
                } else {
                    $bDone = true;
                }
            }
        } while (!$bDone);

        $aTmpList = array_reverse($aTmpList);
        foreach ($aTmpList as $tempCategory) {
            $categoryList->AddItem($tempCategory);
        }

        return $categoryList;
    }
public static function getParentCategoryList ( $ categoryId ) { $ categoryList = new TIterator ( ) ; $ aTmpList = array ( ) ; // we store the list in a tmp array so we can reverse the order $ currentCategoryId = $ categoryId ; $ bDone = false ; $ requestInfoService = self :: getRequestInfoService ( ) ; $ languageService = self :: getLanguageService ( ) ; if ( $ requestInfoService -> isBackendMode ( ) ) { $ languageId = $ languageService -> getActiveEditLanguage ( ) -> id ; } else { $ languageId = $ languageService -> getActiveLanguageId ( ) ; } do { $ category = TdbShopCategory :: GetNewInstance ( ) ; $ category -> SetLanguage ( $ languageId ) ; if ( ! $ category -> Load ( $ currentCategoryId ) ) { $ category = null ; $ bDone = true ; } else { $ category = $ category -> GetParent ( ) ; if ( ! is_null ( $ category ) ) { $ aTmpList [ ] = $ category ; $ currentCategoryId = $ category -> id ; } else { $ bDone = true ; } } } while ( ! $ bDone ) ; $ aTmpList = array_reverse ( $ aTmpList ) ; foreach ( $ aTmpList as $ tempCategory ) { $ categoryList -> AddItem ( $ tempCategory ) ; } return $ categoryList ; }
return all parent categories from the tree.

@param string $categoryId

@return TIterator
return all parent categories from the tree .