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


PHP Mage_Shipping_Model_Rate_Request::getDhlShipmentType方法代码示例

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


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

示例1: setRequest

 public function setRequest(Mage_Shipping_Model_Rate_Request $request)
 {
     $this->_request = $request;
     $r = new Varien_Object();
     $r->setStoreId($request->getStoreId());
     if ($request->getLimitMethod()) {
         $r->setService($request->getLimitMethod());
     }
     if ($request->getDhlId()) {
         $id = $request->getDhlId();
     } else {
         $id = $this->getConfigData('id');
     }
     $r->setId($id);
     if ($request->getDhlPassword()) {
         $password = $request->getDhlPassword();
     } else {
         $password = $this->getConfigData('password');
     }
     $r->setPassword($password);
     if ($request->getDhlAccount()) {
         $accountNbr = $request->getDhlAccount();
     } else {
         $accountNbr = $this->getConfigData('account');
     }
     $r->setAccountNbr($accountNbr);
     if ($request->getDhlShippingKey()) {
         $shippingKey = $request->getDhlShippingKey();
     } else {
         $shippingKey = $this->getConfigData('shipping_key');
     }
     $r->setShippingKey($shippingKey);
     if ($request->getDhlShippingIntlKey()) {
         $shippingKey = $request->getDhlShippingIntlKey();
     } else {
         $shippingKey = $this->getConfigData('shipping_intlkey');
     }
     $r->setShippingIntlKey($shippingKey);
     if ($request->getDhlShipmentType()) {
         $shipmentType = $request->getDhlShipmentType();
     } else {
         $shipmentType = $this->getConfigData('shipment_type');
     }
     $r->setShipmentType($shipmentType);
     if ($request->getDhlDutiable()) {
         $shipmentDutible = $request->getDhlDutiable();
     } else {
         $shipmentDutible = $this->getConfigData('dutiable');
     }
     $r->setDutiable($shipmentDutible);
     if ($request->getDhlDutyPaymentType()) {
         $dutypaytype = $request->getDhlDutyPaymentType();
     } else {
         $dutypaytype = $this->getConfigData('dutypaymenttype');
     }
     $r->setDutyPaymentType($dutypaytype);
     if ($request->getDhlContentDesc()) {
         $contentdesc = $request->getDhlContentDesc();
     } else {
         $contentdesc = $this->getConfigData('contentdesc');
     }
     $r->setContentDesc($contentdesc);
     if ($request->getDestPostcode()) {
         $r->setDestPostal($request->getDestPostcode());
     }
     if ($request->getOrigCountry()) {
         $origCountry = $request->getOrigCountry();
     } else {
         $origCountry = Mage::getStoreConfig('shipping/origin/country_id', $this->getStore());
     }
     $r->setOrigCountry($origCountry);
     /*
      * DHL only accepts weight as a whole number. Maximum length is 3 digits.
      */
     $weight = $this->getTotalNumOfBoxes($request->getPackageWeight());
     $shippingWeight = round(max(1, $weight), 0);
     $r->setValue(round($request->getPackageValue(), 2));
     $r->setValueWithDiscount($request->getPackageValueWithDiscount());
     $r->setDestStreet(Mage::helper('core/string')->substr($request->getDestStreet(), 0, 35));
     $r->setDestCity($request->getDestCity());
     if ($request->getDestCountryId()) {
         $destCountry = $request->getDestCountryId();
     } else {
         $destCountry = self::USA_COUNTRY_ID;
     }
     //for DHL, puero rico state for US will assume as puerto rico country
     //for puerto rico, dhl will ship as international
     if ($destCountry == self::USA_COUNTRY_ID && ($request->getDestPostcode() == '00912' || $request->getDestRegionCode() == self::PUERTORICO_COUNTRY_ID)) {
         $destCountry = self::PUERTORICO_COUNTRY_ID;
     }
     $r->setDestCountryId($destCountry);
     $r->setDestState($request->getDestRegionCode());
     $r->setWeight($shippingWeight);
     $r->setFreeMethodWeight($request->getFreeMethodWeight());
     $this->_rawRequest = $r;
     //        $methods = explode(',', $this->getConfigData('allowed_methods'));
     //
     //        $freeMethod = $this->getConfigData('free_method');
     //
     //        $internationcode = $this->getCode('international_searvice');
//.........这里部分代码省略.........
开发者ID:HelioFreitas,项目名称:magento-pt_br,代码行数:101,代码来源:Dhl.php

示例2: process

 public function process(Mage_Shipping_Model_Rate_Request $request)
 {
     $this->_request = $request;
     $r = new Varien_Object();
     if ($request->getLimitMethod()) {
         $r->setService($request->getLimitMethod());
     }
     if ($request->getDhlId()) {
         $id = $request->getDhlId();
     } else {
         $id = $this->getConfigData('id');
     }
     $r->setId($id);
     if ($request->getDhlPassword()) {
         $password = $request->getDhlPassword();
     } else {
         $password = $this->getConfigData('password');
     }
     $r->setPassword($password);
     if ($request->getDhlAccount()) {
         $accountNbr = $request->getDhlAccount();
     } else {
         $accountNbr = $this->getConfigData('account');
     }
     $r->setAccountNbr($accountNbr);
     if ($request->getDhlShippingKey()) {
         $shippingKey = $request->getDhlShippingKey();
     } else {
         $shippingKey = $this->getConfigData('shipping_key');
     }
     $r->setShippingKey($shippingKey);
     if ($request->getDhlShippingIntlKey()) {
         $shippingKey = $request->getDhlShippingIntlKey();
     } else {
         $shippingKey = $this->getConfigData('shipping_intlkey');
     }
     $r->setShippingIntlKey($shippingKey);
     if ($request->getDhlShipmentType()) {
         $shipmentType = $request->getDhlShipmentType();
     } else {
         $shipmentType = $this->getConfigData('shipment_type');
     }
     $r->setShipmentType($shipmentType);
     if ($request->getDhlDutiable()) {
         $shipmentDutible = $request->getDhlDutiable();
     } else {
         $shipmentDutible = $this->getConfigData('dutiable');
     }
     $r->setDutiable($shipmentDutible);
     if ($request->getDhlDutyPaymentType()) {
         $dutypaytype = $request->getDhlDutyPaymentType();
     } else {
         $dutypaytype = $this->getConfigData('dutypaymenttype');
     }
     $r->setDutyPaymentType($dutypaytype);
     if ($request->getDhlContentDesc()) {
         $contentdesc = $request->getDhlContentDesc();
     } else {
         $contentdesc = $this->getConfigData('contentdesc');
     }
     $r->setContentDesc($contentdesc);
     if ($request->getDestPostcode()) {
         $r->setDestPostal($request->getDestPostcode());
     }
     if ($request->getOrigCountry()) {
         $origCountry = $request->getOrigCountry();
     } else {
         $origCountry = Mage::getStoreConfig('shipping/origin/country_id', $this->getStore());
     }
     $r->setOrigCountry($origCountry);
     /*
      * DHL only accepts weight as a whole number. Maximum length is 3 digits.
      */
     $shippingWeight = round(min(1, $request->getPackageWeight()), 0);
     $freeMethodWeight = round(min(1, $request->getFreeMethodWeight()), 0);
     $r->setValue(round($request->getPackageValue(), 2));
     $r->setDestStreet(substr($request->getDestStreet(), 0, 35));
     $r->setDestCity($request->getDestCity());
     $r->setDestCountryId($request->getDestCountryId());
     $r->setDestState($request->getDestRegionCode());
     $this->_rawRequest = $r;
     $methods = explode(',', $this->getConfigData('allowed_methods'));
     $freeMethod = $this->getConfigData('free_method');
     $internationcode = $this->getCode('international_searvice');
     foreach ($methods as $method) {
         if ($method == $internationcode && $r->getDestCountryId() != self::USA_COUNTRY_ID || $method != $internationcode && $r->getDestCountryId() == self::USA_COUNTRY_ID) {
             $weight = $freeMethod == $method ? $freeMethodWeight : $shippingWeight;
             if ($weight > 0) {
                 $this->_rawRequest->setWeight($weight);
                 $this->_rawRequest->setService($method);
                 $this->_getQuotes();
             } else {
                 $this->_dhlRates[$method] = array('term' => $this->getCode('service', $method), 'price_total' => 0);
             }
         }
     }
     return $this;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:98,代码来源:Dhl.php


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