source/Application/Controller/Admin/CategoryList.php
public function render()
    {
        parent::render();

        $oLang = \OxidEsales\Eshop\Core\Registry::getLang();
        $iLang = $oLang->getTplLanguage();

        // parent category tree
        $oCatTree = oxNew(\OxidEsales\Eshop\Application\Model\CategoryList::class);
        $oCatTree->loadList();

        // add Root as fake category
        // rebuild list as we need the root entry at the first position
        $aNewList = [];
        $oRoot = new stdClass();
        $oRoot->oxcategories__oxid = new \OxidEsales\Eshop\Core\Field(null, \OxidEsales\Eshop\Core\Field::T_RAW);
        $oRoot->oxcategories__oxtitle = new \OxidEsales\Eshop\Core\Field($oLang->translateString("viewAll", $iLang), \OxidEsales\Eshop\Core\Field::T_RAW);
        $aNewList[] = $oRoot;

        $oRoot = new stdClass();
        $oRoot->oxcategories__oxid = new \OxidEsales\Eshop\Core\Field("oxrootid", \OxidEsales\Eshop\Core\Field::T_RAW);
        $oRoot->oxcategories__oxtitle = new \OxidEsales\Eshop\Core\Field("-- " . $oLang->translateString("mainCategory", $iLang) . " --", \OxidEsales\Eshop\Core\Field::T_RAW);
        $aNewList[] = $oRoot;

        foreach ($oCatTree as $oCategory) {
            $aNewList[] = $oCategory;
        }

        $oCatTree->assign($aNewList);
        $aFilter = $this->getListFilter();
        if (is_array($aFilter) && isset($aFilter["oxcategories"]["oxparentid"])) {
            foreach ($oCatTree as $oCategory) {
                if ($oCategory->oxcategories__oxid->value == $aFilter["oxcategories"]["oxparentid"]) {
                    $oCategory->selected = 1;
                    break;
                }
            }
        }

        $this->_aViewData["cattree"] = $oCatTree;

        return "category_list.tpl";
    }
public function render()
    {
        parent::render();

        $oLang = \OxidEsales\Eshop\Core\Registry::getLang();
        $iLang = $oLang->getTplLanguage();

        // parent category tree
        $oCatTree = oxNew(\OxidEsales\Eshop\Application\Model\CategoryList::class);
        $oCatTree->loadList();

        // add Root as fake category
        // rebuild list as we need the root entry at the first position
        $aNewList = [];
        $oRoot = new stdClass();
        $oRoot->oxcategories__oxid = new \OxidEsales\Eshop\Core\Field(null, \OxidEsales\Eshop\Core\Field::T_RAW);
        $oRoot->oxcategories__oxtitle = new \OxidEsales\Eshop\Core\Field($oLang->translateString("viewAll", $iLang), \OxidEsales\Eshop\Core\Field::T_RAW);
        $aNewList[] = $oRoot;

        $oRoot = new stdClass();
        $oRoot->oxcategories__oxid = new \OxidEsales\Eshop\Core\Field("oxrootid", \OxidEsales\Eshop\Core\Field::T_RAW);
        $oRoot->oxcategories__oxtitle = new \OxidEsales\Eshop\Core\Field("-- " . $oLang->translateString("mainCategory", $iLang) . " --", \OxidEsales\Eshop\Core\Field::T_RAW);
        $aNewList[] = $oRoot;

        foreach ($oCatTree as $oCategory) {
            $aNewList[] = $oCategory;
        }

        $oCatTree->assign($aNewList);
        $aFilter = $this->getListFilter();
        if (is_array($aFilter) && isset($aFilter["oxcategories"]["oxparentid"])) {
            foreach ($oCatTree as $oCategory) {
                if ($oCategory->oxcategories__oxid->value == $aFilter["oxcategories"]["oxparentid"]) {
                    $oCategory->selected = 1;
                    break;
                }
            }
        }

        $this->_aViewData["cattree"] = $oCatTree;

        return "category_list.tpl";
    }
public function render ( ) { parent :: render ( ) ; $ oLang = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) ; $ iLang = $ oLang -> getTplLanguage ( ) ; // parent category tree $ oCatTree = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ CategoryList :: class ) ; $ oCatTree -> loadList ( ) ; // add Root as fake category // rebuild list as we need the root entry at the first position $ aNewList = [ ] ; $ oRoot = new stdClass ( ) ; $ oRoot -> oxcategories__oxid = new \ OxidEsales \ Eshop \ Core \ Field ( null , \ OxidEsales \ Eshop \ Core \ Field :: T_RAW ) ; $ oRoot -> oxcategories__oxtitle = new \ OxidEsales \ Eshop \ Core \ Field ( $ oLang -> translateString ( "viewAll" , $ iLang ) , \ OxidEsales \ Eshop \ Core \ Field :: T_RAW ) ; $ aNewList [ ] = $ oRoot ; $ oRoot = new stdClass ( ) ; $ oRoot -> oxcategories__oxid = new \ OxidEsales \ Eshop \ Core \ Field ( "oxrootid" , \ OxidEsales \ Eshop \ Core \ Field :: T_RAW ) ; $ oRoot -> oxcategories__oxtitle = new \ OxidEsales \ Eshop \ Core \ Field ( "-- " . $ oLang -> translateString ( "mainCategory" , $ iLang ) . " --" , \ OxidEsales \ Eshop \ Core \ Field :: T_RAW ) ; $ aNewList [ ] = $ oRoot ; foreach ( $ oCatTree as $ oCategory ) { $ aNewList [ ] = $ oCategory ; } $ oCatTree -> assign ( $ aNewList ) ; $ aFilter = $ this -> getListFilter ( ) ; if ( is_array ( $ aFilter ) && isset ( $ aFilter [ "oxcategories" ] [ "oxparentid" ] ) ) { foreach ( $ oCatTree as $ oCategory ) { if ( $ oCategory -> oxcategories__oxid -> value == $ aFilter [ "oxcategories" ] [ "oxparentid" ] ) { $ oCategory -> selected = 1 ; break ; } } } $ this -> _aViewData [ "cattree" ] = $ oCatTree ; return "category_list.tpl" ; }
Loads category tree, passes data to Smarty and returns name of
template file "category_list.tpl".

@return string
Loads category tree passes data to Smarty and returns name of template file category_list . tpl .