source/Application/Model/Basket.php
protected function _calcItemsPrice()
    {
        // resetting
        $this->setSkipDiscounts(false);
        $this->_iProductsCnt = 0; // count different types
        $this->_dItemsCnt = 0; // count of item units
        $this->_dWeight = 0; // basket weight

        $this->_oProductsPriceList = oxNew(\OxidEsales\Eshop\Core\PriceList::class);
        $this->_oDiscountProductsPriceList = oxNew(\OxidEsales\Eshop\Core\PriceList::class);
        $this->_oNotDiscountedProductsPriceList = oxNew(\OxidEsales\Eshop\Core\PriceList::class);

        $oDiscountList = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\DiscountList::class);

        /** @var \oxBasketItem $oBasketItem */
        foreach ($this->_aBasketContents as $oBasketItem) {
            $this->_iProductsCnt++;
            $this->_dItemsCnt += $oBasketItem->getAmount();
            $this->_dWeight += $oBasketItem->getWeight();

            if (!$oBasketItem->isDiscountArticle() && ($oArticle = $oBasketItem->getArticle(true))) {
                $oBasketPrice = $oArticle->getBasketPrice($oBasketItem->getAmount(), $oBasketItem->getSelList(), $this);
                $oBasketItem->setRegularUnitPrice(clone $oBasketPrice);

                if (!$oArticle->skipDiscounts() && $this->canCalcDiscounts()) {
                    // apply basket type discounts for item
                    $aDiscounts = $oDiscountList->getBasketItemDiscounts($oArticle, $this, $this->getBasketUser());
                    reset($aDiscounts);
                    /** @var \oxDiscount $oDiscount */
                    foreach ($aDiscounts as $oDiscount) {
                        $oBasketPrice->setDiscount($oDiscount->getAddSum(), $oDiscount->getAddSumType());
                    }
                    $oBasketPrice->calculateDiscount();
                } else {
                    $oBasketItem->setSkipDiscounts(true);
                    $this->setSkipDiscounts(true);
                }

                $oBasketItem->setPrice($oBasketPrice);
                $this->_oProductsPriceList->addToPriceList($oBasketItem->getPrice());

                //P collect discount values for basket items which are discountable
                if (!$oArticle->skipDiscounts()) {
                    $this->_oDiscountProductsPriceList->addToPriceList($oBasketItem->getPrice());
                } else {
                    $this->_oNotDiscountedProductsPriceList->addToPriceList($oBasketItem->getPrice());
                    $oBasketItem->setSkipDiscounts(true);
                    $this->setSkipDiscounts(true);
                }
            } elseif ($oBasketItem->isBundle()) {
                // if bundles price is set to zero
                $oPrice = oxNew(\OxidEsales\Eshop\Core\Price::class);
                $oBasketItem->setPrice($oPrice);
            }
        }
    }
protected function _calcItemsPrice()
    {
        // resetting
        $this->setSkipDiscounts(false);
        $this->_iProductsCnt = 0; // count different types
        $this->_dItemsCnt = 0; // count of item units
        $this->_dWeight = 0; // basket weight

        $this->_oProductsPriceList = oxNew(\OxidEsales\Eshop\Core\PriceList::class);
        $this->_oDiscountProductsPriceList = oxNew(\OxidEsales\Eshop\Core\PriceList::class);
        $this->_oNotDiscountedProductsPriceList = oxNew(\OxidEsales\Eshop\Core\PriceList::class);

        $oDiscountList = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\DiscountList::class);

        /** @var \oxBasketItem $oBasketItem */
        foreach ($this->_aBasketContents as $oBasketItem) {
            $this->_iProductsCnt++;
            $this->_dItemsCnt += $oBasketItem->getAmount();
            $this->_dWeight += $oBasketItem->getWeight();

            if (!$oBasketItem->isDiscountArticle() && ($oArticle = $oBasketItem->getArticle(true))) {
                $oBasketPrice = $oArticle->getBasketPrice($oBasketItem->getAmount(), $oBasketItem->getSelList(), $this);
                $oBasketItem->setRegularUnitPrice(clone $oBasketPrice);

                if (!$oArticle->skipDiscounts() && $this->canCalcDiscounts()) {
                    // apply basket type discounts for item
                    $aDiscounts = $oDiscountList->getBasketItemDiscounts($oArticle, $this, $this->getBasketUser());
                    reset($aDiscounts);
                    /** @var \oxDiscount $oDiscount */
                    foreach ($aDiscounts as $oDiscount) {
                        $oBasketPrice->setDiscount($oDiscount->getAddSum(), $oDiscount->getAddSumType());
                    }
                    $oBasketPrice->calculateDiscount();
                } else {
                    $oBasketItem->setSkipDiscounts(true);
                    $this->setSkipDiscounts(true);
                }

                $oBasketItem->setPrice($oBasketPrice);
                $this->_oProductsPriceList->addToPriceList($oBasketItem->getPrice());

                //P collect discount values for basket items which are discountable
                if (!$oArticle->skipDiscounts()) {
                    $this->_oDiscountProductsPriceList->addToPriceList($oBasketItem->getPrice());
                } else {
                    $this->_oNotDiscountedProductsPriceList->addToPriceList($oBasketItem->getPrice());
                    $oBasketItem->setSkipDiscounts(true);
                    $this->setSkipDiscounts(true);
                }
            } elseif ($oBasketItem->isBundle()) {
                // if bundles price is set to zero
                $oPrice = oxNew(\OxidEsales\Eshop\Core\Price::class);
                $oBasketItem->setPrice($oPrice);
            }
        }
    }
