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


PHP DataObject::getCountryRecipient方法代码示例

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


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

示例1: _getAllowedContainers

 /**
  * Get allowed containers of carrier
  *
  * @param \Magento\Framework\DataObject|null $params
  * @return array|bool
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 protected function _getAllowedContainers(\Magento\Framework\DataObject $params = null)
 {
     $containersAll = $this->getContainerTypesAll();
     if (empty($containersAll)) {
         return [];
     }
     if (empty($params)) {
         return $containersAll;
     }
     $containersFilter = $this->getContainerTypesFilter();
     $containersFiltered = [];
     $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:Doability,项目名称:magento2dev,代码行数:50,代码来源:AbstractCarrier.php

示例2: getContentTypes

 /**
  * Return content types of package
  *
  * @param \Magento\Framework\DataObject $params
  * @return array
  */
 public function getContentTypes(\Magento\Framework\DataObject $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:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:15,代码来源:Carrier.php

示例3: getDeliveryConfirmationTypes

 /**
  * Return delivery confirmation types of carrier
  *
  * @param \Magento\Framework\DataObject|null $params
  * @return array|bool
  */
 public function getDeliveryConfirmationTypes(\Magento\Framework\DataObject $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:pradeep-wagento,项目名称:magento2,代码行数:23,代码来源:Carrier.php


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