/** * 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 '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', 'CI'))); 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; } return $cell; }
/** * Retrieve property from the model object * * @param mixed $name Field/property name * * @return mixed */ protected function getModelObjectValue($name) { $value = parent::getModelObjectValue($name); if ('dimensions' === $name) { $value = unserialize($value); } return $value; }
/** * Get editable options * * @return array */ protected function getEditableOptions() { $list = parent::getEditableOptions(); foreach ($list as $k => $option) { if ('cod_status' === $option->getName()) { unset($list[$k]); } } return $list; }
/** * Return list of the "Button" widgets * * @return array */ protected function getFormButtons() { $result = array(); $buttons = parent::getFormButtons(); $submit = $buttons['submit']; unset($buttons['submit']); $config = \XLite\Core\Config::getInstance()->CDev->AustraliaPost; if ($config->optionValues) { $result['submit'] = $submit; $url = $this->buildURL('aupost', 'renew_settings'); $result['module_settings'] = new \XLite\View\Button\ProgressState(array(\XLite\View\Button\AButton::PARAM_LABEL => 'Renew available settings', \XLite\View\Button\AButton::PARAM_STYLE => 'action always-enabled', \XLite\View\Button\Regular::PARAM_JS_CODE => 'self.location=\'' . $url . '\'')); } else { $url = $this->buildURL('aupost', 'renew_settings'); $result['module_settings'] = new \XLite\View\Button\ProgressState(array(\XLite\View\Button\AButton::PARAM_LABEL => 'Get module settings', \XLite\View\Button\AButton::PARAM_BTN_TYPE => 'regular-main-button', \XLite\View\Button\AButton::PARAM_STYLE => 'action always-enabled', \XLite\View\Button\Regular::PARAM_JS_CODE => 'self.location=\'' . $url . '\'')); } return $result + $buttons; }
/** * Get editable options * * @return array */ protected function getEditableOptions() { $list = parent::getEditableOptions(); $unEditableOptions = array('cod_status', 'currency_code'); foreach ($list as $k => $option) { if (in_array($option->getName(), $unEditableOptions, true)) { unset($list[$k]); } } return $list; }
/** * Retrieve property from the model object * * @param mixed $name Field/property name * * @return mixed */ protected function getModelObjectValue($name) { $value = parent::getModelObjectValue($name); if ($this->isCountriesSelector($name)) { $value = unserialize($value); } return $value; }