Example #1
0
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form();
     $this->setForm($form);
     $this->setTemplate('xtento/orderexport/output.phtml');
     return parent::_prepareForm();
 }
Example #2
0
 protected function _prepareForm()
 {
     $model = Mage::registry('order_export_profile');
     // Set default values
     if (!$model->getId()) {
     }
     $form = new Varien_Data_Form();
     $this->setForm($form);
     $fieldset = $form->addFieldset('field_settings', array('legend' => Mage::helper('xtento_orderexport')->__('Export Fields'), 'class' => 'fieldset-wide'));
     $fieldset->addField('field_note', 'note', array('text' => Mage::helper('xtento_orderexport')->__('<strong>Important</strong>: Please save the profile after modifying the fields available for export, as otherwise you won\'t see any effect when testing the output format or retrieving the fields available for export.')));
     $exportFieldsArray = array();
     $exportData = Mage::getModel('xtento_orderexport/export_data')->getExportData(Mage::registry('order_export_profile')->getEntity(), false, true);
     foreach ($exportData as $exportField) {
         $label = $exportField['configuration']['name'];
         if (!empty($exportField['configuration']['description']) || isset($exportField['configuration']['third_party']) && $exportField['configuration']['third_party'] === TRUE) {
             $label .= '<br><small>(';
             if (!empty($exportField['configuration']['description'])) {
                 $label .= 'Description: ' . $exportField['configuration']['description'];
             }
             if (isset($exportField['configuration']['third_party']) && $exportField['configuration']['third_party'] === TRUE) {
                 $label .= ' | Third-party module: <strong>Yes</strong>';
             }
             $label .= ')</small>';
         }
         $exportFieldsArray[$exportField['configuration']['category']][] = array('value' => $exportField['class_identifier'], 'label' => Mage::helper('xtento_orderexport')->__($label));
     }
     foreach ($exportFieldsArray as $categoryName => $exportFields) {
         $this->_array_sort_by_column($exportFields, 'label');
         $fieldset->addField(strtolower($categoryName), 'checkboxes', array('label' => Mage::helper('xtento_orderexport')->__($categoryName), 'name' => 'export_fields[]', 'values' => $exportFields, 'checked' => $this->_getCheckedExportFields($exportFields), 'value' => $this->_getCheckedExportFields($exportFields), 'note' => $this->_getCategoryNote($categoryName)));
     }
     #$form->setValues($model->getData());
     return parent::_prepareForm();
 }
Example #3
0
 protected function _prepareForm()
 {
     $model = Mage::registry('order_export_profile');
     $form = new Varien_Data_Form();
     $this->setForm($form);
     $fieldset = $form->addFieldset('manual_fieldset', array('legend' => Mage::helper('xtento_orderexport')->__('Manual Export Settings'), 'class' => 'fieldset-wide'));
     $fieldset->addField('manual_export_enabled', 'select', array('label' => Mage::helper('xtento_orderexport')->__('Manual Export enabled'), 'name' => 'manual_export_enabled', 'values' => Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray(), 'note' => Mage::helper('xtento_orderexport')->__('If set to "No", this profile won\'t show up for manual exports at Sales > Sales Export > Manual Export.')));
     $fieldset->addField('save_files_manual_export', 'select', array('label' => Mage::helper('xtento_orderexport')->__('Save files on destinations for manual exports'), 'name' => 'save_files_manual_export', 'values' => Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray(), 'note' => Mage::helper('xtento_orderexport')->__('Do you want to save exported files on the configured export destinations when exporting manually? Or do you just want them to be saved on the configured export destinations for automatic exports?')));
     $fieldset->addField('start_download_manual_export', 'select', array('label' => Mage::helper('xtento_orderexport')->__('Serve files to browser after exporting manually'), 'name' => 'start_download_manual_export', 'values' => Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray(), 'note' => Mage::helper('xtento_orderexport')->__('When exporting manually from the grid or "Manual Export" screen, if set to "Yes", the exported file will be served to the browser automatically after exporting. Ultimately this is controlled whether you check the "Serve file to browser after exporting" checkbox on the manual export screen or not.')));
     $form->setValues($model->getData());
     $this->setForm($form);
     return parent::_prepareForm();
 }
