Beispiel #1
0
 /**
  * Handle request 
  *
  * @return void
  */
 public function handleRequest()
 {
     if (\XLite\Core\Request::getInstance()->action != 'add' && \XLite\Module\CDev\XPaymentsConnector\Core\Settings::getInstance()->checkUpdateAllowedModules()) {
         \XLite\Module\CDev\XPaymentsConnector\Core\Settings::getInstance()->importAllowedModules();
     }
     parent::handleRequest();
 }
Beispiel #2
0
 /**
  * Get pages templates
  *
  * @return array
  */
 protected function getPageTemplates()
 {
     $list = parent::getPageTemplates();
     foreach ($this->settings->getAllPages() as $page => $title) {
         $list[$page] = 'modules/CDev/XPaymentsConnector/settings/settings.tpl';
     }
     if ($this->isConfigured()) {
         unset($list[$this->settings->getPage('PAGE_WELCOME')]);
     }
     return $list;
 }
Beispiel #3
0
 /**
  * Get editable options
  *
  * @return array
  */
 protected function getEditableOptions()
 {
     $options = parent::getEditableOptions();
     $pageOptions = \XLite\Module\CDev\XPaymentsConnector\Core\Settings::getInstance()->getFieldsForPage(\XLite\Core\Request::getInstance()->page);
     foreach ($options as $key => $option) {
         // Remove options from other pages
         if (!in_array($option->name, $pageOptions)) {
             unset($options[$key]);
         }
     }
     return $options;
 }
Beispiel #4
0
 /**
  * Check and deploy configuration
  *
  * @param string $deployConfig String containing a deployment configuration
  *
  * @return string
  */
 public function deployConfiguration($deployConfig)
 {
     $xpcConfig = $this->getConfiguration($deployConfig);
     $errorMsg = '';
     if (true === $this->checkDeployConfiguration($xpcConfig)) {
         $this->setConfiguration($xpcConfig);
         \XLite\Core\Config::updateInstance();
         if (true !== \XLite\Module\CDev\XPaymentsConnector\Core\Settings::getInstance()->testConnection(false)) {
             $errorMsg = 'Configuration has been deployed, but X-Cart is unable to connect to X-Payments';
         } else {
             $this->importPaymentMethods();
         }
     } else {
         $errorMsg = 'Your configuration string is not correct';
     }
     return $errorMsg;
 }
Beispiel #5
0
 /**
  * Check if widget is visible
  *
  * @return boolean
  */
 protected function isVisible()
 {
     return parent::isVisible() && \XLite\Module\CDev\XPaymentsConnector\Core\Settings::hasPaymentMethods();
 }