当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Shipping_Model_Rate_Request::getAllItems方法代码示例

本文整理汇总了PHP中Mage_Shipping_Model_Rate_Request::getAllItems方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Shipping_Model_Rate_Request::getAllItems方法的具体用法?PHP Mage_Shipping_Model_Rate_Request::getAllItems怎么用?PHP Mage_Shipping_Model_Rate_Request::getAllItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Shipping_Model_Rate_Request的用法示例。


在下文中一共展示了Mage_Shipping_Model_Rate_Request::getAllItems方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: proccessAdditionalValidation

 /**
  * Processing additional validation to check is carrier applicable.
  *
  * @param Mage_Shipping_Model_Rate_Request $request
  * @return Mage_Shipping_Model_Carrier_Abstract|Mage_Shipping_Model_Rate_Result_Error|boolean
  */
 public function proccessAdditionalValidation(Mage_Shipping_Model_Rate_Request $request)
 {
     //Skip by item validation if there is no items in request
     if (!count($request->getAllItems())) {
         return $this;
     }
     $maxAllowedWeight = (double) $this->getConfigData('max_package_weight');
     $errorMsg = '';
     $configErrorMsg = $this->getConfigData('specificerrmsg');
     $defaultErrorMsg = Mage::helper('shipping')->__('The shipping module is not available.');
     $showMethod = $this->getConfigData('showmethod');
     foreach ($request->getAllItems() as $item) {
         if ($item->getProduct() && $item->getProduct()->getId()) {
             if ($item->getProduct()->getWeight() > $maxAllowedWeight) {
                 $errorMsg = $configErrorMsg ? $configErrorMsg : $defaultErrorMsg;
                 break;
             }
         }
     }
     if (!$errorMsg && !$request->getDestPostcode() && $this->isZipCodeRequired()) {
         $errorMsg = Mage::helper('shipping')->__('This shipping method is not available, please specify ZIP-code');
     }
     if ($errorMsg && $showMethod) {
         $error = Mage::getModel('shipping/rate_result_error');
         $error->setCarrier($this->_code);
         $error->setCarrierTitle($this->getConfigData('title'));
         $error->setErrorMessage($errorMsg);
         return $error;
     } elseif ($errorMsg) {
         return false;
     }
     return $this;
 }
开发者ID:codercv,项目名称:urbansurprisedev,代码行数:39,代码来源:Abstract.php

示例2: proccessAdditionalValidation

 /**
  * Processing additional validation to check is carrier applicable.
  *
  * @param Mage_Shipping_Model_Rate_Request $request
  * @return Mage_Shipping_Model_Carrier_Abstract|Mage_Shipping_Model_Rate_Result_Error|boolean
  */
 public function proccessAdditionalValidation(Mage_Shipping_Model_Rate_Request $request)
 {
     //Skip by item validation if there is no items in request
     if (!count($request->getAllItems())) {
         return $this;
     }
     $maxAllowedWeight = (double) $this->getConfigData('max_package_weight');
     $error = null;
     $showMethod = $this->getConfigData('showmethod');
     foreach ($request->getAllItems() as $item) {
         if ($item->getProduct() && $item->getProduct()->getId()) {
             if ($item->getProduct()->getWeight() > $maxAllowedWeight) {
                 $error = Mage::getModel('shipping/rate_result_error');
                 $error->setCarrier($this->_code)->setCarrierTitle($this->getConfigData('title'));
                 $errorMsg = $this->getConfigData('specificerrmsg');
                 $error->setErrorMessage($errorMsg ? $errorMsg : Mage::helper('shipping')->__('The shipping module is not available.'));
                 break;
             }
         }
     }
     if (null !== $error && $showMethod) {
         return $error;
     } elseif (null !== $error) {
         return false;
     }
     return $this;
 }
开发者ID:joebushi,项目名称:magento-mirror,代码行数:33,代码来源:Abstract.php

