loadLayout(); // header $head = $this->getLayout()->getBlock('head'); $head->setTitle( $this->__("eKomiMeetsMage Configuration")." - meets-ecommerce" ); $this->_setActiveMenu('meecom/ekomimeetsmage'); $url = Mage::helper("adminhtml") ->getUrl("ekomimeetsmage_admin/configuration/index/"); $request = $this->getRequest(); $helper = Mage::helper('ekomimeetsmage'); // Saver for the choosed running type if (strlen($request->getParam('running_mode')) > 0) { if ($request->getParam('running_mode') != $helper->getStoreType()) { // delete all other settings cause of switching $helper->reset(); } $helper->setStoreType( $this->getRequest()->getParam('running_mode') ); } // content $this->_addContent( $this->getLayout()->createBlock( 'ekomimeetsmage/adminhtml_api_configuration_head' ) ); $this->_setCustomHtml( '

'.$this->__("About the eKomiMeetsMage extension").'

'. $this->__( "In order to use this extension an eKomi Account is required.'. 'If you wish to create a new eKomi account, ". "please find the link to the eKomi website below." ). '

'. $this->__("Here you can register an eKomi Account.").'

' ); $this->_addContent( $this->getLayout()->createBlock( 'ekomimeetsmage/adminhtml_api_configuration_form' ) ); $this->_setCustomJs( " document.observe('dom:loaded', function() { $('storetype').observe('change', function(event){ var element = event.element(); location.href='".$url."running_mode/'+element.value+'/'; }); }); " ); $this->_setCustomJs( " document.observe('dom:loaded', function() { $('store_id').observe('change', function(event){ var element = event.element(); if (element.value > 0) { location.href='".$url."store_id/'+element.value+'/'; // alert('".$url."store_id/'+element.value+'/'); } else { location.href='".$url."'; } }); }); " ); // footer $this->_setLogo(); $this->renderLayout(); } public function gridproductviewAction() { $this->loadLayout(); $this->renderLayout(); } /** * Api settings * * @see indexAction */ public function apiAction() { $this->indexAction(); } /** * Save action * */ public function saveAction() { $request = $this->getRequest(); if ($request->isPost()) { $session = Mage::getSingleton('core/session'); $storeId = $request->getPost('store_id'); // Saving process settings $sending = Mage::helper('ekomimeetsmage/mail_sending_process'); $sending->setProcessType( $request->getPost('email_send_type'), $request->getPost('email_send_order_status'), $storeId ); $helper = Mage::helper('ekomimeetsmage'); // Saving logging enabled or not $helper->saveLogging((int)$request->getPost('logging_enabled') == 1); // Enable or disbale google rich snippets $snippets = (int)$request->getPost('google_rich_snippets') == 1; $helper->saveGoogleRichSnippets($snippets, $storeId); $result = Mage::helper('ekomimeetsmage/api_data')->save( trim($request->getPost('ekomi_api_id')), trim($request->getPost('ekomi_api_pw')), $storeId ); if (!is_string($result)) { $session->addSuccess( $this->__("Your API Settings were saved successfully.") ); } else { $session->addError($this->__($result)); } } $this->_redirect("ekomimeetsmage_admin/configuration/index/store_id/".$request->getPost('store_id')."/"); } /** * Sets the logo as image * */ private function _setLogo() { $this->_setCustomHtml( 'powered by meets-ecommerce.de
' ); } /** * Adds custom html * * @param string $html */ private function _setCustomHtml($html) { $block = $this->getLayout()->createBlock( 'meecomframe/adminhtml_general_customhtml' ); $block->setHtml($html); $this->_addContent($block); } /** * Adds custom javascript * * @param string $js */ private function _setCustomJs($js) { $block = $this->getLayout()->createBlock( 'meecomframe/adminhtml_general_customjs' ); $block->setJs($js); $this->_addContent($block); } }