source/Application/Controller/Admin/AdminDetailsController.php
protected function _getCategoryTree($sTplVarName, $sSelectedCatId, $sEditCatId = '', $blForceNonCache = false, $iTreeShopId = null)
    {
        $oCatTree = $this->_createCategoryTree($sTplVarName, $sEditCatId, $blForceNonCache, $iTreeShopId);

        // mark selected
        if ($sSelectedCatId) {
            // fixed parent category in select list
            foreach ($oCatTree as $oCategory) {
                if (strcmp($oCategory->getId(), $sSelectedCatId) == 0) {
                    $oCategory->selected = 1;
                    break;
                }
            }
        } else {
            // no category selected - opening first available
            $oCatTree->rewind();
            if ($oCat = $oCatTree->current()) {
                $oCat->selected = 1;
                $sSelectedCatId = $oCat->getId();
            }
        }

        // passing to view
        $this->_aViewData[$sTplVarName] = $oCatTree;

        return $sSelectedCatId;
    }
protected function _getCategoryTree($sTplVarName, $sSelectedCatId, $sEditCatId = '', $blForceNonCache = false, $iTreeShopId = null)
    {
        $oCatTree = $this->_createCategoryTree($sTplVarName, $sEditCatId, $blForceNonCache, $iTreeShopId);

        // mark selected
        if ($sSelectedCatId) {
            // fixed parent category in select list
            foreach ($oCatTree as $oCategory) {
                if (strcmp($oCategory->getId(), $sSelectedCatId) == 0) {
                    $oCategory->selected = 1;
                    break;
                }
            }
        } else {
            // no category selected - opening first available
            $oCatTree->rewind();
            if ($oCat = $oCatTree->current()) {
                $oCat->selected = 1;
                $sSelectedCatId = $oCat->getId();
            }
        }

        // passing to view
        $this->_aViewData[$sTplVarName] = $oCatTree;

        return $sSelectedCatId;
    }
protected function _getCategoryTree ( $ sTplVarName , $ sSelectedCatId , $ sEditCatId = '' , $ blForceNonCache = false , $ iTreeShopId = null ) { $ oCatTree = $ this -> _createCategoryTree ( $ sTplVarName , $ sEditCatId , $ blForceNonCache , $ iTreeShopId ) ; // mark selected if ( $ sSelectedCatId ) { // fixed parent category in select list foreach ( $ oCatTree as $ oCategory ) { if ( strcmp ( $ oCategory -> getId ( ) , $ sSelectedCatId ) == 0 ) { $ oCategory -> selected = 1 ; break ; } } } else { // no category selected - opening first available $ oCatTree -> rewind ( ) ; if ( $ oCat = $ oCatTree -> current ( ) ) { $ oCat -> selected = 1 ; $ sSelectedCatId = $ oCat -> getId ( ) ; } } // passing to view $ this -> _aViewData [ $ sTplVarName ] = $ oCatTree ; return $ sSelectedCatId ; }
Function creates category tree for select list used in "Category main", "Article extend" etc.
Returns ID of selected category if available.

@param string $sTplVarName     name of template variable where is stored category tree
@param string $sSelectedCatId  ID of category witch was selected in select list
@param string $sEditCatId      ID of category witch we are editing
@param bool   $blForceNonCache Set to true to disable caching
@param int    $iTreeShopId     tree shop id

@return string
Function creates category tree for select list used in Category main Article extend etc . Returns ID of selected category if available .