示例3: collectRates

 public function collectRates(Mage_Shipping_Model_Rate_Request $request)
 {
     if (!$this->getConfigFlag('active')) {
         return false;
     }
     $shippingPrice = 0;
     if ($request->getAllItems()) {
         foreach ($request->getAllItems() as $item) {
             $product = Mage::getModel('catalog/product')->load($item->getProductId());
             if ($product->getTypeId() == 'configurable' || $product->getTypeId() == 'bundle') {
                 continue;
             }
             $shipCost = $product->getShipCost();
             if ($shipCost == null || $shipCost == 0) {
                 $shippingPrice += $item->getQty() * $this->getConfigData('price');
             } else {
                 $shippingPrice += $item->getQty() * $shipCost;
             }
         }
     }
     $result = Mage::getModel('shipping/rate_result');
     if ($shippingPrice !== false) {
         $method = Mage::getModel('shipping/rate_result_method');
         $method->setCarrier('flatrateperproduct');
         $method->setCarrierTitle($this->getConfigData('title'));
         $method->setMethod('flatrateperproduct');
         $method->setMethodTitle($this->getConfigData('name'));
         $method->setPrice($shippingPrice);
         $method->setCost($shippingPrice);
         $result->append($method);
     }
     return $result;
 }
开发者ID:lynxtdc,项目名称:aromaworks,代码行数:33,代码来源:Flatrateperproduct.php

示例4: setRequest

 /**
  * Sets the request with new values where required for shipping calculation
  *
  * @param Mage_Shipping_Model_Rate_Request $request
  */
 public function setRequest(Mage_Shipping_Model_Rate_Request $request)
 {
     $freeShippingOnly = 0;
     $this->oldWeight = $request->getPackageWeight();
     $this->oldQty = $request->getPackageQty();
     $this->oldPrice = $request->getPackageValue();
     $request->setPRConditionName($this->getConfigData('condition_name') ? $this->getConfigData('condition_name') : $this->_default_condition_name);
     $this->_rawRequest = $request;
     //Exclude virtual products price from package value if pre-configured
     if (!$this->getConfigFlag('include_virtual_price') && $request->getAllItems()) {
         foreach ($request->getAllItems() as $item) {
             if ($item->getParentItem()) {
                 continue;
             }
             if ($item->getHasChildren() && $item->isShipSeparately()) {
                 foreach ($item->getChildren() as $child) {
                     if ($child->getProduct()->isVirtual()) {
                         $request->setPackageValue($request->getPackageValue() - $child->getBaseRowTotal());
                     }
                 }
             } elseif ($item->getProduct()->isVirtual()) {
                 $request->setPackageValue($request->getPackageValue() - $item->getBaseRowTotal());
             }
         }
     }
     $this->_rawRequest->setIgnoreFreeItems(false);
 }
开发者ID:FranchuCorraliza,项目名称:magento,代码行数:32,代码来源:Premiumrate.php

示例5: collectRates

 /**
  * Enter description here...
  *
  * @param Mage_Shipping_Model_Rate_Request $data
  * @return Mage_Shipping_Model_Rate_Result
  */
 public function collectRates(Mage_Shipping_Model_Rate_Request $request)
 {
     if (!$this->getConfigFlag('active')) {
         return false;
     }
     $freeBoxes = 0;
     if ($request->getAllItems()) {
         foreach ($request->getAllItems() as $item) {
             if ($item->getProduct()->isVirtual() || $item->getParentItem()) {
                 continue;
             }
             if ($item->getHasChildren() && $item->isShipSeparately()) {
                 foreach ($item->getChildren() as $child) {
                     if ($child->getFreeShipping() && !$child->getProduct()->isVirtual()) {
                         $freeBoxes += $item->getQty() * $child->getQty();
                     }
                 }
             } elseif ($item->getFreeShipping()) {
                 $freeBoxes += $item->getQty();
             }
         }
     }
     $this->setFreeBoxes($freeBoxes);
     $result = Mage::getModel('shipping/rate_result');
     if ($this->getConfigData('type') == 'O') {
         // per order
         $shippingPrice = $this->getConfigData('price');
     } elseif ($this->getConfigData('type') == 'I') {
         // per item
         $shippingPrice = $request->getPackageQty() * $this->getConfigData('price') - $this->getFreeBoxes() * $this->getConfigData('price');
     } else {
         $shippingPrice = false;
     }
     $shippingPrice = $this->getFinalPriceWithHandlingFee($shippingPrice);
     if ($shippingPrice !== false) {
         $method = Mage::getModel('shipping/rate_result_method');
         $method->setCarrier('zabstorepickup');
         $method->setCarrierTitle($this->getConfigData('title'));
         $method->setMethod('storepickup');
         $method->setMethodTitle($this->getConfigData('name'));
         if ($request->getFreeShipping() === true || $request->getPackageQty() == $this->getFreeBoxes()) {
             $shippingPrice = '0.00';
         }
         $method->setPrice($shippingPrice);
         $method->setCost($shippingPrice);
         $address = $this->getAddress();
         $additional = false;
         if ($address) {
             /**@var $address Mage_Customer_Model_Address**/
             $address = $address->format('html');
             $additional = Mage::helper('zab_storepickup')->__("Pickup in:") . "<br/>" . "<address>{$address}</address><br/>";
         }
         if ($this->getConfigData('instruction')) {
             $additional .= $this->getConfigData('instruction');
         }
         $method->setAdditionalInfo($additional);
         $result->append($method);
     }
     return $result;
 }
