示例#1
0
 public function getFinalPriceWithHandlingFee($cost)
 {
     if (!Mage::getStoreConfig('shipping/shipusa/active')) {
         return parent::getFinalPriceWithHandlingFee($cost);
     }
     $handlingFee = $this->getConfigData('handling_fee');
     if (!is_numeric($handlingFee) || $handlingFee <= 0) {
         return $cost;
     }
     $finalMethodPrice = 0;
     $handlingType = $this->getConfigData('handling_type');
     if (!$handlingType) {
         $handlingType = self::HANDLING_TYPE_FIXED;
     }
     $handlingAction = $this->getConfigData('handling_action');
     if (!$handlingAction) {
         $handlingAction = self::HANDLING_ACTION_PERORDER;
     }
     if ($handlingAction == self::HANDLING_ACTION_PERPACKAGE) {
         if ($handlingType == self::HANDLING_TYPE_PERCENT) {
             $finalMethodPrice = $cost + $cost * $handlingFee / 100;
         } else {
             $finalMethodPrice = $cost + $handlingFee * $this->_numBoxes;
         }
     } else {
         if ($handlingType == self::HANDLING_TYPE_PERCENT) {
             $finalMethodPrice = $cost + $cost * $handlingFee / 100;
         } else {
             $finalMethodPrice = $cost + $handlingFee;
         }
     }
     $finalMethodPrice = ceil($finalMethodPrice * 100) / 100;
     if ($this->getDebugFlag()) {
         Mage::helper('wsalogger/log')->postInfo('usashipping', 'Inbuilt UPS Handling Fee', $finalMethodPrice - $cost);
     }
     return $finalMethodPrice;
 }