public function onControllerPagesSaleOrder_UpdateData()
 {
     $that = $this->baseObject;
     $order_id = $that->request->get['order_id'];
     //are we logged to admin and correct method called?
     if (IS_ADMIN && $that->user->isLogged() && $this->baseObject_method == 'payment_details') {
         //build HTML to show
         $that->loadLanguage('default_realex/default_realex');
         if (!$this->r_data) {
             //no realex data yet. load it.
             $this->_load_releax_order_data($order_id, $that);
         }
         if (!$this->r_data) {
             return null;
         }
         $view = new AView($this->registry, 0);
         $view->assign('order_id', $order_id);
         $view->assign('void_url', $that->html->getSecureURL('r/extension/default_realex/void'));
         $view->assign('capture_url', $that->html->getSecureURL('r/extension/default_realex/capture'));
         $view->assign('rebate_url', $that->html->getSecureURL('r/extension/default_realex/rebate'));
         $view->assign('realex_order', $this->r_data);
         $view->batchAssign($that->language->getASet('default_realex/default_realex'));
         $this->baseObject->view->addHookVar('extension_payment_details', $view->fetch('pages/sale/payment_details.tpl'));
     }
 }
Пример #2
0
 private function _getForm()
 {
     $view = new AView($this->registry, 0);
     $view->batchAssign($this->language->getASet('tool/rl_manager'));
     $view->assign('error_warning', $this->error['warning']);
     $view->assign('success', $this->session->data['success']);
     if (isset($this->session->data['success'])) {
         unset($this->session->data['success']);
     }
     $this->data = array();
     $this->data['error'] = $this->error;
     $rm = new AResourceManager();
     if (isset($this->request->get['rl_type'])) {
         $type_data = $rm->getResourceTypeByName($this->request->get['rl_type']);
     }
     $fields = array('type_id', 'type_name', 'default_directory', 'default_icon', 'file_types', 'access_type');
     foreach ($fields as $f) {
         if (isset($this->request->post[$f])) {
             $this->data[$f] = $this->request->post[$f];
         } elseif (isset($type_data)) {
             $this->data[$f] = $type_data[$f];
         } else {
             $this->data[$f] = '';
         }
     }
     if (!isset($this->data['type_id'])) {
         return null;
     } else {
         $this->data['action'] = $this->html->getSecureURL('r/tool/rl_manager/save', '&rl_type=' . $this->data['type_name']);
         $this->data['heading_title'] = $this->data['form_title'] = $this->language->get('text_edit') . ' ' . $this->data['type_name'] . ' ' . $this->language->get('text_rl_type');
         $form = new AForm('ST');
     }
     $this->document->addBreadcrumb(array('href' => $this->data['action'], 'text' => $this->data['form_title'], 'separator' => ' :: '));
     $form->setForm(array('form_name' => 'rl_typeFrm', 'update' => $this->data['update']));
     $this->data['form']['id'] = 'rl_typeFrm';
     $this->data['form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'rl_typeFrm', 'action' => $this->data['action'], 'attr' => 'data-confirm-exit="true"  class="aform form-horizontal"')) . ($this->data['form']['fields']['type_id'] = $form->getFieldHtml(array('type' => 'hidden', 'name' => 'type_id', 'value' => $this->data['type_id'])));
     $this->data['form']['fields']['type_name'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'type_name', 'value' => $this->data['type_name'], 'style' => 'tiny-field', 'attr' => 'readonly'));
     $this->data['form']['fields']['default_icon'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'default_icon', 'value' => $this->data['default_icon'], 'style' => 'small-field'));
     $this->data['form']['fields']['default_directory'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'default_directory', 'value' => $this->data['default_directory'], 'style' => 'small-field', 'attr' => 'readonly'));
     $this->data['form']['fields']['file_types'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'file_types', 'value' => $this->data['file_types'], 'style' => 'small-field'));
     $this->data['button_save'] = $this->language->get('button_save');
     $this->data['button_close'] = $this->language->get('button_close');
     $this->data['button_save_and_close'] = $this->language->get('button_save_and_close');
     $view->assign('help_url', $this->gen_help_url('resource_library_types'));
     $view->batchAssign($this->data);
     $this->data['response'] = $view->fetch('responses/tool/rl_types_form.tpl');
     $this->response->setOutput($this->data['response']);
 }
 public function main()
 {
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $section_id = $this->request->get['section_id'];
     $layout = new ALayoutManager();
     $installedBlocks = $layout->getInstalledBlocks();
     $availableBlocks = array();
     foreach ($installedBlocks as $block) {
         if ($block['parent_block_id'] == $section_id) {
             $availableBlocks[] = array('id' => $block['block_id'] . '_' . $block['custom_block_id'], 'block_id' => $block['block_id'], 'block_txt_id' => $block['block_txt_id'], 'block_name' => $block['block_name'], 'custom_block_id' => $block['custom_block_id'], 'controller' => $block['controller'], 'template' => $block['template']);
         }
     }
     $view = new AView($this->registry, 0);
     $this->loadLanguage('design/blocks');
     $view->batchAssign($this->language->getASet());
     $view->assign('blocks', $availableBlocks);
     $view->assign('addBlock', $this->html->getSecureURL('design/blocks_manager/addBlock', '&section_id=' . $section_id));
     $blocks = $view->fetch('responses/design/blocks_manager.tpl');
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
     $this->response->setOutput($blocks);
 }