protected function _calcItemsPrice ( ) { // resetting $ this -> setSkipDiscounts ( false ) ; $ this -> _iProductsCnt = 0 ; // count different types $ this -> _dItemsCnt = 0 ; // count of item units $ this -> _dWeight = 0 ; // basket weight $ this -> _oProductsPriceList = oxNew ( \ OxidEsales \ Eshop \ Core \ PriceList :: class ) ; $ this -> _oDiscountProductsPriceList = oxNew ( \ OxidEsales \ Eshop \ Core \ PriceList :: class ) ; $ this -> _oNotDiscountedProductsPriceList = oxNew ( \ OxidEsales \ Eshop \ Core \ PriceList :: class ) ; $ oDiscountList = \ OxidEsales \ Eshop \ Core \ Registry :: get ( \ OxidEsales \ Eshop \ Application \ Model \ DiscountList :: class ) ; /** @var \oxBasketItem $oBasketItem */ foreach ( $ this -> _aBasketContents as $ oBasketItem ) { $ this -> _iProductsCnt ++ ; $ this -> _dItemsCnt += $ oBasketItem -> getAmount ( ) ; $ this -> _dWeight += $ oBasketItem -> getWeight ( ) ; if ( ! $ oBasketItem -> isDiscountArticle ( ) && ( $ oArticle = $ oBasketItem -> getArticle ( true ) ) ) { $ oBasketPrice = $ oArticle -> getBasketPrice ( $ oBasketItem -> getAmount ( ) , $ oBasketItem -> getSelList ( ) , $ this ) ; $ oBasketItem -> setRegularUnitPrice ( clone $ oBasketPrice ) ; if ( ! $ oArticle -> skipDiscounts ( ) && $ this -> canCalcDiscounts ( ) ) { // apply basket type discounts for item $ aDiscounts = $ oDiscountList -> getBasketItemDiscounts ( $ oArticle , $ this , $ this -> getBasketUser ( ) ) ; reset ( $ aDiscounts ) ; /** @var \oxDiscount $oDiscount */ foreach ( $ aDiscounts as $ oDiscount ) { $ oBasketPrice -> setDiscount ( $ oDiscount -> getAddSum ( ) , $ oDiscount -> getAddSumType ( ) ) ; } $ oBasketPrice -> calculateDiscount ( ) ; } else { $ oBasketItem -> setSkipDiscounts ( true ) ; $ this -> setSkipDiscounts ( true ) ; } $ oBasketItem -> setPrice ( $ oBasketPrice ) ; $ this -> _oProductsPriceList -> addToPriceList ( $ oBasketItem -> getPrice ( ) ) ; //P collect discount values for basket items which are discountable if ( ! $ oArticle -> skipDiscounts ( ) ) { $ this -> _oDiscountProductsPriceList -> addToPriceList ( $ oBasketItem -> getPrice ( ) ) ; } else { $ this -> _oNotDiscountedProductsPriceList -> addToPriceList ( $ oBasketItem -> getPrice ( ) ) ; $ oBasketItem -> setSkipDiscounts ( true ) ; $ this -> setSkipDiscounts ( true ) ; } } elseif ( $ oBasketItem -> isBundle ( ) ) { // if bundles price is set to zero $ oPrice = oxNew ( \ OxidEsales \ Eshop \ Core \ Price :: class ) ; $ oBasketItem -> setPrice ( $ oPrice ) ; } } }
Iterates through basket items and calculates its prices and discounts
Iterates through basket items and calculates its prices and discounts