开发者ID:becchius,项目名称:fiordivaniglia,代码行数:66,代码来源:Storepickup.php

示例6: collectRates

 public function collectRates(Mage_Shipping_Model_Rate_Request $request)
 {
     if (!$this->getConfigFlag('active')) {
         return false;
     }
     $freeBoxes = 0;
     if ($request->getAllItems()) {
         foreach ($request->getAllItems() as $item) {
             if ($item->getFreeShipping() && !$item->getProduct()->isVirtual()) {
                 $freeBoxes += $item->getQty();
             }
         }
     }
     $this->setFreeBoxes($freeBoxes);
     $quoteId = Mage::getSingleton('core/session')->proposal_quote_id;
     if ($quoteId) {
         $price = Mage::app()->getHelper('qquoteadv')->getQquoteShipPriceById($quoteId);
         $result = Mage::getModel('shipping/rate_result');
         /* if ($this->getConfigData('type') == 'O') { // per order
                $shippingPrice = $price;
            } elseif ($this->getConfigData('type') == 'I') { // per item
                $shippingPrice = ($request->getPackageQty() * $price) - ($this->getFreeBoxes() * $price);
            } else {
                $shippingPrice = false;
            }*/
         $type = Mage::app()->getHelper('qquoteadv')->getShipTypeByQuote();
         if ($type == 'O') {
             // per order
             $shippingPrice = $price;
         } elseif ($type == 'I') {
             // per item
             $shippingPrice = $request->getPackageQty() * $price - $this->getFreeBoxes() * $price;
         } else {
             $shippingPrice = false;
         }
         $shippingPrice = $this->getFinalPriceWithHandlingFee($shippingPrice);
         if ($shippingPrice !== false) {
             $method = Mage::getModel('shipping/rate_result_method');
             $method->setCarrier('qquoteshiprate');
             $method->setCarrierTitle($this->getConfigData('title'));
             $method->setMethod('qquoteshiprate');
             if ($type == 'I') {
                 $method->setMethodTitle('Price per Item');
             } else {
                 $method->setMethodTitle($this->getConfigData('name'));
             }
             if ($request->getFreeShipping() === true || $request->getPackageQty() == $this->getFreeBoxes()) {
                 $shippingPrice = '0.00';
             }
             $method->setPrice($shippingPrice);
             $method->setCost($shippingPrice);
             $result->append($method);
         }
         return $result;
     }
     return false;
 }
开发者ID:cnglobal-sl,项目名称:caterez,代码行数:57,代码来源:Qquoteshiprate.php

示例7: collectRates

 /**
  * Enter description here...
  *
  * @param Mage_Shipping_Model_Rate_Request $data
  * @return Mage_Shipping_Model_Rate_Result
  */
 public function collectRates(Mage_Shipping_Model_Rate_Request $request)
 {
     if (!$this->getConfigFlag('active')) {
         return false;
     }
     $freeBoxes = 0;
     if ($request->getAllItems()) {
         foreach ($request->getAllItems() as $item) {
             if ($item->getProduct()->isVirtual() || $item->getParentItem()) {
                 continue;
             }
             if ($item->getHasChildren() && $item->isShipSeparately()) {
                 foreach ($item->getChildren() as $child) {
                     if ($child->getFreeShipping() && !$child->getProduct()->isVirtual()) {
                         $freeBoxes += $item->getQty() * $child->getQty();
                     }
                 }
             } elseif ($item->getFreeShipping()) {
                 $freeBoxes += $item->getQty();
             }
         }
     }
     $this->setFreeBoxes($freeBoxes);
     $result = Mage::getModel('shipping/rate_result');
     if ($this->getConfigData('type') == 'O') {
         // per order
         $shippingPrice = $this->getConfigData('price');
     } elseif ($this->getConfigData('type') == 'I') {
         // per item
         $shippingPrice = $request->getPackageQty() * $this->getConfigData('price') - $this->getFreeBoxes() * $this->getConfigData('price');
     } else {
         $shippingPrice = false;
     }
     $voucher_code = Mage::getSingleton('core/session')->getData('voucher_code');
     $voucher = $this->verify_voucher_code($voucher_code);
     if ($voucher['order_type'] == '3MM') {
         $shippingPrice = 18;
     }
     $shippingPrice = $this->getFinalPriceWithHandlingFee($shippingPrice);
     if ($shippingPrice !== false) {
         $method = Mage::getModel('shipping/rate_result_method');
         $method->setCarrier('flatrate');
         $method->setCarrierTitle($this->getConfigData('title'));
         $method->setMethod('flatrate');
         $method->setMethodTitle($this->getConfigData('name'));
         if ($request->getFreeShipping() === true || $request->getPackageQty() == $this->getFreeBoxes()) {
             $shippingPrice = '0.00';
         }
         $method->setPrice($shippingPrice);
         $method->setCost($shippingPrice);
         $result->append($method);
     }
     return $result;
 }
