source/Application/Controller/Admin/AdminDetailsController.php
protected function _createCategoryTree($sTplVarName, $sEditCatId = '', $blForceNonCache = false, $iTreeShopId = null)
    {
        // caching category tree, to load it once, not many times
        if (!isset($this->oCatTree) || $blForceNonCache) {
            $this->oCatTree = oxNew(\OxidEsales\Eshop\Application\Model\CategoryList::class);
            $this->oCatTree->setShopID($iTreeShopId);

            // setting language
            $oBase = $this->oCatTree->getBaseObject();
            $oBase->setLanguage($this->_iEditLang);

            $this->oCatTree->loadList();
        }

        // copying tree
        $oCatTree = $this->oCatTree;
        //removing current category
        if ($sEditCatId && isset($oCatTree[$sEditCatId])) {
            unset($oCatTree[$sEditCatId]);
        }

        // add first fake category for not assigned articles
        $oRoot = oxNew(\OxidEsales\Eshop\Application\Model\Category::class);
        $oRoot->oxcategories__oxtitle = new \OxidEsales\Eshop\Core\Field('--');

        $oCatTree->assign(array_merge(['' => $oRoot], $oCatTree->getArray()));

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

        return $oCatTree;
    }
protected function _createCategoryTree($sTplVarName, $sEditCatId = '', $blForceNonCache = false, $iTreeShopId = null)
    {
        // caching category tree, to load it once, not many times
        if (!isset($this->oCatTree) || $blForceNonCache) {
            $this->oCatTree = oxNew(\OxidEsales\Eshop\Application\Model\CategoryList::class);
            $this->oCatTree->setShopID($iTreeShopId);

            // setting language
            $oBase = $this->oCatTree->getBaseObject();
            $oBase->setLanguage($this->_iEditLang);

            $this->oCatTree->loadList();
        }

        // copying tree
        $oCatTree = $this->oCatTree;
        //removing current category
        if ($sEditCatId && isset($oCatTree[$sEditCatId])) {
            unset($oCatTree[$sEditCatId]);
        }

        // add first fake category for not assigned articles
        $oRoot = oxNew(\OxidEsales\Eshop\Application\Model\Category::class);
        $oRoot->oxcategories__oxtitle = new \OxidEsales\Eshop\Core\Field('--');

        $oCatTree->assign(array_merge(['' => $oRoot], $oCatTree->getArray()));

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

        return $oCatTree;
    }
protected function _createCategoryTree ( $ sTplVarName , $ sEditCatId = '' , $ blForceNonCache = false , $ iTreeShopId = null ) { // caching category tree, to load it once, not many times if ( ! isset ( $ this -> oCatTree ) || $ blForceNonCache ) { $ this -> oCatTree = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ CategoryList :: class ) ; $ this -> oCatTree -> setShopID ( $ iTreeShopId ) ; // setting language $ oBase = $ this -> oCatTree -> getBaseObject ( ) ; $ oBase -> setLanguage ( $ this -> _iEditLang ) ; $ this -> oCatTree -> loadList ( ) ; } // copying tree $ oCatTree = $ this -> oCatTree ; //removing current category if ( $ sEditCatId && isset ( $ oCatTree [ $ sEditCatId ] ) ) { unset ( $ oCatTree [ $ sEditCatId ] ) ; } // add first fake category for not assigned articles $ oRoot = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Category :: class ) ; $ oRoot -> oxcategories__oxtitle = new \ OxidEsales \ Eshop \ Core \ Field ( '--' ) ; $ oCatTree -> assign ( array_merge ( [ '' => $ oRoot ] , $ oCatTree -> getArray ( ) ) ) ; // passing to view $ this -> _aViewData [ $ sTplVarName ] = $ oCatTree ; return $ oCatTree ; }
Function creates category tree for select list used in "Category main", "Article extend" etc.

@param string $sTplVarName     name of template variable where is stored category tree
@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 .