當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Object::getCountryRecipient方法代碼示例

本文整理匯總了PHP中Magento\Framework\Object::getCountryRecipient方法的典型用法代碼示例。如果您正苦於以下問題:PHP Object::getCountryRecipient方法的具體用法?PHP Object::getCountryRecipient怎麽用?PHP Object::getCountryRecipient使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Framework\Object的用法示例。


在下文中一共展示了Object::getCountryRecipient方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getDeliveryConfirmationTypes

 /**
  * Return delivery confirmation types of carrier
  *
  * @param \Magento\Framework\Object|null $params
  * @return array|bool
  */
 public function getDeliveryConfirmationTypes(\Magento\Framework\Object $params = null)
 {
     $countryRecipient = $params != null ? $params->getCountryRecipient() : null;
     $deliveryConfirmationTypes = [];
     switch ($this->_getDeliveryConfirmationLevel($countryRecipient)) {
         case self::DELIVERY_CONFIRMATION_PACKAGE:
             $deliveryConfirmationTypes = [1 => __('Delivery Confirmation'), 2 => __('Signature Required'), 3 => __('Adult Signature Required')];
             break;
         case self::DELIVERY_CONFIRMATION_SHIPMENT:
             $deliveryConfirmationTypes = [1 => __('Signature Required'), 2 => __('Adult Signature Required')];
             break;
         default:
             break;
     }
     array_unshift($deliveryConfirmationTypes, __('Not Required'));
     return $deliveryConfirmationTypes;
 }
開發者ID:opexsw,項目名稱:magento2,代碼行數:23,代碼來源:Carrier.php

示例2: getContentTypes

 /**
  * Return content types of package
  *
  * @param \Magento\Framework\Object $params
  * @return array
  */
 public function getContentTypes(\Magento\Framework\Object $params)
 {
     $countryShipper = $params->getCountryShipper();
     $countryRecipient = $params->getCountryRecipient();
     if ($countryShipper == self::USA_COUNTRY_ID && $countryRecipient != self::USA_COUNTRY_ID) {
         return ['MERCHANDISE' => __('Merchandise'), 'SAMPLE' => __('Sample'), 'GIFT' => __('Gift'), 'DOCUMENTS' => __('Documents'), 'RETURN' => __('Return'), 'OTHER' => __('Other')];
     }
     return [];
 }
開發者ID:Coplex,項目名稱:magento2,代碼行數:15,代碼來源:Carrier.php

示例3: _getAllowedContainers

 /**
  * Get allowed containers of carrier
  *
  * @param \Magento\Framework\Object|null $params
  * @return array|bool
  */
 protected function _getAllowedContainers(\Magento\Framework\Object $params = null)
 {
     $containersAll = $this->getContainerTypesAll();
     if (empty($containersAll)) {
         return array();
     }
     if (empty($params)) {
         return $containersAll;
     }
     $containersFilter = $this->getContainerTypesFilter();
     $containersFiltered = array();
     $method = $params->getMethod();
     $countryShipper = $params->getCountryShipper();
     $countryRecipient = $params->getCountryRecipient();
     if (empty($containersFilter)) {
         return $containersAll;
     }
     if (!$params || !$method || !$countryShipper || !$countryRecipient) {
         return $containersAll;
     }
     if ($countryShipper == self::USA_COUNTRY_ID && $countryRecipient == self::USA_COUNTRY_ID) {
         $direction = 'within_us';
     } else {
         if ($countryShipper == self::USA_COUNTRY_ID && $countryRecipient != self::USA_COUNTRY_ID) {
             $direction = 'from_us';
         } else {
             return $containersAll;
         }
     }
     foreach ($containersFilter as $dataItem) {
         $containers = $dataItem['containers'];
         $filters = $dataItem['filters'];
         if (!empty($filters[$direction]['method']) && in_array($method, $filters[$direction]['method'])) {
             foreach ($containers as $container) {
                 if (!empty($containersAll[$container])) {
                     $containersFiltered[$container] = $containersAll[$container];
                 }
             }
         }
     }
     return !empty($containersFiltered) ? $containersFiltered : $containersAll;
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:48,代碼來源:AbstractCarrier.php


注:本文中的Magento\Framework\Object::getCountryRecipient方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。