开发者ID:Rodrifer,项目名称:candyclub,代码行数:60,代码来源:Flatrate.php

示例8: collectRates

 /**
  * Collect and get rates
  *
  * @param Mage_Shipping_Model_Rate_Request $request
  * @return Mage_Shipping_Model_Rate_Result|bool|null
  */
 public function collectRates(Mage_Shipping_Model_Rate_Request $request)
 {
     if (!$this->getConfigFlag('active')) {
         return false;
     }
     $activeForCustomerGroup = Mage::helper('emjainteractive_shippingoption')->isShippingMethodAvailable();
     if (!$activeForCustomerGroup) {
         return false;
     }
     $freeBoxes = 0;
     if ($request->getAllItems()) {
         foreach ($request->getAllItems() as $item) {
             if ($item->getProduct()->isVirtual() || $item->getParentItem()) {
                 continue;
             }
             if ($item->getHasChildren() && $item->isShipSeparately()) {
                 foreach ($item->getChildren() as $child) {
                     if ($child->getFreeShipping() && !$child->getProduct()->isVirtual()) {
                         $freeBoxes += $item->getQty() * $child->getQty();
                     }
                 }
             } elseif ($item->getFreeShipping()) {
                 $freeBoxes += $item->getQty();
             }
         }
     }
     $this->setFreeBoxes($freeBoxes);
     $result = Mage::getModel('shipping/rate_result');
     if ($this->getConfigData('type') == 'O') {
         // per order
         $shippingPrice = $this->getConfigData('price');
     } elseif ($this->getConfigData('type') == 'I') {
         // per item
         $shippingPrice = $request->getPackageQty() * $this->getConfigData('price') - $this->getFreeBoxes() * $this->getConfigData('price');
     } else {
         $shippingPrice = false;
     }
     $shippingPrice = $this->getFinalPriceWithHandlingFee($shippingPrice);
     if ($shippingPrice !== false) {
         $method = Mage::getModel('shipping/rate_result_method');
         $method->setCarrier('umosaco');
         $method->setCarrierTitle($this->getConfigData('title'));
         $method->setMethod('umosaco');
         $method->setMethodTitle($this->getConfigData('name'));
         if ($request->getFreeShipping() === true || $request->getPackageQty() == $this->getFreeBoxes()) {
             $shippingPrice = '0.00';
         }
         $method->setPrice($shippingPrice);
         $method->setCost($shippingPrice);
         $result->append($method);
     }
     return $result;
 }
开发者ID:billadams,项目名称:forever-frame,代码行数:59,代码来源:Umosaco.php