Пример #4
0
 public function getCustomListingSubForm()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $this->load->library('json');
     $lm = new ALayoutManager();
     $form_name = has_value($this->request->get['form_name']) ? $this->request->get['form_name'] : 'BlockFrm';
     $custom_block_id = (int) $this->request->get['custom_block_id'];
     $listing_datasource = $this->request->post_or_get('listing_datasource');
     // need to get data of custom listing
     $listing_data = array();
     if ($custom_block_id) {
         $content = $lm->getBlockDescriptions($custom_block_id);
         $content = $content[$this->language->getContentLanguageID()]['content'];
         $content = unserialize($content);
         if ($content['listing_datasource'] == $listing_datasource) {
             $lm = new AListingManager($custom_block_id);
             $list = $lm->getCustomList();
             $listing_data = array();
             foreach ($list as $row) {
                 $listing_data[$row['id']] = array('id' => $row['id'], 'status' => true, 'sort_order' => $row['sort_order']);
             }
         }
     }
     $form = new AForm('ST');
     $form->setForm(array('form_name' => $form_name));
     $view = new AView($this->registry, 0);
     $multivalue_html = $form->getFieldHtml(array('id' => 'popup', 'type' => 'multivalue', 'name' => 'popup', 'title' => $this->language->get('text_select_from_list'), 'selected' => $listing_data ? AJson::encode($listing_data) : "{}", 'content_url' => $this->html->getSecureUrl('listing_grid/blocks_grid/buildListingGridForSelect', '&custom_block_id=' . $custom_block_id), 'postvars' => array('listing_datasource' => $listing_datasource), 'return_to' => '', 'no_save' => $custom_block_id ? false : true, 'text' => array('selected' => $this->language->get('text_selected'), 'edit' => $this->language->get('text_save_edit'), 'apply' => $this->language->get('text_apply'), 'save' => $this->language->get('button_save'), 'reset' => $this->language->get('button_reset')), 'js' => array('apply' => $form_name . "_category_products_buildList();", 'cancel' => $form_name . '_category_products_buildList();')));
     $view->assign('multivalue_html', $multivalue_html);
     $view->assign('form_name', $form_name);
     if ($this->data['data_sources'][$listing_datasource]['items_list_url']) {
         $multivalue_list = $form->getFieldHtml(array('id' => 'category_products', 'type' => 'multivaluelist', 'name' => 'category_products', 'content_url' => $this->html->getSecureUrl($this->data['data_sources'][$listing_datasource]['items_list_url']), 'edit_url' => '', 'multivalue_hidden_id' => 'popup', 'values' => $listing_data ? AJson::encode($listing_data) : "{}", 'return_to' => '', 'with_sorting' => true, 'text' => array('delete' => $this->language->get('button_delete'), 'delete_confirm' => $this->language->get('text_delete_confirm'), 'column_sort_order' => $this->language->get('text_sort_order'), 'column_action' => $this->language->get('column_action'))));
         $view->assign('multivalue_list', $multivalue_list);
     }
     $this->data['response'] .= $view->fetch('responses/design/block_custom_listing_subform.tpl');
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
     $this->response->setOutput($this->data['response']);
 }
 public function getAutoListingSubForm()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $this->loadLanguage('design/blocks');
     $custom_block_id = (int) $this->request->get['custom_block_id'];
     $lm = new ALayoutManager();
     if (!$custom_block_id) {
         $form = new AForm('ST');
     } else {
         $form = new AForm('HS');
         $content = $lm->getBlockDescriptions($custom_block_id);
         $content = $content[$this->language->getContentLanguageID()]['content'];
         $content = unserialize($content);
     }
     $form->setForm(array('form_name' => 'BlockFrm'));
     $view = new AView($this->registry, 0);
     $view->assign('entry_limit', $this->language->get('entry_limit'));
     $view->assign('field_limit', $form->getFieldHtml(array('type' => 'input', 'name' => 'limit', 'value' => $content['limit'], 'help_url' => $this->gen_help_url('block_limit'))));
     $this->data['response'] = $view->fetch('responses/design/block_auto_listing_subform.tpl');
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
     $this->response->setOutput($this->data['response']);
 }
