/** * 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; }
/** * Return XS days * * @return boolean */ public function getXSDays() { $result = 0; if (\XLite\Module\XC\AuctionInc\Main::isXSTrialPeriodValid()) { $firstUsageDate = \XLite\Core\Config::getInstance()->XC->AuctionInc->firstUsageDate; $result = \XLite\Module\XC\AuctionInc\Main::TRIAL_PERIOD_DURATION - (LC_START_TIME - $firstUsageDate); $result = round($result / (60 * 60 * 24)); } return $result; }
/** * 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; }