示例9: collectRates

 public function collectRates(Mage_Shipping_Model_Rate_Request $request)
 {
     if (!$this->getConfigFlag('active')) {
         return false;
     }
     $freeBoxes = 0;
     if ($request->getAllItems()) {
         foreach ($request->getAllItems() as $item) {
             if ($item->getProduct()->isVirtual() || $item->getParentItem()) {
                 continue;
             }
             if ($item->getHasChildren() && $item->isShipSeparately()) {
                 foreach ($item->getChildren() as $child) {
                     if ($child->getFreeShipping() && !$child->getProduct()->isVirtual()) {
                         $freeBoxes += $item->getQty() * $child->getQty();
                     }
                 }
             } elseif ($item->getFreeShipping()) {
                 $freeBoxes += $item->getQty();
             }
         }
     }
     $this->setFreeBoxes($freeBoxes);
     $result = Mage::getModel('shipping/rate_result');
     if ($this->getConfigData('type') == 'O') {
         // per order
         $shippingPrice = $this->getConfigData('price');
     } elseif ($this->getConfigData('type') == 'I') {
         // per item
         $shippingPrice = $request->getPackageQty() * $this->getConfigData('price') - $this->getFreeBoxes() * $this->getConfigData('price');
     } else {
         $shippingPrice = false;
     }
     if (Mage_Shipping_Model_Carrier_Abstract::HANDLING_TYPE_PERCENT == $this->getConfigData('shipper_type')) {
         $shippingPrice = $request->getData('base_subtotal_incl_tax') * $shippingPrice / 100;
     }
     $shippingPrice = $this->getFinalPriceWithHandlingFee($shippingPrice);
     if ($shippingPrice !== false) {
         $method = Mage::getModel('shipping/rate_result_method');
         $method->setCarrier('flatrate');
         $method->setCarrierTitle($this->getConfigData('title'));
         $method->setMethod('flatrate');
         $method->setMethodTitle($this->getConfigData('name'));
         if ($request->getFreeShipping() === true || $request->getPackageQty() == $this->getFreeBoxes()) {
             $shippingPrice = '0.00';
         }
         $method->setPrice($shippingPrice);
         $method->setCost($shippingPrice);
         $result->append($method);
     }
     return $result;
 }
开发者ID:GastonDeMarsico,项目名称:improvedshipping,代码行数:52,代码来源:Carrier.php

示例10: collectRates

 public function collectRates(Mage_Shipping_Model_Rate_Request $request)
 {
     if (!$this->getConfigFlag('active')) {
         return false;
     }
     $freeBoxes = 0;
     $removeWeight = 0;
     if ($request->getAllItems()) {
         foreach ($request->getAllItems() as $item) {
             if ($item->getFreeShipping() && !$item->getProduct()->getTypeInstance()->isVirtual()) {
                 $freeBoxes += $item->getQty();
                 $removeWeight += $item->getWeight() * $item->getQty();
             }
         }
     }
     $this->setFreeBoxes($freeBoxes);
     $result = Mage::getModel('shipping/rate_result');
     if (count($this->getAllowedMethods()) > 0) {
         foreach ($this->getAllowedMethods() as $key => $value) {
             $obj = Mage::getModel("royalmail/shipping_carrier_royalmail_{$key}");
             if ($obj === false) {
                 Mage::log("Error loading royal mail: {$key}");
                 continue;
             }
             $obj->setWeightUnit($this->getConfigData('weight_unit'));
             $obj->setNegativeWeight($removeWeight);
             $cost = $obj->getCost($request);
             if ($cost !== null) {
                 $method = Mage::getModel('shipping/rate_result_method');
                 $method->setCarrier($this->_code);
                 $method->setCarrierTitle($this->getConfigData('title'));
                 $method->setMethod($key);
                 $method->setMethodTitle($value);
                 if ($request->getFreeShipping() === true || $request->getPackageQty() == $this->getFreeBoxes()) {
                     $price = '0.00';
                 } else {
                     $price = $this->_performRounding($this->getFinalPriceWithHandlingFee($cost));
                 }
                 $method->setPrice($price);
                 $method->setCost($price);
                 $result->append($method);
                 if ($price == '0.00') {
                     break;
                     // No more free methods
                 }
             }
         }
     }
     return $result;
 }
开发者ID:JGMAgency,项目名称:royalmail,代码行数:50,代码来源:Royalmail.php

示例11: collectRates

 /**
  * @param Mage_Shipping_Model_Rate_Request $request
  * @return Mage_Shipping_Model_Rate_Result
  */
 public function collectRates(Mage_Shipping_Model_Rate_Request $request)
 {
     /** @var Mage_Shipping_Model_Rate_Result $result */
     $result = Mage::getModel('shipping/rate_result');
     $totalWeight = 0;
     foreach ($request->getAllItems() as $item) {
         $totalWeight += $item->getWeight() * $item->getQty();
     }
     /** @var string $hostname */
     $hostname = $this->getConfigData('hostname');
     /** @var string $port */
     $port = $this->getConfigData('port');
     try {
         $client = new Zend_Http_Client();
         $response = $client->setUri("http://{$hostname}:{$port}/")->setRawData(json_encode(['totalWeight' => $totalWeight]))->setEncType('application/json')->request('POST');
         switch ($response->getStatus()) {
             case 200:
                 $responseBody = json_decode($response->getBody());
                 $result->append($this->_getShippingMethod($responseBody->rate));
                 break;
             case 500:
                 // Handle 500 Error
                 break;
             default:
         }
     } catch (Exception $e) {
         var_dump($e);
     }
     return $result;
 }
