Exemplo n.º 1
0
 /**
  * Return params list to use for search
  *
  * @return \XLite\Core\CommonCell
  */
 protected function getSearchCondition()
 {
     $result = parent::getSearchCondition();
     $carrierParam = \XLite\Model\Repo\Shipping\Method::P_CARRIER;
     if (!empty($result->{$carrierParam}) && 'auctionInc' == $result->{$carrierParam} && \XLite\Module\XC\AuctionInc\Main::isSSAvailable()) {
         $result->{$carrierParam} = '';
     }
     if (!empty($result->{$carrierParam}) && 'auctionInc' == $result->{$carrierParam}) {
         $filter = array();
         $filter[] = 'FF%';
         $filter[] = 'NOCHG%';
         // UPS Next Day Air Early AM is a commercial only service.
         // Rather than ask you to implement differential code based
         // on the module Residential setting, lets just eliminate
         // this service method for the XS trial.
         $filter[] = 'UPS_UPSNDE';
         // The two “Saturday” services have special handling in AuctionInc.
         // It would be best just to eliminate these two service methods as well for the XS trial
         $filter[] = 'FEDEX_FDXPOS';
         $filter[] = 'UPS_UPSNDAS';
         foreach (array('DHL', 'FEDEX', 'UPS', 'USPS') as $carrier) {
             $entryPoint = \XLite\Core\Config::getInstance()->XC->AuctionInc->{'entryPoint' . $carrier};
             if (\XLite\Module\XC\AuctionInc\View\FormField\Select\AEntryPoint::STATE_DISABLED == $entryPoint) {
                 $filter[] = $carrier . '%';
             }
         }
         $result->{\XLite\Model\Repo\Shipping\Method::P_AUCTION_INC_FILTER} = $filter;
     }
     return $result;
 }
 /**
  * Get default options for selector
  *
  * @return array
  */
 protected function getDefaultOptions()
 {
     $result = array('' => 'Select', 'F' => 'Fee');
     if (\XLite\Module\XC\AuctionInc\Main::isSSAvailable()) {
         $result['C'] = 'Code';
     }
     return $result;
 }
Exemplo n.º 3
0
 /**
  * Returns the list of related targets
  *
  * @return array
  */
 protected function getAvailableSchemaFields()
 {
     $result = array(static::SCHEMA_FIELD_WEIGHT, static::SCHEMA_FIELD_SUBTOTAL, static::SCHEMA_FIELD_DIMENSIONS, static::SCHEMA_FIELD_DST_COUNTRY, static::SCHEMA_FIELD_DST_STATE, static::SCHEMA_FIELD_DST_ZIPCODE, static::SCHEMA_FIELD_DST_TYPE);
     if (!\XLite\Module\XC\AuctionInc\Main::isSSAvailable()) {
         $result = array_merge($result, array(static::SCHEMA_FIELD_SRC_COUNTRY, static::SCHEMA_FIELD_SRC_STATE, static::SCHEMA_FIELD_SRC_ZIPCODE));
     }
     return $result;
 }
Exemplo n.º 4
0
 /**
  * Check if method status is switchable
  *
  * @return boolean
  */
 protected function isSwitchable()
 {
     $result = parent::isSwitchable();
     if ($result && 'auctionInc' === $this->getMethod()->getProcessor()) {
         $result = \XLite\Module\XC\AuctionInc\Main::isSSAvailable() || \XLite\Module\XC\AuctionInc\Main::isXSTrialPeriodValid();
     }
     return $result;
 }
Exemplo n.º 5
0
 /**
  * Returns a list of shipping processors
  *
  * @return array
  */
 public function getShippingProcessors()
 {
     $list = parent::getShippingProcessors();
     /** @var \XLite\Model\Shipping\Processor\AProcessor $processor */
     foreach ($list as $key => $processor) {
         if ('auctionInc' == $processor->getProcessorId() && \XLite\Module\XC\AuctionInc\Main::isSSAvailable()) {
             unset($list[$key]);
         }
     }
     return $list;
 }
Exemplo n.º 6
0
 /**
  * getFieldBySchema
  *
  * @param string $name Field name
  * @param array  $data Field description
  *
  * @return \XLite\View\FormField\AFormField
  */
 protected function getFieldBySchema($name, array $data)
 {
     return 'originCode' != $name || \XLite\Module\XC\AuctionInc\Main::isSSAvailable() ? parent::getFieldBySchema($name, $data) : null;
 }
Exemplo n.º 7
0
 /**
  * Returns rates array parsed from response
  *
  * @param array $response
  *
  * @return array
  */
 protected function parseResponse($response)
 {
     $rates = array();
     if (isset($response['ShipRate'])) {
         foreach ($response['ShipRate'] as $responseRate) {
             // UPS Next Day Air Early AM is a commercial only service.
             // Rather than ask you to implement differential code based
             // on the module Residential setting, lets just eliminate
             // this service method for the XS trial.
             // The two “Saturday” services have special handling in AuctionInc.
             // It would be best just to eliminate these two service methods as well for the XS trial
             $code = $responseRate['CarrierCode'] . '_' . $responseRate['ServiceCode'];
             if (!\XLite\Module\XC\AuctionInc\Main::isSSAvailable() && in_array($code, array('UPS_UPSNDE', 'FEDEX_FDXPOS', 'UPS_UPSNDAS'))) {
                 continue;
             }
             $rate = new \XLite\Model\Shipping\Rate();
             $rate->setBaseRate($responseRate['Rate']);
             $extraData = new \XLite\Core\CommonCell(array('auctionIncPackage' => $responseRate['PackageDetail']));
             $rate->setExtraData($extraData);
             $method = $this->findMethod($responseRate['CarrierCode'], $responseRate['ServiceCode'], $responseRate['ServiceName']);
             if ($method && (\XLite\Module\XC\AuctionInc\Main::isSSAvailable() || $method->getEnabled())) {
                 $rate->setMethod($method);
                 $rates[] = $rate;
             }
         }
     }
     return $rates;
 }
Exemplo n.º 8
0
 /**
  * Get current country code
  *
  * @return string
  */
 public function getCarrier()
 {
     $carrier = parent::getCarrier();
     return 'auctionInc' !== $carrier || !\XLite\Module\XC\AuctionInc\Main::isSSAvailable() ? $carrier : 'offline';
 }
Exemplo n.º 9
0
 /**
  * Check if SS available
  *
  * @return boolean
  */
 protected function isSSAvailable()
 {
     return \XLite\Module\XC\AuctionInc\Main::isSSAvailable();
 }
Exemplo n.º 10
0
 /**
  * Get schema of an array for test rates routine
  *
  * @return array
  */
 protected function getTestRatesSchema()
 {
     $schema = parent::getTestRatesSchema();
     unset($schema['srcAddress']['city'], $schema['dstAddress']['city'], $schema['cod_enabled']);
     $schema['dimensions'] = 'dimensions';
     if (\XLite\Module\XC\AuctionInc\Main::isSSAvailable()) {
         unset($schema['srcAddress']);
     }
     return $schema;
 }