Beispiel #1
0
 /**
  * Return true if processor match to the current carrier
  *
  * @param \XLite\Model\Shipping\Processor\AProcessor $processor Shipping processor object
  *
  * @return boolean
  */
 protected function isActiveCarrier($processor)
 {
     $carrier = $this->getCarrier();
     return $carrier == $processor->getProcessorId() || empty($carrier) && 'offline' == $processor->getProcessorId();
 }
Beispiel #2
0
 /**
  * Get processor methods
  *
  * @param \XLite\Model\Shipping\Processor\AProcessor $processor Processor
  *
  * @return \XLite\Model\Shipping\Method
  */
 protected function getProcessorMethods(\XLite\Model\Shipping\Processor\AProcessor $processor)
 {
     return $processor->getShippingMethods();
 }
Beispiel #3
0
 /**
  * Get package limits
  *
  * @return array
  */
 protected function getPackageLimits()
 {
     $limits = parent::getPackageLimits();
     $config = \XLite\Core\Config::getInstance()->CDev->USPS;
     $limits['weight'] = $config->max_weight;
     $limits['length'] = $config->length;
     $limits['width'] = $config->width;
     $limits['height'] = $config->height;
     return $limits;
 }
Beispiel #4
0
 /**
  * Add api communication message
  *
  * @param string $message API communication log message
  *
  * @return void
  */
 protected function addApiCommunicationMessage($message)
 {
     if (!empty($message['request_data'])) {
         $message['request_data'] = var_export($message['request_data'], true);
     }
     if (!empty($message['response'])) {
         $message['response'] = htmlentities($message['response']);
     }
     parent::addApiCommunicationMessage($message);
 }
Beispiel #5
0
 /**
  * Get rates from processor
  *
  * @param \XLite\Model\Shipping\Processor\AProcessor $processor Processor
  * @param \XLite\Logic\Order\Modifier\Shipping       $modifier  Modifier
  *
  * @return array
  */
 protected function getProcessorRates($processor, $modifier)
 {
     return $processor->getRates($modifier);
 }
Beispiel #6
0
 /**
  * Get package limits
  *
  * @return array
  */
 protected function getPackageLimits()
 {
     $limits = parent::getPackageLimits();
     $config = $this->getConfig();
     // Weight in store weight units
     $limits['weight'] = \XLite\Core\Converter::convertWeightUnits($config->max_weight, 'kg', \XLite\Core\Config::getInstance()->Units->weight_unit);
     $limits['length'] = $config->length;
     $limits['width'] = $config->width;
     $limits['height'] = $config->height;
     return $limits;
 }
Beispiel #7
0
 /**
  * Add api communication message
  *
  * @param string $message API communication log message
  *
  * @return void
  */
 protected function addApiCommunicationMessage($message)
 {
     if (!empty($message['request_data'])) {
         $message['request_data'] = htmlentities($this->filterRequestData($message['request_data']));
     }
     if (!empty($message['response'])) {
         $message['response'] = htmlentities(\XLite\Core\XML::getInstance()->getFormattedXML($message['response']));
     }
     parent::addApiCommunicationMessage($message);
 }
Beispiel #8
0
 /**
  * Get package limits
  *
  * @return array
  */
 protected function getPackageLimits()
 {
     $limits = parent::getPackageLimits();
     $upsOptions = \XLite\Core\Config::getInstance()->XC->UPS;
     $limits['weight'] = $upsOptions->max_weight;
     $limits['length'] = $upsOptions->length;
     $limits['width'] = $upsOptions->width;
     $limits['height'] = $upsOptions->height;
     return $limits;
 }
Beispiel #9
0
 /**
  * Get key hash (to use this for caching rates)
  *
  * @param string $key Key value
  *
  * @return string
  */
 protected function getKeyHash($key)
 {
     $key = preg_replace('/<v13:ShipTimestamp>.+<\\/v13:ShipTimestamp>/i', '', $key);
     return parent::getKeyHash($key);
 }
Beispiel #10
0
 /**
  * Get package limits
  *
  * @return array
  */
 protected function getPackageLimits()
 {
     $limits = parent::getPackageLimits();
     $config = \XLite\Core\Config::getInstance()->CDev->AustraliaPost;
     // Weight in store weight units
     $limits['weight'] = \XLite\Core\Converter::convertWeightUnits($config->max_weight, 'kg', \XLite\Core\Config::getInstance()->Units->weight_unit);
     list($limits['length'], $limits['width'], $limits['height']) = $this->getAuspostPackageSizes();
     return $limits;
 }
Beispiel #11
0
 /**
  * Sort function for sorting processors by class
  *
  * @param \XLite\Model\Shipping\Processor\AProcessor $a First processor
  * @param \XLite\Model\Shipping\Processor\AProcessor $b Second processor
  *
  * @return integer
  */
 protected function compareProcessors($a, $b)
 {
     $bottomProcessorId = 'offline';
     $a1 = $a->getProcessorId();
     $b1 = $b->getProcessorId();
     if ($a1 == $bottomProcessorId) {
         $result = 1;
     } elseif ($b1 == $bottomProcessorId) {
         $result = -1;
     } else {
         $result = strcasecmp($a1, $b1);
     }
     return $result;
 }