source/Application/Controller/Admin/DiscountUsersAjax.php
public function addDiscUser()
    {
        $oConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
        $aChosenUsr = $this->_getActionIds('oxuser.oxid');
        $soxId = $oConfig->getRequestParameter('synchoxid');

        if ($oConfig->getRequestParameter('all')) {
            $sUserTable = $this->_getViewName('oxuser');
            $aChosenUsr = $this->_getAll($this->_addFilter("select $sUserTable.oxid " . $this->_getQuery()));
        }
        if ($soxId && $soxId != "-1" && is_array($aChosenUsr)) {
            foreach ($aChosenUsr as $sChosenUsr) {
                $oObject2Discount = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class);
                $oObject2Discount->init('oxobject2discount');
                $oObject2Discount->oxobject2discount__oxdiscountid = new \OxidEsales\Eshop\Core\Field($soxId);
                $oObject2Discount->oxobject2discount__oxobjectid = new \OxidEsales\Eshop\Core\Field($sChosenUsr);
                $oObject2Discount->oxobject2discount__oxtype = new \OxidEsales\Eshop\Core\Field("oxuser");
                $oObject2Discount->save();
            }
        }
    }
public function addDiscUser()
    {
        $oConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
        $aChosenUsr = $this->_getActionIds('oxuser.oxid');
        $soxId = $oConfig->getRequestParameter('synchoxid');

        if ($oConfig->getRequestParameter('all')) {
            $sUserTable = $this->_getViewName('oxuser');
            $aChosenUsr = $this->_getAll($this->_addFilter("select $sUserTable.oxid " . $this->_getQuery()));
        }
        if ($soxId && $soxId != "-1" && is_array($aChosenUsr)) {
            foreach ($aChosenUsr as $sChosenUsr) {
                $oObject2Discount = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class);
                $oObject2Discount->init('oxobject2discount');
                $oObject2Discount->oxobject2discount__oxdiscountid = new \OxidEsales\Eshop\Core\Field($soxId);
                $oObject2Discount->oxobject2discount__oxobjectid = new \OxidEsales\Eshop\Core\Field($sChosenUsr);
                $oObject2Discount->oxobject2discount__oxtype = new \OxidEsales\Eshop\Core\Field("oxuser");
                $oObject2Discount->save();
            }
        }
    }
public function addDiscUser ( ) { $ oConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ aChosenUsr = $ this -> _getActionIds ( 'oxuser.oxid' ) ; $ soxId = $ oConfig -> getRequestParameter ( 'synchoxid' ) ; if ( $ oConfig -> getRequestParameter ( 'all' ) ) { $ sUserTable = $ this -> _getViewName ( 'oxuser' ) ; $ aChosenUsr = $ this -> _getAll ( $ this -> _addFilter ( "select $sUserTable.oxid " . $ this -> _getQuery ( ) ) ) ; } if ( $ soxId && $ soxId != "-1" && is_array ( $ aChosenUsr ) ) { foreach ( $ aChosenUsr as $ sChosenUsr ) { $ oObject2Discount = oxNew ( \ OxidEsales \ Eshop \ Core \ Model \ BaseModel :: class ) ; $ oObject2Discount -> init ( 'oxobject2discount' ) ; $ oObject2Discount -> oxobject2discount__oxdiscountid = new \ OxidEsales \ Eshop \ Core \ Field ( $ soxId ) ; $ oObject2Discount -> oxobject2discount__oxobjectid = new \ OxidEsales \ Eshop \ Core \ Field ( $ sChosenUsr ) ; $ oObject2Discount -> oxobject2discount__oxtype = new \ OxidEsales \ Eshop \ Core \ Field ( "oxuser" ) ; $ oObject2Discount -> save ( ) ; } } }
Adds user to discount config
Adds user to discount config