src/FlatRate.php
public function calculate($aShippableItems, $oBasket)
    {
        $iCostPerItem = (int) $this->getSetting('iCostPerItem') ?: 0;
        $iItemCount   = 0;
        foreach ($aShippableItems as $oItem) {
            $iItemCount += $oItem->quantity;
        }
        return $iItemCount * $iCostPerItem;
    }
public function calculate($aShippableItems, $oBasket)
    {
        $iCostPerItem = (int) $this->getSetting('iCostPerItem') ?: 0;
        $iItemCount   = 0;
        foreach ($aShippableItems as $oItem) {
            $iItemCount += $oItem->quantity;
        }
        return $iItemCount * $iCostPerItem;
    }
public function calculate ( $ aShippableItems , $ oBasket ) { $ iCostPerItem = ( int ) $ this -> getSetting ( 'iCostPerItem' ) ? : 0 ; $ iItemCount = 0 ; foreach ( $ aShippableItems as $ oItem ) { $ iItemCount += $ oItem -> quantity ; } return $ iItemCount * $ iCostPerItem ; }
Calculates the cost of shipping all shippable items in a basket
@param  array    $aShippableItems An array of all items which are shippable (i.e., product type `is_physical` and is not `collect_only`)
@param  stdClass $oBasket         The complete basket object, used to grab the basket's total value.
@return integer
Calculates the cost of shipping all shippable items in a basket