source/Application/Model/Voucher.php
protected function _getCategoryDiscountValue($dPrice)
    {
        $oDiscount = $this->_getSerieDiscount();
        $aBasketItems = $this->_getBasketItems($oDiscount);

        // Basket Item Count and isAdmin check (unable to access property $oOrder->_getOrderBasket()->_blSkipVouchersAvailabilityChecking)
        if (!count($aBasketItems) && !$this->isAdmin()) {
            $oEx = oxNew(\OxidEsales\Eshop\Core\Exception\VoucherException::class);
            $oEx->setMessage('ERROR_MESSAGE_VOUCHER_NOVOUCHER');
            $oEx->setVoucherNr($this->oxvouchers__oxvouchernr->value);
            throw $oEx;
        }

        $oProductPrice = oxNew(\OxidEsales\Eshop\Core\Price::class);
        $oProductTotal = oxNew(\OxidEsales\Eshop\Core\Price::class);

        foreach ($aBasketItems as $aBasketItem) {
            $oProductPrice->setPrice($aBasketItem['price']);
            $oProductPrice->multiply($aBasketItem['amount']);
            $oProductTotal->add($oProductPrice->getBruttoPrice());
        }

        $dProduct = $oProductTotal->getBruttoPrice();
        $dVoucher = $oDiscount->getAbsValue($dProduct);

        return ($dVoucher > $dProduct) ? $dProduct : $dVoucher;
    }
protected function _getCategoryDiscountValue($dPrice)
    {
        $oDiscount = $this->_getSerieDiscount();
        $aBasketItems = $this->_getBasketItems($oDiscount);

        // Basket Item Count and isAdmin check (unable to access property $oOrder->_getOrderBasket()->_blSkipVouchersAvailabilityChecking)
        if (!count($aBasketItems) && !$this->isAdmin()) {
            $oEx = oxNew(\OxidEsales\Eshop\Core\Exception\VoucherException::class);
            $oEx->setMessage('ERROR_MESSAGE_VOUCHER_NOVOUCHER');
            $oEx->setVoucherNr($this->oxvouchers__oxvouchernr->value);
            throw $oEx;
        }

        $oProductPrice = oxNew(\OxidEsales\Eshop\Core\Price::class);
        $oProductTotal = oxNew(\OxidEsales\Eshop\Core\Price::class);

        foreach ($aBasketItems as $aBasketItem) {
            $oProductPrice->setPrice($aBasketItem['price']);
            $oProductPrice->multiply($aBasketItem['amount']);
            $oProductTotal->add($oProductPrice->getBruttoPrice());
        }

        $dProduct = $oProductTotal->getBruttoPrice();
        $dVoucher = $oDiscount->getAbsValue($dProduct);

        return ($dVoucher > $dProduct) ? $dProduct : $dVoucher;
    }
protected function _getCategoryDiscountValue ( $ dPrice ) { $ oDiscount = $ this -> _getSerieDiscount ( ) ; $ aBasketItems = $ this -> _getBasketItems ( $ oDiscount ) ; // Basket Item Count and isAdmin check (unable to access property $oOrder->_getOrderBasket()->_blSkipVouchersAvailabilityChecking) if ( ! count ( $ aBasketItems ) && ! $ this -> isAdmin ( ) ) { $ oEx = oxNew ( \ OxidEsales \ Eshop \ Core \ Exception \ VoucherException :: class ) ; $ oEx -> setMessage ( 'ERROR_MESSAGE_VOUCHER_NOVOUCHER' ) ; $ oEx -> setVoucherNr ( $ this -> oxvouchers__oxvouchernr -> value ) ; throw $ oEx ; } $ oProductPrice = oxNew ( \ OxidEsales \ Eshop \ Core \ Price :: class ) ; $ oProductTotal = oxNew ( \ OxidEsales \ Eshop \ Core \ Price :: class ) ; foreach ( $ aBasketItems as $ aBasketItem ) { $ oProductPrice -> setPrice ( $ aBasketItem [ 'price' ] ) ; $ oProductPrice -> multiply ( $ aBasketItem [ 'amount' ] ) ; $ oProductTotal -> add ( $ oProductPrice -> getBruttoPrice ( ) ) ; } $ dProduct = $ oProductTotal -> getBruttoPrice ( ) ; $ dVoucher = $ oDiscount -> getAbsValue ( $ dProduct ) ; return ( $ dVoucher > $ dProduct ) ? $ dProduct : $ dVoucher ; }
Returns the discount value used, if voucher is applied only for specific categories.

@param double $dPrice price to calculate discount on it

@throws oxVoucherException exception

@return double
Returns the discount value used if voucher is applied only for specific categories .