source/Application/Model/Discount.php
public function isForBasket($oBasket)
    {
        // initial configuration check
        if ($this->oxdiscount__oxamount->value == 0 && $this->oxdiscount__oxprice->value == 0) {
            return false;
        }

        $oSummary = $oBasket->getBasketSummary();
        // amounts check
        if ($this->oxdiscount__oxamount->value && ($oSummary->iArticleCount < $this->oxdiscount__oxamount->value || $oSummary->iArticleCount > $this->oxdiscount__oxamountto->value)) {
            return false;
            // price check
        } elseif ($this->oxdiscount__oxprice->value) {
            $dRate = $oBasket->getBasketCurrency()->rate;
            if ($oSummary->dArticleDiscountablePrice < $this->oxdiscount__oxprice->value * $dRate || $oSummary->dArticleDiscountablePrice > $this->oxdiscount__oxpriceto->value * $dRate) {
                return false;
            }
        }

        // oxobject2discount configuration check
        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
        $sQ = 'select 1 from oxobject2discount where oxdiscountid = ' . $oDb->quote($this->oxdiscount__oxid->value) . ' and oxtype in ("oxarticles", "oxcategories" ) ';

        return !((bool) $oDb->getOne($sQ));
    }
public function isForBasket($oBasket)
    {
        // initial configuration check
        if ($this->oxdiscount__oxamount->value == 0 && $this->oxdiscount__oxprice->value == 0) {
            return false;
        }

        $oSummary = $oBasket->getBasketSummary();
        // amounts check
        if ($this->oxdiscount__oxamount->value && ($oSummary->iArticleCount < $this->oxdiscount__oxamount->value || $oSummary->iArticleCount > $this->oxdiscount__oxamountto->value)) {
            return false;
            // price check
        } elseif ($this->oxdiscount__oxprice->value) {
            $dRate = $oBasket->getBasketCurrency()->rate;
            if ($oSummary->dArticleDiscountablePrice < $this->oxdiscount__oxprice->value * $dRate || $oSummary->dArticleDiscountablePrice > $this->oxdiscount__oxpriceto->value * $dRate) {
                return false;
            }
        }

        // oxobject2discount configuration check
        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
        $sQ = 'select 1 from oxobject2discount where oxdiscountid = ' . $oDb->quote($this->oxdiscount__oxid->value) . ' and oxtype in ("oxarticles", "oxcategories" ) ';

        return !((bool) $oDb->getOne($sQ));
    }
public function isForBasket ( $ oBasket ) { // initial configuration check if ( $ this -> oxdiscount__oxamount -> value == 0 && $ this -> oxdiscount__oxprice -> value == 0 ) { return false ; } $ oSummary = $ oBasket -> getBasketSummary ( ) ; // amounts check if ( $ this -> oxdiscount__oxamount -> value && ( $ oSummary -> iArticleCount < $ this -> oxdiscount__oxamount -> value || $ oSummary -> iArticleCount > $ this -> oxdiscount__oxamountto -> value ) ) { return false ; // price check } elseif ( $ this -> oxdiscount__oxprice -> value ) { $ dRate = $ oBasket -> getBasketCurrency ( ) -> rate ; if ( $ oSummary -> dArticleDiscountablePrice < $ this -> oxdiscount__oxprice -> value * $ dRate || $ oSummary -> dArticleDiscountablePrice > $ this -> oxdiscount__oxpriceto -> value * $ dRate ) { return false ; } } // oxobject2discount configuration check $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sQ = 'select 1 from oxobject2discount where oxdiscountid = ' . $ oDb -> quote ( $ this -> oxdiscount__oxid -> value ) . ' and oxtype in ("oxarticles", "oxcategories" ) ' ; return ! ( ( bool ) $ oDb -> getOne ( $ sQ ) ) ; }
Checks if discount is setup for whole basket

@param object $oBasket basket object

@return bool
Checks if discount is setup for whole basket