source/Application/Controller/Admin/AttributeCategoryAjax.php
public function addCatToAttr()
    {
        $aAddCategory = $this->_getActionIds('oxcategories.oxid');
        $soxId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('synchoxid');

        $oAttribute = oxNew(\OxidEsales\Eshop\Application\Model\Attribute::class);
        // adding
        if (\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('all')) {
            $sCatTable = $this->_getViewName('oxcategories');
            $aAddCategory = $this->_getAll($this->_addFilter("select $sCatTable.oxid " . $this->_getQuery()));
        }

        if ($oAttribute->load($soxId) && is_array($aAddCategory)) {
            // We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804 and ESDEV-3822).
            $database = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster();
            foreach ($aAddCategory as $sAdd) {
                $oNewGroup = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class);
                $oNewGroup->init("oxcategory2attribute");
                $sOxSortField = 'oxcategory2attribute__oxsort';
                $sObjectIdField = 'oxcategory2attribute__oxobjectid';
                $sAttributeIdField = 'oxcategory2attribute__oxattrid';
                $sOxIdField = 'oxattribute__oxid';
                $oNewGroup->$sObjectIdField = new \OxidEsales\Eshop\Core\Field($sAdd);
                $oNewGroup->$sAttributeIdField = new \OxidEsales\Eshop\Core\Field($oAttribute->$sOxIdField->value);

                $sSql = "select max(oxsort) + 1 from oxcategory2attribute where oxobjectid = '$sAdd' ";

                $oNewGroup->$sOxSortField = new \OxidEsales\Eshop\Core\Field(( int ) $database->getOne($sSql));
                $oNewGroup->save();
            }
        }

        $this->resetContentCache();
    }
public function addCatToAttr()
    {
        $aAddCategory = $this->_getActionIds('oxcategories.oxid');
        $soxId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('synchoxid');

        $oAttribute = oxNew(\OxidEsales\Eshop\Application\Model\Attribute::class);
        // adding
        if (\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('all')) {
            $sCatTable = $this->_getViewName('oxcategories');
            $aAddCategory = $this->_getAll($this->_addFilter("select $sCatTable.oxid " . $this->_getQuery()));
        }

        if ($oAttribute->load($soxId) && is_array($aAddCategory)) {
            // We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804 and ESDEV-3822).
            $database = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster();
            foreach ($aAddCategory as $sAdd) {
                $oNewGroup = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class);
                $oNewGroup->init("oxcategory2attribute");
                $sOxSortField = 'oxcategory2attribute__oxsort';
                $sObjectIdField = 'oxcategory2attribute__oxobjectid';
                $sAttributeIdField = 'oxcategory2attribute__oxattrid';
                $sOxIdField = 'oxattribute__oxid';
                $oNewGroup->$sObjectIdField = new \OxidEsales\Eshop\Core\Field($sAdd);
                $oNewGroup->$sAttributeIdField = new \OxidEsales\Eshop\Core\Field($oAttribute->$sOxIdField->value);

                $sSql = "select max(oxsort) + 1 from oxcategory2attribute where oxobjectid = '$sAdd' ";

                $oNewGroup->$sOxSortField = new \OxidEsales\Eshop\Core\Field(( int ) $database->getOne($sSql));
                $oNewGroup->save();
            }
        }

        $this->resetContentCache();
    }
public function addCatToAttr ( ) { $ aAddCategory = $ this -> _getActionIds ( 'oxcategories.oxid' ) ; $ soxId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'synchoxid' ) ; $ oAttribute = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Attribute :: class ) ; // adding if ( \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'all' ) ) { $ sCatTable = $ this -> _getViewName ( 'oxcategories' ) ; $ aAddCategory = $ this -> _getAll ( $ this -> _addFilter ( "select $sCatTable.oxid " . $ this -> _getQuery ( ) ) ) ; } if ( $ oAttribute -> load ( $ soxId ) && is_array ( $ aAddCategory ) ) { // We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804 and ESDEV-3822). $ database = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getMaster ( ) ; foreach ( $ aAddCategory as $ sAdd ) { $ oNewGroup = oxNew ( \ OxidEsales \ Eshop \ Core \ Model \ BaseModel :: class ) ; $ oNewGroup -> init ( "oxcategory2attribute" ) ; $ sOxSortField = 'oxcategory2attribute__oxsort' ; $ sObjectIdField = 'oxcategory2attribute__oxobjectid' ; $ sAttributeIdField = 'oxcategory2attribute__oxattrid' ; $ sOxIdField = 'oxattribute__oxid' ; $ oNewGroup -> $ sObjectIdField = new \ OxidEsales \ Eshop \ Core \ Field ( $ sAdd ) ; $ oNewGroup -> $ sAttributeIdField = new \ OxidEsales \ Eshop \ Core \ Field ( $ oAttribute -> $ sOxIdField -> value ) ; $ sSql = "select max(oxsort) + 1 from oxcategory2attribute where oxobjectid = '$sAdd' " ; $ oNewGroup -> $ sOxSortField = new \ OxidEsales \ Eshop \ Core \ Field ( ( int ) $ database -> getOne ( $ sSql ) ) ; $ oNewGroup -> save ( ) ; } } $ this -> resetContentCache ( ) ; }
Adds category to Attributes list

@throws Exception
Adds category to Attributes list