Example #4
0
 protected function _prepareForm()
 {
     $model = Mage::registry('order_export_profile');
     $form = new Varien_Data_Form();
     $this->setForm($form);
     $fieldset = $form->addFieldset('cronjob_fieldset', array('legend' => Mage::helper('xtento_orderexport')->__('Cronjob Export'), 'class' => 'fieldset-wide'));
     $fieldset->addField('cronjob_note', 'note', array('text' => Mage::helper('xtento_orderexport')->__('<strong>Important</strong>: To use cron job exports, please make sure the Magento cronjob has been set up as explained <a href="http://support.xtento.com/wiki/Setting_up_the_Magento_cronjob" target="_blank">here</a>.')));
     if (Mage::helper('xtcore/utils')->isCronRunning()) {
         $model->setCronjobStatus(Mage::helper('xtento_orderexport')->__("Cron seems to be running properly. Seconds since last execution: %d", time() - Mage::helper('xtcore/utils')->getLastCronExecution()));
         $note = '';
     } else {
         if (time() - Mage::helper('xtcore/data')->getInstallationDate() > 60 * 30) {
             // Module was not installed within the last 30 minutes
             if (Mage::helper('xtcore/utils')->getLastCronExecution() == '') {
                 $model->setCronjobStatus(Mage::helper('xtento_orderexport')->__("Cron.php doesn't seem to be set up at all. Cron did not execute within the last 15 minutes."));
                 $note = Mage::helper('xtento_orderexport')->__('Please make sure to set up the cronjob as explained <a href="http://support.xtento.com/wiki/Setting_up_the_Magento_cronjob" target="_blank">here</a> and check the cron status 15 minutes after setting up the cronjob properly again.');
             } else {
                 $model->setCronjobStatus(Mage::helper('xtento_orderexport')->__("Cron.php doesn't seem to be set up properly. Cron did not execute within the last 15 minutes."));
                 $note = Mage::helper('xtento_orderexport')->__('Please make sure to set up the cronjob as explained <a href="http://support.xtento.com/wiki/Setting_up_the_Magento_cronjob" target="_blank">here</a> and check the cron status 15 minutes after setting up the cronjob properly again.');
             }
         } else {
             $model->setCronjobStatus(Mage::helper('xtento_orderexport')->__("Cron status wasn't checked yet. Please check back in 30 minutes."));
             $note = Mage::helper('xtento_orderexport')->__('Please make sure to set up the cronjob as explained <a href="http://support.xtento.com/wiki/Setting_up_the_Magento_cronjob" target="_blank">here</a> and check the cron status 15 minutes after setting up the cronjob properly again.');
         }
     }
     $fieldset->addField('cronjob_status', 'text', array('label' => Mage::helper('xtento_orderexport')->__('Cronjob Status'), 'name' => 'cronjob_status', 'disabled' => true, 'note' => $note, 'value' => $model->getCronjobStatus()));
     $fieldset->addField('cronjob_enabled', 'select', array('label' => Mage::helper('xtento_orderexport')->__('Enable Cronjob Export'), 'name' => 'cronjob_enabled', 'values' => Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray()));
     $fieldset->addField('cronjob_frequency', 'select', array('label' => Mage::helper('xtento_orderexport')->__('Export Frequency'), 'name' => 'cronjob_frequency', 'values' => Mage::getModel('xtento_orderexport/system_config_source_cron_frequency')->toOptionArray(), 'note' => Mage::helper('xtento_orderexport')->__('How often should the export be executed?')));
     $fieldset->addField('cronjob_custom_frequency', 'text', array('label' => Mage::helper('xtento_orderexport')->__('Custom Export Frequency'), 'name' => 'cronjob_custom_frequency', 'note' => Mage::helper('xtento_orderexport')->__('A custom cron expression can be entered here. Make sure to set "Cronjob Frequency" to "Use custom frequency" if you want to enter a custom cron expression here. To set up multiple cronjobs, separate multiple cron expressions by a semi-colon ; Example: */5 * * * *;0 3 * * * '), 'class' => 'validate-cron', 'after_element_html' => $this->_getCronValidatorJs()));
     $form->setValues($model->getData());
     $exportEvents = Mage::getModel('xtento_orderexport/system_config_source_export_events')->toOptionArray(Mage::registry('order_export_profile')->getEntity());
     if (count($exportEvents) > 0) {
         $fieldset = $form->addFieldset('event_fieldset', array('legend' => Mage::helper('xtento_orderexport')->__('Event-based Export'), 'class' => 'fieldset-wide'));
         $fieldset->addField('event_note', 'note', array('text' => Mage::helper('xtento_orderexport')->__('If you want to initiate the export directly after a certain event has been dispatched in Magento, select the appropriate events here. One export per event will be created.')));
         $fixedArray = $model->getEventObservers();
         if (Mage::helper('xtcore/utils')->mageVersionCompare(Mage::getVersion(), '1.4.0.0', '<')) {
             // Fixing a bug in array_search for checkboxes data type that was fixed in Mage 1.4
             array_unshift($fixedArray, '---');
         }
         $fieldset->addField('event_observers', 'checkboxes', array('label' => Mage::helper('xtento_orderexport')->__('Export Events'), 'name' => 'event_observers[]', 'values' => $exportEvents, 'value' => $fixedArray, 'checked' => $fixedArray, 'after_element_html' => '<small>Please click <a href="http://support.xtento.com/wiki/Magento_Extensions:Magento_Order_Export_Module#Event-based_Export" target="_blank">here</a> to learn more about event-based export.</small>'));
     }
     $this->setForm($form);
     return parent::_prepareForm();
 }
