public function getCost($withDiscount = false)
    {
        $cost = 0;
        foreach ($this->_positions as $position) {
            $cost += $position->getCost($withDiscount);
        }
        $costEvent = new CostCalculationEvent([
            'baseCost' => $cost,
        ]);
        $this->trigger(self::EVENT_COST_CALCULATION, $costEvent);
        if ($withDiscount)
            $cost = max(0, $cost - $costEvent->discountValue);
        return $cost;
    }
public function getCost($withDiscount = false)
    {
        $cost = 0;
        foreach ($this->_positions as $position) {
            $cost += $position->getCost($withDiscount);
        }
        $costEvent = new CostCalculationEvent([
            'baseCost' => $cost,
        ]);
        $this->trigger(self::EVENT_COST_CALCULATION, $costEvent);
        if ($withDiscount)
            $cost = max(0, $cost - $costEvent->discountValue);
        return $cost;
    }
public function getCost ( $ withDiscount = false ) { $ cost = 0 ; foreach ( $ this -> _positions as $ position ) { $ cost += $ position -> getCost ( $ withDiscount ) ; } $ costEvent = new CostCalculationEvent ( [ 'baseCost' => $ cost , ] ) ; $ this -> trigger ( self :: EVENT_COST_CALCULATION , $ costEvent ) ; if ( $ withDiscount ) $ cost = max ( 0 , $ cost - $ costEvent -> discountValue ) ; return $ cost ; }
Return full cart cost as a sum of the individual positions costs
@param $withDiscount
@return int
Return full cart cost as a sum of the individual positions costs