/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * Get form field by option * * @param \XLite\Model\Config $option Option * * @return array */ protected function getFormFieldByOption(\XLite\Model\Config $option) { $cell = parent::getFormFieldByOption($option); switch ($option->getName()) { case 'trialEnabled': case 'entryPointSeparator': case 'entryPointDHL': case 'DHLAccessKey': case 'entryPointFEDEX': case 'entryPointUPS': case 'entryPointUSPS': $cell[static::SCHEMA_DEPENDENCY] = array(static::DEPENDENCY_SHOW => array('accountId' => array(''))); break; case 'fallbackRateValue': $cell[static::SCHEMA_DEPENDENCY] = array(static::DEPENDENCY_SHOW => array('fallbackRate' => array('I', 'O'))); break; case 'package': case 'insurable': $cell[static::SCHEMA_DEPENDENCY] = array(static::DEPENDENCY_SHOW => array('calculationMethod' => array('C'))); break; case 'fixedFeeMode': $cell[static::SCHEMA_DEPENDENCY] = array(static::DEPENDENCY_SHOW => array('calculationMethod' => array('F'))); break; case 'fixedFeeCode': $cell[static::SCHEMA_DEPENDENCY] = array(static::DEPENDENCY_SHOW => array('calculationMethod' => array('F'), 'fixedFeeMode' => array('C'))); break; case 'fixedFee1': case 'fixedFee2': $cell[static::SCHEMA_DEPENDENCY] = array(static::DEPENDENCY_SHOW => array('calculationMethod' => array('F'), 'fixedFeeMode' => array('F'))); break; } if ($option->getName() == 'trialEnabled') { if (!\XLite\Module\XC\AuctionInc\Main::isXSTrialPeriodValid()) { $cell[static::SCHEMA_VALUE] = false; $cell[\XLite\View\FormField\Input\Checkbox\OnOff::PARAM_DISABLED] = true; } } return $cell; }
/** * 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; }
/** * Returns header reference code * * @return string */ protected function getHeaderReferenceCode() { return \XLite\Module\XC\AuctionInc\Main::getHeaderReferenceCode(); }
/** * Get current country code * * @return string */ public function getCarrier() { $carrier = parent::getCarrier(); return 'auctionInc' !== $carrier || !\XLite\Module\XC\AuctionInc\Main::isSSAvailable() ? $carrier : 'offline'; }
/** * Check if SS available * * @return boolean */ protected function isSSAvailable() { return \XLite\Module\XC\AuctionInc\Main::isSSAvailable(); }
/** * 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; }
/** * Returns url for sign up * * @return string */ public function getSettingsURL() { return \XLite\Module\XC\AuctionInc\Main::getSettingsForm(); }