Example #5
0
 protected function _prepareForm()
 {
     $entity = Mage::registry('order_export_profile')->getEntity();
     $model = Mage::registry('order_export_profile');
     $form = new Varien_Data_Form();
     $fieldset = $form->addFieldset('object_filters', array('legend' => Mage::helper('xtento_orderexport')->__('%s Filters', ucwords($model->getEntity())), 'class' => 'fieldset-wide'));
     $fieldset->addField('export_filter_new_only', 'select', array('label' => Mage::helper('xtento_orderexport')->__('Export only new %ss', $entity), 'name' => 'export_filter_new_only', 'values' => Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray(), 'note' => Mage::helper('xtento_orderexport')->__('Regardless whether you\'re using manual, cronjob or the event-based export, if set to yes, this setting will make sure every %s gets exported only ONCE by this profile. This means, even if another export event gets called, if the %s has been already exported by this profile, it won\'t be exported again. You can "reset" exported objects in the "Profile Export History" tab.<br/>Example usage: Set up a cronjob export which exports all "Processing" orders and set this to "Yes" - every "Processing" order will be exported only ONCE.', $entity, $entity)));
     $fieldset->addField('store_ids', 'multiselect', array('label' => Mage::helper('xtento_orderexport')->__('Store Views'), 'name' => 'store_ids[]', 'values' => array_merge_recursive(array(array('value' => '', 'label' => Mage::helper('xtento_orderexport')->__('--- All Store Views ---'))), Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm()), 'note' => Mage::helper('xtento_orderexport')->__('Leave empty or select all to export any store. Hold CTRL on your keyboard to pick specific stores.')));
     $fieldset->addField('export_filter_datefrom', 'date', array('label' => Mage::helper('xtento_orderexport')->__('Date From'), 'name' => 'export_filter_datefrom', 'format' => Varien_Date::DATE_INTERNAL_FORMAT, 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'note' => Mage::helper('xtento_orderexport')->__('Export only %ss created after date X (including day X).', $entity)));
     $fieldset->addField('export_filter_dateto', 'date', array('label' => Mage::helper('xtento_orderexport')->__('Date To'), 'name' => 'export_filter_dateto', 'format' => Varien_Date::DATE_INTERNAL_FORMAT, 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'note' => Mage::helper('xtento_orderexport')->__('Export only %ss created before date X (including day X).', $entity)));
     $fieldset->addField('export_filter_last_x_days', 'text', array('label' => Mage::helper('xtento_orderexport')->__('Created during the last X days'), 'name' => 'export_filter_last_x_days', 'maxlength' => 5, 'style' => 'width: 50px !important;" min="0', 'note' => Mage::helper('xtento_orderexport')->__('Export only %ss created during the last X days (including day X). Only enter numbers here, nothing else. Leave empty if no "created during the last X days" filter should be applied.', $entity)))->setType('number');
     $fieldset->addField('export_filter_older_x_minutes', 'text', array('label' => Mage::helper('xtento_orderexport')->__('Older than X minutes'), 'name' => 'export_filter_older_x_minutes', 'maxlength' => 10, 'style' => 'width: 75px !important;" min="1', 'note' => Mage::helper('xtento_orderexport')->__('Export only %ss which have been created at least X minutes ago. Only enter numbers here, nothing else. Leave empty if no filter should be applied.', $entity)))->setType('number');
     if ($entity !== Xtento_OrderExport_Model_Export::ENTITY_SHIPMENT && $entity !== Xtento_OrderExport_Model_Export::ENTITY_QUOTE && $entity !== Xtento_OrderExport_Model_Export::ENTITY_CUSTOMER && $entity !== Xtento_OrderExport_Model_Export::ENTITY_AWRMA) {
         // Not available for shipments
         $fieldset->addField('export_filter_status', 'multiselect', array('label' => Mage::helper('xtento_orderexport')->__('%s Status', ucfirst($entity)), 'name' => 'export_filter_status', 'values' => array_merge_recursive(array(array('value' => '', 'label' => Mage::helper('xtento_orderexport')->__('--- All statuses ---'))), Mage::getSingleton('xtento_orderexport/system_config_source_export_status')->toOptionArray($entity)), 'note' => Mage::helper('xtento_orderexport')->__('Export only %ss with status X. Hold down CTRL to select multiple.', $entity)));
     }
     if ($entity !== Xtento_OrderExport_Model_Export::ENTITY_QUOTE && $entity !== Xtento_OrderExport_Model_Export::ENTITY_CUSTOMER && $entity !== Xtento_OrderExport_Model_Export::ENTITY_AWRMA && $entity !== Xtento_OrderExport_Model_Export::ENTITY_BOOSTRMA) {
         $fieldset = $form->addFieldset('item_filters', array('legend' => Mage::helper('xtento_orderexport')->__('Item Filters'), 'class' => 'fieldset-wide'));
         $fieldset->addField('export_filter_product_type', 'multiselect', array('label' => Mage::helper('xtento_orderexport')->__('Hidden Product Types'), 'name' => 'export_filter_product_type', 'values' => array_merge_recursive(array(array('value' => '', 'label' => Mage::helper('xtento_orderexport')->__('--- No hidden product types ---'))), Mage::getModel('catalog/product_type')->getOptions()), 'note' => Mage::helper('xtento_orderexport')->__('The selected product types won\'t be exported and won\'t show up in the output format for this profile. You can still fetch information from the parent product in the XSL Template using the <i>parent_item/</i> node. ')));
     }
     if (Mage::helper('xtcore/utils')->mageVersionCompare(Mage::getVersion(), '1.4.0.1', '>')) {
         if ($entity !== Xtento_OrderExport_Model_Export::ENTITY_CUSTOMER && $entity !== Xtento_OrderExport_Model_Export::ENTITY_AWRMA && $entity !== Xtento_OrderExport_Model_Export::ENTITY_BOOSTRMA) {
             $renderer = Mage::getBlockSingleton('adminhtml/widget_form_renderer_fieldset')->setTemplate('promo/fieldset.phtml')->setNewChildUrl($this->getUrl('*/orderexport_profile/newConditionHtml/form/rule_conditions_fieldset', array('profile_id' => Mage::registry('order_export_profile')->getId())));
             $fieldset = $form->addFieldset('rule_conditions_fieldset', array('legend' => Mage::helper('xtento_orderexport')->__('Additional filters: Export %s only if the following conditions are met', $entity)))->setRenderer($renderer);
             $fieldset->addField('conditions', 'text', array('name' => 'conditions', 'label' => Mage::helper('salesrule')->__('Conditions'), 'title' => Mage::helper('salesrule')->__('Conditions')))->setRule($model)->setRenderer(Mage::getBlockSingleton('rule/conditions'));
         }
     }
     if ($entity == Xtento_OrderExport_Model_Export::ENTITY_ORDER) {
         $fieldset = $form->addFieldset('actions', array('legend' => Mage::helper('xtento_orderexport')->__('Actions'), 'class' => 'fieldset-wide'));
         // Only available for orders
         $fieldset->addField('export_action_change_status', 'select', array('label' => Mage::helper('xtento_orderexport')->__('Change %s status after export', $entity), 'name' => 'export_action_change_status', 'values' => Mage::getSingleton('xtento_orderexport/system_config_source_order_status')->toOptionArray(), 'note' => Mage::helper('xtento_orderexport')->__('Change %s status to X after exporting.', $entity)));
         $fieldset->addField('export_action_add_comment', 'text', array('label' => Mage::helper('xtento_orderexport')->__('Add comment to status history'), 'name' => 'export_action_add_comment', 'note' => Mage::helper('xtento_orderexport')->__('Comment is added to the order status history after the order has been exported. Attention: This only works if the order status you\'re changing to is assigned to an order "state" at System > Order Statuses.')));
         $fieldset->addField('export_action_invoice_order', 'select', array('label' => Mage::helper('xtento_orderexport')->__('Invoice order after exporting'), 'name' => 'export_action_invoice_order', 'values' => Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray(), 'note' => Mage::helper('xtento_orderexport')->__('If enabled, after exporting, the order would be invoiced and the payment would be captured.')));
         $fieldset->addField('export_action_invoice_notify', 'select', array('label' => Mage::helper('xtento_orderexport')->__('Notify customer about invoice'), 'name' => 'export_action_invoice_notify', 'values' => Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray(), 'note' => Mage::helper('xtento_orderexport')->__('If "Invoice order after exporting" is enabled, the customer would receive an email after the invoice has been created.')));
         $fieldset->addField('export_action_ship_order', 'select', array('label' => Mage::helper('xtento_orderexport')->__('Ship order after exporting'), 'name' => 'export_action_ship_order', 'values' => Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray(), 'note' => Mage::helper('xtento_orderexport')->__('If enabled, after exporting, the order would be shipped.')));
         $fieldset->addField('export_action_ship_notify', 'select', array('label' => Mage::helper('xtento_orderexport')->__('Notify customer about shipment'), 'name' => 'export_action_ship_notify', 'values' => Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray(), 'note' => Mage::helper('xtento_orderexport')->__('If "Ship order after exporting" is enabled, the customer would receive an email after the shipment has been created.')));
         $fieldset->addField('export_action_cancel_order', 'select', array('label' => Mage::helper('xtento_orderexport')->__('Cancel order'), 'name' => 'export_action_cancel_order', 'values' => Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray(), 'note' => Mage::helper('xtento_orderexport')->__('If set to "Yes", this will cancel the order after the profile has been executed.')));
     }
     $form->setValues($model->getData());
     $this->setForm($form);
     return parent::_prepareForm();
 }
 protected function _prepareLayout()
 {
     $this->setChild('continue_button', $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array('label' => Mage::helper('catalog')->__('Continue'), 'onclick' => "saveAndContinueEdit()", 'class' => 'save')));
     return parent::_prepareLayout();
 }