src/ShopBundle/objects/db/TShopCategoryList.class.php
public static function &GetCategoryPath($iEndNodeId, $iStartNodeId = null, $sLanguageID = null)
    {
        if (null === $sLanguageID) {
            $sLanguageID = self::getLanguageService()->getActiveLanguageId();
        }

        $bDone = false;
        $iCurrentCatId = $iEndNodeId;
        $aTmpList = array(); // we store the list in a tmp array so we can reverse the order
        do {
            $oCategory = TdbShopCategory::GetNewInstance();
            $oCategory->SetLanguage($sLanguageID);
            if (!$oCategory->Load($iCurrentCatId)) {
                $oCategory = null;
                $bDone = true;
            } else {
                $aTmpList[] = $oCategory;
                if (null !== $iStartNodeId && $iStartNodeId == $iCurrentCatId) {
                    $bDone = true;
                } else {
                    $oCategory = $oCategory->GetParent();
                    if (null === $oCategory) {
                        $bDone = true;
                    } else {
                        $iCurrentCatId = $oCategory->id;
                    }
                }
            }
        } while (!$bDone);

        $aTmpList = array_reverse($aTmpList);
        $oCategoryPath = new TIterator();
        foreach (array_keys($aTmpList) as $iTmpIndex) {
            $oCategoryPath->AddItem($aTmpList[$iTmpIndex]);
        }

        return $oCategoryPath;
    }
public static function &GetCategoryPath($iEndNodeId, $iStartNodeId = null, $sLanguageID = null)
    {
        if (null === $sLanguageID) {
            $sLanguageID = self::getLanguageService()->getActiveLanguageId();
        }

        $bDone = false;
        $iCurrentCatId = $iEndNodeId;
        $aTmpList = array(); // we store the list in a tmp array so we can reverse the order
        do {
            $oCategory = TdbShopCategory::GetNewInstance();
            $oCategory->SetLanguage($sLanguageID);
            if (!$oCategory->Load($iCurrentCatId)) {
                $oCategory = null;
                $bDone = true;
            } else {
                $aTmpList[] = $oCategory;
                if (null !== $iStartNodeId && $iStartNodeId == $iCurrentCatId) {
                    $bDone = true;
                } else {
                    $oCategory = $oCategory->GetParent();
                    if (null === $oCategory) {
                        $bDone = true;
                    } else {
                        $iCurrentCatId = $oCategory->id;
                    }
                }
            }
        } while (!$bDone);

        $aTmpList = array_reverse($aTmpList);
        $oCategoryPath = new TIterator();
        foreach (array_keys($aTmpList) as $iTmpIndex) {
            $oCategoryPath->AddItem($aTmpList[$iTmpIndex]);
        }

        return $oCategoryPath;
    }
public static function & GetCategoryPath ( $ iEndNodeId , $ iStartNodeId = null , $ sLanguageID = null ) { if ( null === $ sLanguageID ) { $ sLanguageID = self :: getLanguageService ( ) -> getActiveLanguageId ( ) ; } $ bDone = false ; $ iCurrentCatId = $ iEndNodeId ; $ aTmpList = array ( ) ; // we store the list in a tmp array so we can reverse the order do { $ oCategory = TdbShopCategory :: GetNewInstance ( ) ; $ oCategory -> SetLanguage ( $ sLanguageID ) ; if ( ! $ oCategory -> Load ( $ iCurrentCatId ) ) { $ oCategory = null ; $ bDone = true ; } else { $ aTmpList [ ] = $ oCategory ; if ( null !== $ iStartNodeId && $ iStartNodeId == $ iCurrentCatId ) { $ bDone = true ; } else { $ oCategory = $ oCategory -> GetParent ( ) ; if ( null === $ oCategory ) { $ bDone = true ; } else { $ iCurrentCatId = $ oCategory -> id ; } } } } while ( ! $ bDone ) ; $ aTmpList = array_reverse ( $ aTmpList ) ; $ oCategoryPath = new TIterator ( ) ; foreach ( array_keys ( $ aTmpList ) as $ iTmpIndex ) { $ oCategoryPath -> AddItem ( $ aTmpList [ $ iTmpIndex ] ) ; } return $ oCategoryPath ; }
return category path from iEndNodeId to iStartNodeId. if not start node is given,
the path will start at the root category.

@param int    $iStartNodeId
@param int    $iEndNodeId
@param string $sLanguageID

@return TIterator
return category path from iEndNodeId to iStartNodeId . if not start node is given the path will start at the root category .