Get discount

If no "discount" value has been set, this method will
set and return a default "discount" value,
if any such value is available

@see getDefaultDiscount()

@return string|null discount or null if no discount has been set
773750
public function getDiscount() : ?string 
    {
        if ( ! $this->hasDiscount()) {
            $this->setDiscount($this->getDefaultDiscount());
        }
        return $this->discount;
    }
1288813
public function getDefaultOptions()
    {
        if (! $this->defaults) {
            return null;
        }

        if ($this->defaults instanceof ConfigInterface) {
            return $this->defaults->getArrayCopy();
        }

        return (array)$this->defaults;
    }
1305776
public function getTotalDiscountSum()
    {
        $dPrice = 0;
        // subtracting total discount
        if ($oPrice = $this->getTotalDiscount()) {
            $dPrice += $oPrice->getPrice();
        }

        if ($oVoucherPrice = $this->getVoucherDiscount()) {
            $dPrice += $oVoucherPrice->getPrice();
        }

        return $dPrice;
    }
416520
public function getDiscount($format = true)
    {
        $amount = 0;

        if ($this->coupon) {
            $amount = $this->coupon->forItem($this);
        } elseif (app('laracart')->findCoupon($this->code)) {
            $amount = $this->discount;
        }

        if ($amount < 0) {
            $amount = $this->price;
        }

        return LaraCart::formatMoney(
            $amount,
            $this->locale,
            $this->internationalFormat,
            $format
        );
    }
87219
public function discountAmount()
    {
        $totalDiscount = 0;

        foreach ($this->transaction->discounts as $discount) {
            $totalDiscount += $discount->amount;
        }

        return (float) $totalDiscount;
    }
915831
public function getDefaultAction()
    {
        // Determine the appliccable action
        if ( ! $this->default_action) {
            return null;
        }

        $actions = $this->default_action;

        if ( ! is_array($actions)) {
            $actions = [
                new ModelActionReferenceData([
                    'strategy' => $actions,
                ]),
            ];
        }

        $core = $this->getCore();


        foreach ($actions as $action) {

            $permissions = $action->permissions();

            if (    ! count($permissions)
                ||  $core->auth()->user()->isAdmin()
                ||  $core->auth()->user()->can($permissions)
            ) {
                return $action;
            }
        }

        return null;
    }
1125566
public function getDefaultMonth()
    {
        $result = null;

        $keys = array_keys($this->getMonths());
        if (count($keys) >= 2) {
            $result = (string)$keys[1];
        }

        return $result;
    }
504877
public function getDefault()
    {
        $sDefault  = $this->oCi->config->item('languages_default');
        $oLanguage = $this->getByCode($sDefault);

        return !empty($oLanguage) ? $oLanguage : false;
    }
986122
public String getDefaultValue() {

        String value = null;
        if (!m_defaultValues.isEmpty()) {
            value = m_defaultValues.get(m_defaultValues.size() - 1);
        }
        return value;
    }
821697
public function getDiscountAmount()
    {
        $total = 0;
        $discount = 0;
        
        foreach ($this->items as $item) {
            if ($item->Price) {
                $total += ($item->Price * $item->Quantity);
            }
            
            if ($item->Discount) {
                $discount += ($item->TotalDiscount);
            }
        }
        
        if ($discount > $total) {
            $discount = $total;
        }

        return $discount;
    }
126104
public function getDefaultPrice()
    {
        $prices = $this->getPrices();
        foreach ($prices as $price) {
            if ($price->from == 1) {
                return $price->value;
            }
        }
    }
1116770
public function getBrand() : ?int 
    {
        if ( ! $this->hasBrand()) {
            $this->setBrand($this->getDefaultBrand());
        }
        return $this->brand;
    }
604602
public function getVal(){
		//Check for re-defined value (for example, by POST query)
		if(isset($this->value)){
			return $this->value;
			}
		//Check for define
		if(defined($this->alias)){
			return constant($this->alias);
			}
		//If nothing found - return default value
		return $this->default;
		}
330805
public function getTax()
    {
        $amount = 0;

        if ($this->Price && $this->TaxRate) {
            $amount = (($this->Price - $this->Discount) / 100) * $this->TaxRate;
        }
        
        return $amount;
    }
1325358
public static function getDefault()
    {
        $fields = self::getDbConnection()->fetchAssoc( "SELECT * FROM dir_data where hidden<>1 and is_server<>0 and type&".Server::DEFAULT_SERVER."=1" );
        if ($fields) {
            return self::fetch($fields);
        } else {
            return false;
        }     
    }
1070108
protected function getDefaultDecider()
    {
        return function ($retry, $maxAttempts, $result = null, $exception = null) {
            if($retry >= $maxAttempts && ! is_null($exception)) {
                throw  $exception;
            }

            return $retry < $maxAttempts && !is_null($exception);
        };
    }
399027
protected function _calcVoucherDiscount()
    {
        if (\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('bl_showVouchers') && ($this->_oVoucherDiscount === null || ($this->_blUpdateNeeded && !$this->isAdmin()))) {
            $this->_oVoucherDiscount = $this->_getPriceObject();

            // calculating price to apply discount
            $dPrice = $this->_oDiscountProductsPriceList->getSum($this->isCalculationModeNetto()) - $this->_oTotalDiscount->getPrice();

            // recalculating
            if (count($this->_aVouchers)) {
                $oLang = \OxidEsales\Eshop\Core\Registry::getLang();
                foreach ($this->_aVouchers as $sVoucherId => $oStdVoucher) {
                    $oVoucher = oxNew(\OxidEsales\Eshop\Application\Model\Voucher::class);
                    try { // checking
                        $oVoucher->load($oStdVoucher->sVoucherId);

                        if (!$this->_blSkipVouchersAvailabilityChecking) {
                            $oVoucher->checkBasketVoucherAvailability($this->_aVouchers, $dPrice);
                            $oVoucher->checkUserAvailability($this->getBasketUser());
                        }

                        // assigning real voucher discount value as this is the only place where real value is calculated
                        $dVoucherdiscount = $oVoucher->getDiscountValue($dPrice);

                        if ($dVoucherdiscount > 0) {
                            $dVatPart = ($dPrice - $dVoucherdiscount) / $dPrice * 100;

                            if (!$this->_aDiscountedVats) {
                                if ($oPriceList = $this->getDiscountProductsPrice()) {
                                    $this->_aDiscountedVats = $oPriceList->getVatInfo($this->isCalculationModeNetto());
                                }
                            }

                            // apply discount to vat
                            foreach ($this->_aDiscountedVats as $sKey => $dVat) {
                                $this->_aDiscountedVats[$sKey] = \OxidEsales\Eshop\Core\Price::percent($dVat, $dVatPart);
                            }
                        }

                        // accumulating discount value
                        $this->_oVoucherDiscount->add($dVoucherdiscount);

                        // collecting formatted for preview
                        $oStdVoucher->fVoucherdiscount = $oLang->formatCurrency($dVoucherdiscount, $this->getBasketCurrency());
                        $oStdVoucher->dVoucherdiscount = $dVoucherdiscount;

                        // subtracting voucher discount
                        $dPrice = $dPrice - $dVoucherdiscount;
                    } catch (\OxidEsales\Eshop\Core\Exception\VoucherException $oEx) {
                        // removing voucher on error
                        $oVoucher->unMarkAsReserved();
                        unset($this->_aVouchers[$sVoucherId]);

                        // storing voucher error info
                        \OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($oEx, false, true);
                    }
                }
            }
        }
    }