Example #1
0
 /**
  * Return content types of package
  *
  * @param Varien_Object $params
  * @return array
  */
 public function getContentTypes(Varien_Object $params)
 {
     $countryShipper = $params->getCountryShipper();
     $countryRecipient = $params->getCountryRecipient();
     if ($countryShipper == self::USA_COUNTRY_ID && $countryRecipient != self::USA_COUNTRY_ID) {
         return array('MERCHANDISE' => Mage::helper('usa')->__('Merchandise'), 'SAMPLE' => Mage::helper('usa')->__('Sample'), 'GIFT' => Mage::helper('usa')->__('Gift'), 'DOCUMENTS' => Mage::helper('usa')->__('Documents'), 'RETURN' => Mage::helper('usa')->__('Return'), 'OTHER' => Mage::helper('usa')->__('Other'));
     }
     return array();
 }
Example #2
0
 /**
  * Get allowed containers of carrier
  *
  * @param Varien_Object|null $params
  * @return array|bool
  */
 protected function _getAllowedContainers(Varien_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;
 }
Example #3
0
 /**
  * Return delivery confirmation types of carrier
  *
  * @param Varien_Object|null $params
  * @return array|bool
  */
 public function getDeliveryConfirmationTypes(Varien_Object $params = null)
 {
     $countryRecipient = $params != null ? $params->getCountryRecipient() : null;
     $deliveryConfirmationTypes = array();
     switch ($this->_getDeliveryConfirmationLevel($countryRecipient)) {
         case self::DELIVERY_CONFIRMATION_PACKAGE:
             $deliveryConfirmationTypes = array(1 => Mage::helper('usa')->__('Delivery Confirmation'), 2 => Mage::helper('usa')->__('Signature Required'), 3 => Mage::helper('usa')->__('Adult Signature Required'));
             break;
         case self::DELIVERY_CONFIRMATION_SHIPMENT:
             $deliveryConfirmationTypes = array(1 => Mage::helper('usa')->__('Signature Required'), 2 => Mage::helper('usa')->__('Adult Signature Required'));
     }
     array_unshift($deliveryConfirmationTypes, Mage::helper('usa')->__('Not Required'));
     return $deliveryConfirmationTypes;
 }
Example #4
0
 /**
  * Return delivery confirmation types of carrier
  *
  * @param Varien_Object|null $params
  * @return array|bool
  */
 public function getDeliveryConfirmationTypes(Varien_Object $params = null)
 {
     if ($params == null) {
         return array();
     }
     $countryRecipient = $params->getCountryRecipient();
     $serviceLevel = $this->getDeliveryServiceLevel($countryRecipient);
     if ($serviceLevel == self::DELIVERY_DOMESTIC) {
         return $this->getCode('delivery_conf_types');
     } else {
         return array();
     }
     return array();
 }