source/Application/Model/CategoryList.php
public function updateCategoryTree($blVerbose = true, $sShopID = null)
    {
        // Only called from admin and admin mode reads from master (see ESDEV-3804 and ESDEV-3822).
        $database = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
        $database->startTransaction();

        try {
            $sWhere = $this->getInitialUpdateCategoryTreeCondition($blVerbose);

            $database->execute("update oxcategories set oxleft = 0, oxright = 0 where $sWhere");
            $database->execute("update oxcategories set oxleft = 1, oxright = 2 where oxparentid = 'oxrootid' and $sWhere");

            // Get all root categories
            $rs = $database->select("select oxid, oxtitle from oxcategories where oxparentid = 'oxrootid' and $sWhere order by oxsort", false);
            if ($rs != false && $rs->count() > 0) {
                while (!$rs->EOF) {
                    $this->_aUpdateInfo[] = "<b>Processing : " . $rs->fields[1] . "</b>(" . $rs->fields[0] . ")<br>";
                    if ($blVerbose) {
                        echo next($this->_aUpdateInfo);
                    }
                    $oxRootId = $rs->fields[0];

                    $this->_updateNodes($oxRootId, true, $oxRootId);
                    $rs->fetchRow();
                }
            }
            $database->commitTransaction();
        } catch (Exception $exception) {
            $database->rollbackTransaction();
            throw $exception;
        }

        $this->onUpdateCategoryTree();
    }
public function updateCategoryTree($blVerbose = true, $sShopID = null)
    {
        // Only called from admin and admin mode reads from master (see ESDEV-3804 and ESDEV-3822).
        $database = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
        $database->startTransaction();

        try {
            $sWhere = $this->getInitialUpdateCategoryTreeCondition($blVerbose);

            $database->execute("update oxcategories set oxleft = 0, oxright = 0 where $sWhere");
            $database->execute("update oxcategories set oxleft = 1, oxright = 2 where oxparentid = 'oxrootid' and $sWhere");

            // Get all root categories
            $rs = $database->select("select oxid, oxtitle from oxcategories where oxparentid = 'oxrootid' and $sWhere order by oxsort", false);
            if ($rs != false && $rs->count() > 0) {
                while (!$rs->EOF) {
                    $this->_aUpdateInfo[] = "<b>Processing : " . $rs->fields[1] . "</b>(" . $rs->fields[0] . ")<br>";
                    if ($blVerbose) {
                        echo next($this->_aUpdateInfo);
                    }
                    $oxRootId = $rs->fields[0];

                    $this->_updateNodes($oxRootId, true, $oxRootId);
                    $rs->fetchRow();
                }
            }
            $database->commitTransaction();
        } catch (Exception $exception) {
            $database->rollbackTransaction();
            throw $exception;
        }

        $this->onUpdateCategoryTree();
    }
public function updateCategoryTree ( $ blVerbose = true , $ sShopID = null ) { // Only called from admin and admin mode reads from master (see ESDEV-3804 and ESDEV-3822). $ database = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ database -> startTransaction ( ) ; try { $ sWhere = $ this -> getInitialUpdateCategoryTreeCondition ( $ blVerbose ) ; $ database -> execute ( "update oxcategories set oxleft = 0, oxright = 0 where $sWhere" ) ; $ database -> execute ( "update oxcategories set oxleft = 1, oxright = 2 where oxparentid = 'oxrootid' and $sWhere" ) ; // Get all root categories $ rs = $ database -> select ( "select oxid, oxtitle from oxcategories where oxparentid = 'oxrootid' and $sWhere order by oxsort" , false ) ; if ( $ rs != false && $ rs -> count ( ) > 0 ) { while ( ! $ rs -> EOF ) { $ this -> _aUpdateInfo [ ] = "<b>Processing : " . $ rs -> fields [ 1 ] . "</b>(" . $ rs -> fields [ 0 ] . ")<br>" ; if ( $ blVerbose ) { echo next ( $ this -> _aUpdateInfo ) ; } $ oxRootId = $ rs -> fields [ 0 ] ; $ this -> _updateNodes ( $ oxRootId , true , $ oxRootId ) ; $ rs -> fetchRow ( ) ; } } $ database -> commitTransaction ( ) ; } catch ( Exception $ exception ) { $ database -> rollbackTransaction ( ) ; throw $ exception ; } $ this -> onUpdateCategoryTree ( ) ; }
Rebuilds nested sets information by updating oxLeft and oxRight category attributes, from oxParentId

@param bool   $blVerbose Set to true for output the update status for user,
@param string $sShopID   the shop id
Rebuilds nested sets information by updating oxLeft and oxRight category attributes from oxParentId