开发者ID:sraleci,项目名称:ba-shipping-method,代码行数:34,代码来源:Carrier.php

示例12: collectRates

 public function collectRates(Mage_Shipping_Model_Rate_Request $request)
 {
     $result = Mage::getModel('shipping/rate_result');
     /* @var $result Mage_Shipping_Model_Rate_Result */
     $result->append($this->_getStandardShippingRate());
     $expressWeightThreshold = $this->getConfigData('express_weight_threshold');
     $eligibleForExpressDelivery = true;
     foreach ($request->getAllItems() as $_item) {
         if ($_item->getWeight() > $expressWeightThreshold) {
             $eligibleForExpressDelivery = false;
         }
     }
     if ($eligibleForExpressDelivery) {
         $result->append($this->_getExpressShippingRate());
     }
     if ($request->getFreeShipping()) {
         /**
          *  If the request has the free shipping flag,
          *  append a free shipping rate to the result.
          */
         $freeShippingRate = $this->_getFreeShippingRate();
         $result->append($freeShippingRate);
     }
     return $result;
 }
开发者ID:juliasagayda,项目名称:magento,代码行数:25,代码来源:Carrier.php

示例13: collectRates

 public function collectRates(Mage_Shipping_Model_Rate_Request $request)
 {
     $result = Mage::getModel('shipping/rate_result');
     foreach ($request->getAllItems() as $item) {
     }
     $result->append($this->_getStandardRate());
     return $result;
 }
开发者ID:cabrerabywaters,项目名称:magentoSunshine,代码行数:8,代码来源:Webposshipping.php

示例14: hasFreightItems

 protected function hasFreightItems(Mage_Shipping_Model_Rate_Request $request)
 {
     $items = $request->getAllItems();
     foreach ($items as $item) {
         $product = Mage::getModel('catalog/product')->loadByAttribute('entity_id', $item->getProductId(), 'freight_class');
         $freightClass = $product->getData('freight_class');
         if (!empty($freightClass) && $freightClass != "") {
             return true;
         }
     }
     return false;
 }
开发者ID:htecvc2x,项目名称:htecvc2x-mage-training,代码行数:12,代码来源:Shipping.php

示例15: collectRates

 public function collectRates(Mage_Shipping_Model_Rate_Request $request)
 {
     if (!$this->getConfigFlag('active')) {
         return false;
     }
     $freeBoxes = 0;
     if ($request->getAllItems()) {
         foreach ($request->getAllItems() as $item) {
             if ($item->getFreeShipping() && !$item->getProduct()->isVirtual()) {
                 $freeBoxes += $item->getQty();
             }
         }
     }
     $this->setFreeBoxes($freeBoxes);
     $result = Mage::getModel('shipping/rate_result');
     if ($this->getConfigData('type') == 'O') {
         // per order
         $shippingPrice = $this->getConfigData('price');
     } elseif ($this->getConfigData('type') == 'I') {
         // per item
         $shippingPrice = $request->getPackageQty() * $this->getConfigData('price') - $this->getFreeBoxes() * $this->getConfigData('price');
     } else {
         $shippingPrice = false;
     }
     $shippingPrice = $this->getFinalPriceWithHandlingFee($shippingPrice);
     if ($shippingPrice !== false) {
         $method = Mage::getModel('shipping/rate_result_method');
         $method->setCarrier($this->_code);
         $method->setCarrierTitle($this->getConfigData('title'));
         $method->setMethod($this->_code);
         $method->setMethodTitle($this->getConfigData('name'));
         if ($request->getFreeShipping() === true || $request->getPackageQty() == $this->getFreeBoxes()) {
             $shippingPrice = '0.00';
         }
         $method->setPrice($shippingPrice);
         $method->setCost($shippingPrice);
         $result->append($method);
     }
     return $result;
 }
开发者ID:RapidCommerceBV,项目名称:MagentoStorePickup,代码行数:40,代码来源:Storeforpickup.php


注:本文中的Mage_Shipping_Model_Rate_Request::getAllItems方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。