示例#1
0
 public function config()
 {
     $config = mainConfiguration::getInstance();
     $regedit = regedit::getInstance();
     $params = array('emarket-options' => array('int:max_compare_items' => NULL, 'boolean:currency' => NULL, 'boolean:currency' => NULL, 'boolean:stores' => NULL, 'boolean:payment' => NULL, 'boolean:delivery' => NULL, 'boolean:discounts' => NULL, 'boolean:delivery-with-address' => NULL, 'string:header-phone-number' => NULL));
     $mode = (string) getRequest('param0');
     if ($mode == "do") {
         $params = $this->expectParams($params);
         $max_comp =& $params['emarket-options']['int:max_compare_items'];
         $max_comp = floor($max_comp);
         if (!$max_comp || $max_comp <= 1) {
             $config->set('modules', 'emarket.compare.max-items', 2);
             def_module::errorNewMessage("%error-compare-wrong-data%");
             def_module::errorPanic();
         }
         $config->set('modules', 'emarket.compare.max-items', $params['emarket-options']['int:max_compare_items']);
         $regedit->setVar('//modules/emarket/enable-discounts', $params['emarket-options']['boolean:discounts']);
         $regedit->setVar('//modules/emarket/enable-currency', $params['emarket-options']['boolean:currency']);
         $regedit->setVar('//modules/emarket/enable-stores', $params['emarket-options']['boolean:stores']);
         $regedit->setVar('//modules/emarket/enable-payment', $params['emarket-options']['boolean:payment']);
         $regedit->setVar('//modules/emarket/enable-delivery', $params['emarket-options']['boolean:delivery']);
         $regedit->setVar('//modules/emarket/delivery-with-address', $params['emarket-options']['boolean:delivery-with-address']);
         $regedit->setVar('//modules/emarket/header-phone-number', $params['emarket-options']['string:header-phone-number']);
         self::switchGroupsActivity('order_delivery_props', $params['emarket-options']['boolean:delivery']);
         self::switchGroupsActivity('order_discount_props', $params['emarket-options']['boolean:discounts']);
         self::switchGroupsActivity('order_payment_props', $params['emarket-options']['boolean:payment']);
         $this->chooseRedirect();
     }
     $params['emarket-options']['int:max_compare_items'] = $config->get('modules', 'emarket.compare.max-items');
     $params['emarket-options']['boolean:discounts'] = $regedit->getVal('//modules/emarket/enable-discounts');
     $params['emarket-options']['boolean:currency'] = $regedit->getVal('//modules/emarket/enable-currency');
     $params['emarket-options']['boolean:stores'] = $regedit->getVal('//modules/emarket/enable-stores');
     $params['emarket-options']['boolean:payment'] = $regedit->getVal('//modules/emarket/enable-payment');
     $params['emarket-options']['boolean:delivery'] = $regedit->getVal('//modules/emarket/enable-delivery');
     $params['emarket-options']['boolean:delivery-with-address'] = $regedit->getVal('//modules/emarket/delivery-with-address');
     $params['emarket-options']['string:header-phone-number'] = $regedit->getVal('//modules/emarket/header-phone-number');
     $this->setDataType('settings');
     $this->setActionType('modify');
     $data = $this->prepareData($params, 'settings');
     $this->setData($data);
     return $this->doData();
 }