addFieldset( 'storetype_choose', array('legend' => $this->getEkomiHelper()->__("Choose your eKomi running type")) ); $fieldset->addField( 'storetype', 'select', array( 'name' => 'storetype', 'title' => $this->__('Running type'), 'label' => $this->__('Running type'), 'required' => true, 'value' => $ekomiData->getStoreType(), 'values' => $this->getEkomiHelper()->getStoreTypeOptionsArray(), 'after_element_html' => '
'.$this->__( "Description:". "
- Single Store: one eKomi account for all stores.". "
- Multi Store: each store will use its own eKomi account.". "

Changing the running type after the initial setup will result in the deletion of all data.". " All data will have to get imported again.", "Description:
- Single Store: one eKomi account for all stores.". "
- Multi Store: each store will use its own eKomi account.". "

Changing the running type after the initial setup will result in the deletion of all data.". " All data will have to get imported again." ).'
', ) ); } private function _account_overview($form, $account) { $fieldset = $form->addFieldset( 'account_overview', array('legend' => $this->getEkomiHelper()->__("eKomi Account Details")) ); $fieldset->addField( 'ekomi_account_name', 'note', array( 'name' => 'account_name', 'title' => 'account_name', 'required' => false, 'label' => $this->__("eKomi's Account Name"), 'text' => $account["info"]["account_name"], ) ); $html = ""; $html .= "
"; $html .= "
"; $html .= "
"; $html .= "
"; $fieldset->addField( 'ekomi_rating_avg', 'note', array( 'name' => 'rating_avg', 'title' => 'rating_avg', 'required' => false, 'label' => $this->__("eKomi's Feedback Average"), 'text' => $html, ) ); } private function _api_configuration($form, $data) { $fieldset = $form->addFieldset( 'api_configuration', array('legend' => $this->getEkomiHelper()->__("eKomi API Configuration")) ); $fieldset->addField( 'ekomi_api_id', 'text', array( 'name' => 'ekomi_api_id', 'title' => $this->__('Your eKomi API ID'), 'label' => $this->__('Your eKomi API ID'), 'required' => true, 'value' => $data['api_id'], 'after_element_html' => '
'. $this->__("You can find the eKomi API ID in your eKomi Customer Interface.").'', ) ); // Password for eKomi API $fieldset->addField( 'ekomi_api_pw', 'text', array( 'name' => 'ekomi_api_pw', 'title' => $this->__('Your eKomi API Password'), 'label' => $this->__('Your eKomi API Password'), 'required' => true, 'value' => $data['api_pass'], 'after_element_html' => '
'. $this->__("You can find the eKomi API Password in your eKomi Customer Interface.").'', ) ); // Check for API Connection $status = ''; if ($data["api_status"]==1) { $status = ' '. $this->__('Verified').' '; } else { $status = ' '. $this->__('Not Verified').' '; } $fieldset->addField( 'ekomi_api_status', 'note', array( 'name' => 'status', 'title' => 'status', 'required' => false, 'label' => $this->__("API Connection Status"), 'text' => $status, ) ); } private function _sending_process($form, $storeId) { /* @var $sendingProcess MeetsEcommerce_Ekomimeetsmage_Helper_Mail_Sending_Process */ $sendingProcess = Mage::helper('ekomimeetsmage/mail_sending_process'); $processType = $sendingProcess->getProcessType($storeId); $processStatus = $sendingProcess->getProcessStatus($storeId); $fieldset = $form->addFieldset( 'sending_process', array('legend' => $this->getEkomiHelper()->__("E-Mail Sending Process")) ); $withStatus = in_array( $processType, array( MeetsEcommerce_Ekomimeetsmage_Model_Rating_Email_Type::TYPE_BY_STATUS, MeetsEcommerce_Ekomimeetsmage_Model_Rating_Email_Type::TYPE_BY_DATE_AND_STATUS ) ); $fieldset->addField( 'email_sending_type', 'select', array( 'name' => 'email_send_type', 'title' => $this->getEkomiHelper()->__('When we should send out the rating e-mail?'), 'label' => $this->getEkomiHelper()->__('Which rating e-mail send type?'), 'required' => true, 'values' => Mage::getModel('ekomimeetsmage/rating_email_type')->toOptionsArray(), 'value' => $processType, 'after_element_html' => $this->_getJsForHidingOrderStatus($withStatus) ) ); $fieldset->addField( 'email_sending_status', 'select', array( 'name' => 'email_send_order_status', 'title' => $this->__('On which status we should send the rating e-mail?'), 'label' => $this->__('Order status to send out?'), 'required' => true, 'value' => $processStatus, 'values' => $sendingProcess->getOrderStatusAsOptionsArray() ) ); } private function _futher_settings($form, $storeId) { $fieldset = $form->addFieldset( 'futher_settings', array('legend' => $this->getEkomiHelper()->__("Further Settings")) ); $fieldset->addField( 'logging_enabled', 'select', array( 'name' => 'logging_enabled', 'title' => $this->getEkomiHelper()->__('Should we log?'), 'label' => $this->getEkomiHelper()->__('Should we log?'), 'required' => true, 'values' => array( 0 => $this->getEkomiHelper()->__("Logging disabled"), 1 => $this->getEkomiHelper()->__("Logging enabled") ), 'value' => (($this->getEkomiHelper()->isLogging()) ? 1 : 0), 'after_element_html' => '
'.$this->__( "You can set logging on or off. You will find the log file in var/log/ekomimeetsmage.log." ).'', ) ); /* $fieldset->addField( 'google_rich_snippets', 'select', array( 'name' => 'google_rich_snippets', 'title' => $this->getEkomiHelper()->__("Google's Rich Snippets"), 'label' => $this->getEkomiHelper()->__("Google's Rich Snippets"), 'required' => true, 'values' => array( 0 => $this->getEkomiHelper()->__("Disabled"), 1 => $this->getEkomiHelper()->__("Enabled") ), 'value' => (($this->getEkomiHelper()->isGoogleRichSnippets($storeId)) ? 1 : 0), 'after_element_html' => '
'.$this->__( "Here you can enable or disable Google's Rich Snippets.". "
Google's Rich Snippets is enabled on the product view page." ).'
', ) ); */ } protected function _prepareForm() { $form = new Varien_Data_Form(); $form->setMethod('post'); $form->setUseContainer(true); $form->setId('ekomimeetsmage_configuration'); $form->setAction($this->getUrl('*/*/save')); $ekomiData = Mage::helper('ekomimeetsmage'); $this->_storetype_choose($form, $ekomiData); if (strlen($ekomiData->getStoreType()) > 0) { $storeId = $this->getRequest()->getParam('store_id'); $data = Mage::helper('ekomimeetsmage/api_data')->fetch($storeId); if ($ekomiData->getStoreType()=="multistore") { $fieldset = $form->addFieldset( 'store_choose', array('legend' => $this->getEkomiHelper()->__("Choose your Store")) ); $fieldset->addField( 'store_id', 'select', array( 'name' => 'store_id', 'title' => $this->__('Choose your store'), 'label' => $this->__('Choose your store'), 'required' => true, 'value' => $storeId, 'values' => Mage::helper('meecomframe/store')->getOptionsArray(), ) ); if (!($storeId > 0)) { $this->setForm($form); return false; } } if ($data["api_status"] == 1) { $account = Mage::getModel('ekomimeetsmage/api')->getAccountInfo($storeId); $this->_account_overview($form, $account); } // User for eKomi API $this->_api_configuration($form, $data); // Sending type for the emails $this->_sending_process($form, $storeId); $this->_futher_settings($form, $storeId); } $this->setForm($form); } /** * Returns the js for the hiding of order status * * @param boolean $show */ private function _getJsForHidingOrderStatus($show=false) { return " "; } private function getEkomiHelper() { if ($this->_helper === NULL) { $this->_helper = Mage::helper('ekomimeetsmage'); } return $this->_helper; } }