src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php
public function ApplyDiscount(TdbShopDiscount $oDiscount)
    {
        $iCurrentPosition = $this->getItemPointer();
        $this->GoToStart();

        $dTotalDiscountValue = 0;
        $bIsAbsoluteDiscount = ('absolut' == $oDiscount->fieldValueType);
        if ($bIsAbsoluteDiscount) {
            $dTotalDiscountValue = $oDiscount->fieldValue;
        }

        $totalDiscountValueItemCalculated = 0;
        while ($oItem = &$this->Next()) {
            if ((!$bIsAbsoluteDiscount || $dTotalDiscountValue > 0) && $oDiscount->AllowDiscountForArticle($oItem)) {
                $oDiscountToPass = clone $oDiscount;
                $oItem->ApplyDiscount($oDiscountToPass, $dTotalDiscountValue);
                $totalDiscountValueItemCalculated += $oDiscountToPass->dRealValueUsed;
            }
        }
        $totalDiscountValueOverAll = $oDiscount->GetValue();
        if ($totalDiscountValueOverAll !== $totalDiscountValueItemCalculated) {
            $missingDiscountValue = $totalDiscountValueOverAll - $totalDiscountValueItemCalculated;
            $this->reducePriceForItemsAffectedByDiscount($oDiscount, $missingDiscountValue);
        }
        $this->setItemPointer($iCurrentPosition);
    }
public function ApplyDiscount(TdbShopDiscount $oDiscount)
    {
        $iCurrentPosition = $this->getItemPointer();
        $this->GoToStart();

        $dTotalDiscountValue = 0;
        $bIsAbsoluteDiscount = ('absolut' == $oDiscount->fieldValueType);
        if ($bIsAbsoluteDiscount) {
            $dTotalDiscountValue = $oDiscount->fieldValue;
        }

        $totalDiscountValueItemCalculated = 0;
        while ($oItem = &$this->Next()) {
            if ((!$bIsAbsoluteDiscount || $dTotalDiscountValue > 0) && $oDiscount->AllowDiscountForArticle($oItem)) {
                $oDiscountToPass = clone $oDiscount;
                $oItem->ApplyDiscount($oDiscountToPass, $dTotalDiscountValue);
                $totalDiscountValueItemCalculated += $oDiscountToPass->dRealValueUsed;
            }
        }
        $totalDiscountValueOverAll = $oDiscount->GetValue();
        if ($totalDiscountValueOverAll !== $totalDiscountValueItemCalculated) {
            $missingDiscountValue = $totalDiscountValueOverAll - $totalDiscountValueItemCalculated;
            $this->reducePriceForItemsAffectedByDiscount($oDiscount, $missingDiscountValue);
        }
        $this->setItemPointer($iCurrentPosition);
    }
public function ApplyDiscount ( TdbShopDiscount $ oDiscount ) { $ iCurrentPosition = $ this -> getItemPointer ( ) ; $ this -> GoToStart ( ) ; $ dTotalDiscountValue = 0 ; $ bIsAbsoluteDiscount = ( 'absolut' == $ oDiscount -> fieldValueType ) ; if ( $ bIsAbsoluteDiscount ) { $ dTotalDiscountValue = $ oDiscount -> fieldValue ; } $ totalDiscountValueItemCalculated = 0 ; while ( $ oItem = & $ this -> Next ( ) ) { if ( ( ! $ bIsAbsoluteDiscount || $ dTotalDiscountValue > 0 ) && $ oDiscount -> AllowDiscountForArticle ( $ oItem ) ) { $ oDiscountToPass = clone $ oDiscount ; $ oItem -> ApplyDiscount ( $ oDiscountToPass , $ dTotalDiscountValue ) ; $ totalDiscountValueItemCalculated += $ oDiscountToPass -> dRealValueUsed ; } } $ totalDiscountValueOverAll = $ oDiscount -> GetValue ( ) ; if ( $ totalDiscountValueOverAll !== $ totalDiscountValueItemCalculated ) { $ missingDiscountValue = $ totalDiscountValueOverAll - $ totalDiscountValueItemCalculated ; $ this -> reducePriceForItemsAffectedByDiscount ( $ oDiscount , $ missingDiscountValue ) ; } $ this -> setItemPointer ( $ iCurrentPosition ) ; }
apply a discount to the basket item list.

@param TdbShopDiscount $oDiscount
apply a discount to the basket item list .