Example #1
0
 /**
  * Save configuration
  */
 public function indexAction()
 {
     try {
         if (false == $this->_isSectionAllowed($this->getRequest()->getParam('section'))) {
             throw new Exception($this->_getHelper()->__('This section is not allowed.'));
         }
         // custom save logic
         $this->_saveSection();
         $section = $this->getRequest()->getParam('section');
         $website = $this->getRequest()->getParam('website');
         $store = $this->getRequest()->getParam('store');
         $configData = array('section' => $section, 'website' => $website, 'store' => $store, 'groups' => $this->_getGroupsForSave());
         /** @var Mage_Backend_Model_Config $configModel  */
         $configModel = $this->_configFactory->create(array('data' => $configData));
         $configModel->save();
         // re-init configuration
         $this->_configModel->reinit();
         $this->_eventManager->dispatch('admin_system_config_section_save_after', array('website' => $website, 'store' => $store, 'section' => $section));
         $this->_app->reinitStores();
         // website and store codes can be used in event implementation, so set them as well
         $this->_eventManager->dispatch("admin_system_config_changed_section_{$section}", array('website' => $website, 'store' => $store));
         $this->_session->addSuccess($this->_getHelper()->__('The configuration has been saved.'));
     } catch (Mage_Core_Exception $e) {
         $messages = explode("\n", $e->getMessage());
         foreach ($messages as $message) {
             $this->_session->addError($message);
         }
     } catch (Exception $e) {
         $this->_session->addException($e, $this->_getHelper()->__('An error occurred while saving this configuration:') . ' ' . $e->getMessage());
     }
     $this->_saveState($this->getRequest()->getPost('config_state'));
     $this->_redirect('*/system_config/edit', array('_current' => array('section', 'website', 'store')));
 }
Example #2
0
 /**
  * Enter description here...
  *
  * @return Mage_Backend_Block_System_Config_Form
  */
 protected function _initObjects()
 {
     $this->_configRoot = Mage::getConfig()->getNode(null, $this->getScope(), $this->getScopeCode());
     $this->_configDataObject = $this->_configFactory->create()->setSection($this->getSectionCode())->setWebsite($this->getWebsiteCode())->setStore($this->getStoreCode());
     $this->_configData = $this->_configDataObject->load();
     $this->_defaultFieldsetRenderer = Mage::getBlockSingleton('Mage_Backend_Block_System_Config_Form_Fieldset');
     $this->_defaultFieldRenderer = Mage::getBlockSingleton('Mage_Backend_Block_System_Config_Form_Field');
     return $this;
 }
Example #3
0
 /**
  * Initialize objects required to render config form
  *
  * @return Mage_Backend_Block_System_Config_Form
  */
 protected function _initObjects()
 {
     $this->_configRoot = $this->_coreConfig->getNode(null, $this->getScope(), $this->getScopeCode());
     $this->_configDataObject = $this->_configFactory->create(array('section' => $this->getSectionCode(), 'website' => $this->getWebsiteCode(), 'store' => $this->getStoreCode()));
     $this->_configData = $this->_configDataObject->load();
     $this->_fieldsetRenderer = $this->_fieldsetFactory->create();
     $this->_fieldRenderer = $this->_fieldFactory->create();
     return $this;
 }