Пример #6
0
 /**
  * @return string
  * @throws AException
  */
 public function getStoreSwitcher()
 {
     $registry = Registry::getInstance();
     $view = new AView(Registry::getInstance(), 0);
     //check if store_id is passed or in the session
     $store_id = $registry->get('config')->get('config_store_id');
     //set store selector
     $stores = array();
     $hidden = array();
     $stores[0] = array('name' => $registry->get('language')->get('text_default'));
     $registry->get('load')->model('setting/store');
     //if loaded not default store - hide store switcher
     $default_store_settings = $registry->get('model_setting_store')->getStore(0);
     if ($this->registry->get('config')->get('config_url') != $default_store_settings['config_url']) {
         return '';
     }
     $result_stores = $registry->get('model_setting_store')->getStores();
     if (sizeof($result_stores) > 0) {
         foreach ($result_stores as $rs) {
             $stores[$rs['store_id']] = array('name' => $rs['alias'] ? $rs['alias'] : $rs['name'], 'store_id' => $rs['store_id']);
         }
         foreach ($registry->get('request')->get as $name => $value) {
             if ($name == 'store_id') {
                 continue;
             }
             $hidden[$name] = $value;
         }
         $view->assign('all_stores', $stores);
         $view->assign('current_store', $stores[$store_id]['name']);
         $view->assign('hiddens', $hidden);
         $view->assign('text_select_store', $registry->get('language')->get('text_select_store'));
         return $view->fetch('form/store_switcher.tpl');
     } else {
         return '';
     }
 }
 private function _getForm()
 {
     $view = new AView($this->registry, 0);
     $view->batchAssign($this->language->getASet('catalog/product'));
     $view->assign('error_warning', $this->error['warning']);
     $view->assign('success', $this->session->data['success']);
     if (isset($this->session->data['success'])) {
         unset($this->session->data['success']);
     }
     $this->data = array();
     $this->data['error'] = $this->error;
     $this->data['cancel'] = $this->html->getSecureURL('catalog/product_promotions', '&product_id=' . $this->request->get['product_id']);
     $this->data['active'] = 'promotions';
     $this->data['product_description'] = $this->model_catalog_product->getProductDescriptions($this->request->get['product_id']);
     $this->data['heading_title'] = $this->language->get('text_edit') . ' ' . $this->language->get('text_product') . ' - ' . $this->data['product_description'][$this->session->data['content_language_id']]['name'];
     if (isset($this->request->get['product_discount_id']) && $this->request->is_GET()) {
         $discount_info = $this->model_catalog_product->getProductDiscount($this->request->get['product_discount_id']);
         if ($discount_info['date_start'] == '0000-00-00') {
             $discount_info['date_start'] = '';
         }
         if ($discount_info['date_end'] == '0000-00-00') {
             $discount_info['date_end'] = '';
         }
     }
     $this->loadModel('sale/customer_group');
     $results = $this->model_sale_customer_group->getCustomerGroups();
     $this->data['customer_groups'] = array();
     foreach ($results as $r) {
         $this->data['customer_groups'][$r['customer_group_id']] = $r['name'];
     }
     $fields = array('customer_group_id', 'quantity', 'priority', 'price', 'date_start', 'date_end');
     foreach ($fields as $f) {
         if (isset($this->request->post[$f])) {
             $this->data[$f] = $this->request->post[$f];
             if (in_array($f, array('date_start', 'date_end'))) {
                 $this->data[$f] = dateDisplay2ISO($this->data[$f], $this->language->get('date_format_short'));
             }
         } elseif (isset($discount_info)) {
             $this->data[$f] = $discount_info[$f];
         } else {
             $this->data[$f] = '';
         }
     }
     if (!isset($this->request->get['product_discount_id'])) {
         $this->data['action'] = $this->html->getSecureURL('catalog/product_promotions', '&product_id=' . $this->request->get['product_id']);
         $this->data['form_title'] = $this->language->get('text_insert') . ' ' . $this->language->get('entry_discount');
         $this->data['update'] = '';
         $form = new AForm('ST');
     } else {
         $this->data['action'] = $this->html->getSecureURL('catalog/product_promotions', '&product_id=' . $this->request->get['product_id'] . '&product_discount_id=' . $this->request->get['product_discount_id']);
         $this->data['form_title'] = $this->language->get('text_edit') . ' ' . $this->language->get('entry_discount');
         $this->data['update'] = $this->html->getSecureURL('listing_grid/product/update_discount_field', '&id=' . $this->request->get['product_discount_id']);
         $form = new AForm('HS');
     }
     $this->document->addBreadcrumb(array('href' => $this->data['action'], 'text' => $this->data['form_title'], 'separator' => ' :: '));
     $form->setForm(array('form_name' => 'productFrm', 'update' => $this->data['update']));
     $this->data['form']['id'] = 'productFrm';
     $this->data['form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'productFrm', 'action' => $this->data['action'], 'attr' => 'data-confirm-exit="true"  class="aform form-horizontal"')) . $form->getFieldHtml(array('type' => 'hidden', 'name' => 'promotion_type', 'value' => 'discount'));
     $this->data['form']['submit'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'submit', 'text' => $this->language->get('button_save'), 'style' => 'button1'));
     $this->data['form']['cancel'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'cancel', 'text' => $this->language->get('button_cancel'), 'style' => 'button2'));
     $this->data['form']['fields']['customer_group'] = $form->getFieldHtml(array('type' => 'selectbox', 'name' => 'customer_group_id', 'value' => $this->data['customer_group_id'], 'options' => $this->data['customer_groups']));
     $this->data['form']['fields']['quantity'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'quantity', 'value' => $this->data['quantity'], 'style' => 'small-field'));
     $this->data['form']['fields']['priority'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'priority', 'value' => $this->data['priority'], 'style' => 'small-field'));
     $this->data['form']['fields']['price'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'price', 'value' => moneyDisplayFormat($this->data['price']), 'style' => 'tiny-field'));
     $this->data['js_date_format'] = format4Datepicker($this->language->get('date_format_short'));
     $this->data['form']['fields']['date_start'] = $form->getFieldHtml(array('type' => 'date', 'name' => 'date_start', 'value' => dateISO2Display($this->data['date_start'], $this->language->get('date_format_short')), 'default' => '', 'dateformat' => format4Datepicker($this->language->get('date_format_short')), 'highlight' => 'future', 'style' => 'small-field'));
     $this->data['form']['fields']['date_end'] = $form->getFieldHtml(array('type' => 'date', 'name' => 'date_end', 'value' => dateISO2Display($this->data['date_end'], $this->language->get('date_format_short')), 'default' => '', 'dateformat' => format4Datepicker($this->language->get('date_format_short')), 'highlight' => 'future', 'style' => 'small-field'));
     $view->assign('help_url', $this->gen_help_url('product_discount_edit'));
     $view->batchAssign($this->data);
     $this->data['response'] = $view->fetch('responses/catalog/product_promotion_form.tpl');
     $this->response->setOutput($this->data['response']);
 }