source/Application/Controller/Admin/DiscountGroupsAjax.php
public function addDiscGroup()
    {
        $config = \OxidEsales\Eshop\Core\Registry::getConfig();
        $groupIds = $this->_getActionIds('oxgroups.oxid');
        $discountId = $config->getRequestParameter('synchoxid');

        if ($config->getRequestParameter('all')) {
            $groupTable = $this->_getViewName('oxgroups');
            $groupIds = $this->_getAll($this->_addFilter("select $groupTable.oxid " . $this->_getQuery()));
        }
        if ($discountId && $discountId != self::NEW_DISCOUNT_ID && is_array($groupIds)) {
            foreach ($groupIds as $groupId) {
                $object2Discount = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class);
                $object2Discount->init('oxobject2discount');
                $object2Discount->oxobject2discount__oxdiscountid = new \OxidEsales\Eshop\Core\Field($discountId);
                $object2Discount->oxobject2discount__oxobjectid = new \OxidEsales\Eshop\Core\Field($groupId);
                $object2Discount->oxobject2discount__oxtype = new \OxidEsales\Eshop\Core\Field("oxgroups");
                $object2Discount->save();
            }
        }
    }
public function addDiscGroup()
    {
        $config = \OxidEsales\Eshop\Core\Registry::getConfig();
        $groupIds = $this->_getActionIds('oxgroups.oxid');
        $discountId = $config->getRequestParameter('synchoxid');

        if ($config->getRequestParameter('all')) {
            $groupTable = $this->_getViewName('oxgroups');
            $groupIds = $this->_getAll($this->_addFilter("select $groupTable.oxid " . $this->_getQuery()));
        }
        if ($discountId && $discountId != self::NEW_DISCOUNT_ID && is_array($groupIds)) {
            foreach ($groupIds as $groupId) {
                $object2Discount = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class);
                $object2Discount->init('oxobject2discount');
                $object2Discount->oxobject2discount__oxdiscountid = new \OxidEsales\Eshop\Core\Field($discountId);
                $object2Discount->oxobject2discount__oxobjectid = new \OxidEsales\Eshop\Core\Field($groupId);
                $object2Discount->oxobject2discount__oxtype = new \OxidEsales\Eshop\Core\Field("oxgroups");
                $object2Discount->save();
            }
        }
    }
public function addDiscGroup ( ) { $ config = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ groupIds = $ this -> _getActionIds ( 'oxgroups.oxid' ) ; $ discountId = $ config -> getRequestParameter ( 'synchoxid' ) ; if ( $ config -> getRequestParameter ( 'all' ) ) { $ groupTable = $ this -> _getViewName ( 'oxgroups' ) ; $ groupIds = $ this -> _getAll ( $ this -> _addFilter ( "select $groupTable.oxid " . $ this -> _getQuery ( ) ) ) ; } if ( $ discountId && $ discountId != self :: NEW_DISCOUNT_ID && is_array ( $ groupIds ) ) { foreach ( $ groupIds as $ groupId ) { $ object2Discount = oxNew ( \ OxidEsales \ Eshop \ Core \ Model \ BaseModel :: class ) ; $ object2Discount -> init ( 'oxobject2discount' ) ; $ object2Discount -> oxobject2discount__oxdiscountid = new \ OxidEsales \ Eshop \ Core \ Field ( $ discountId ) ; $ object2Discount -> oxobject2discount__oxobjectid = new \ OxidEsales \ Eshop \ Core \ Field ( $ groupId ) ; $ object2Discount -> oxobject2discount__oxtype = new \ OxidEsales \ Eshop \ Core \ Field ( "oxgroups" ) ; $ object2Discount -> save ( ) ; } } }
Adds user group to discount config
Adds user group to discount config