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')); } }
public function onControllerPagesSaleOrder_UpdateData() { $that = $this->baseObject; //are we logged to admin and correct method called? if (IS_ADMIN && $that->user->isLogged() && $this->baseObject_method == 'payment_details' && has_value($that->data['order_info']['payment_method_data'])) { $payment_method_data = unserialize($that->data['order_info']['payment_method_data']); if (has_value($payment_method_data['payment_method']) && $payment_method_data['payment_method'] == 'default_pp_pro') { $that->loadLanguage('default_pp_pro/default_pp_pro'); // for some reason after language loading 'button_invoice' html object is removed from baseObject->data $that->view->assign('button_invoice', $that->html->buildButton(array('name' => 'btn_invoice', 'text' => $that->language->get('text_invoice')))); $data = array(); $data['text_payment_status'] = $that->language->get('text_payment_status'); if (strtolower($payment_method_data['PAYMENTACTION']) == 'authorization') { // show "capture" form $tpl_data = $this->_get_capture_form($data, $payment_method_data); } else { // show "refund" form $tpl_data = $this->_get_refund_form($data, $payment_method_data); } $view = new AView($this->registry, 0); $view->batchAssign($that->language->getASet('default_pp_pro/default_pp_pro')); $view->batchAssign($tpl_data); $that->view->addHookVar('extension_payment_details', $view->fetch('pages/sale/pp_pro_payment_details.tpl')); } } }
public function addBlock() { //update controller data $this->extensions->hk_UpdateData($this, __FUNCTION__); list($block_id, $custom_block_id) = explode('_', $this->request->get['id']); $section_id = $this->request->get['section_id']; $layout = new ALayoutManager(); $installedBlocks = $layout->getInstalledBlocks(); $view = new AView($this->registry, 0); $selectedBlock = array(); foreach ($installedBlocks as $block) { if ($block['block_id'] == (int) $block_id && $block['custom_block_id'] == (int) $custom_block_id) { $selectedBlock = $block; break; } } $customName = ''; if ($selectedBlock['custom_block_id']) { $customName = $selectedBlock['block_name']; $edit_url = $this->html->getSecureURL('design/blocks/edit', '&custom_block_id=' . $selectedBlock['custom_block_id']); } $this->loadLanguage('design/blocks'); $view->batchAssign(array('id' => 0, 'blockId' => $selectedBlock['block_id'], 'customBlockId' => $selectedBlock['custom_block_id'], 'name' => $selectedBlock['block_txt_id'], 'customName' => $customName, 'editUrl' => $edit_url, 'status' => 1, 'parentBlock' => $section_id, 'block_info_url' => $this->html->getSecureURL('design/blocks_manager/block_info'))); $blockTmpl = $view->fetch('common/block.tpl'); //update controller data $this->extensions->hk_UpdateData($this, __FUNCTION__); $this->response->setOutput($blockTmpl); }
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']); }
private function _html_response() { $this->loadLanguage('catalog/download'); $form_name = isset($this->request->get['form_name']) ? $this->request->get['form_name'] : 'SharedFrm'; $multivalue_hidden_id = isset($this->request->get['multivalue_hidden_id']) ? $this->request->get['multivalue_hidden_id'] : 'popup'; //remember selected rows for response if (isset($this->request->post['selected'])) { $this->session->data['listing_selected'] = AJson::decode(html_entity_decode($this->request->post['selected']), true); } $grid_settings = array('table_id' => 'download_grid_' . $multivalue_hidden_id, 'url' => $this->html->getSecureURL('catalog/download_listing', '&response_type=json&product_id=' . $this->request->get['product_id'] . (isset($this->request->get['shared_only']) ? '&shared_only=1' : '')), 'editurl' => '', 'sortname' => 'name', 'sortorder' => 'asc', 'actions' => array(), 'multiselect_noselectbox' => true); $grid_settings['colNames'] = array($this->language->get('column_image'), $this->language->get('column_name')); $grid_settings['colNames'][] = $this->language->get('column_action'); $grid_settings['colModel'] = array(array('name' => 'image', 'index' => 'image', 'align' => 'center', 'width' => 50, 'sortable' => false, 'search' => false), array('name' => 'name', 'index' => 'name', 'align' => 'left', 'width' => 200), array('name' => 'action', 'index' => 'action', 'align' => 'center', 'width' => 30, 'sortable' => false, 'search' => false)); $grid_settings['search_form'] = true; $grid = $this->dispatch('common/listing_grid', array($grid_settings)); $listing_grid = $grid->dispatchGetOutput(); unset($grid); // add js-scripts for grid rows selecting (redeclare onSelectRow event for grid) $view = new AView($this->registry, 0); $view->batchAssign(array('id' => $multivalue_hidden_id, 'form_name' => $form_name . '_' . $multivalue_hidden_id, 'table_id' => $grid_settings['table_id'], 'listing_grid' => $listing_grid, 'filter_product' => $this->language->get('filter_product'), 'filter_price_max' => $this->language->get('filter_price_max'))); $this->data['response'] = $view->fetch('responses/catalog/download_listing.tpl'); }
public function getContentLanguageFlags() { $registry = Registry::getInstance(); $view = new AView(Registry::getInstance(), 0); $registry->get('load')->model('localisation/language'); $results = $registry->get('model_localisation_language')->getLanguages(); $template['languages'] = array(); foreach ($results as $result) { if ($result['status']) { $template['languages'][] = array('name' => $result['name'], 'code' => $result['code'], 'image' => $result['image']); } } if (sizeof($template['languages']) > 1) { $template['language_code'] = $registry->get('session')->data['content_language']; //selected in selectbox foreach ($registry->get('request')->get as $name => $value) { if ($name == 'content_language_code') { continue; } $template['hiddens'][$name] = $value; } } else { $template['languages'] = array(); } $view->batchAssign($template); return $view->fetch('form/language_flags.tpl'); }
public function getListing() { //init controller data $this->extensions->hk_InitData($this, __FUNCTION__); $this->load->library('json'); $form_name = 'BannerBlockFrm'; $multivalue_hidden_id = isset($this->request->get['multivalue_hidden_id']) ? $this->request->get['multivalue_hidden_id'] : 'popup'; $this->loadLanguage('banner_manager/banner_manager'); //remember selected rows for response if (isset($this->request->post['selected'])) { $this->session->data['listing_selected'] = AJson::decode(html_entity_decode($this->request->post['selected']), true); } $grid_settings = array('table_id' => 'banner_grid', 'url' => $this->html->getSecureURL('listing_grid/banner_manager/getBannerListData'), 'editurl' => '', 'update_field' => '', 'sortname' => 'name', 'sortorder' => 'asc', 'columns_search' => true, 'actions' => array(), 'multiselect_noselectbox' => true); $form = new AForm(); $form->setForm(array('form_name' => 'banner_grid_search')); $grid_search_form = array(); $grid_search_form['id'] = 'banner_grid_search'; $grid_search_form['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'banner_grid_search', 'action' => '')); $grid_search_form['submit'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'submit', 'text' => $this->language->get('button_go'), 'style' => 'button1')); $grid_search_form['reset'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'reset', 'text' => $this->language->get('button_reset'), 'style' => 'button2')); $grid_settings['colNames'] = array('', $this->language->get('column_banner_name'), $this->language->get('column_banner_group'), $this->language->get('column_banner_type'), $this->language->get('column_action')); $grid_settings['colModel'] = array(array('name' => 'banner_icon', 'index' => 'icon', 'width' => 40, 'align' => 'center', 'search' => false), array('name' => 'banner_name', 'index' => 'name', 'width' => 100, 'align' => 'left'), array('name' => 'banner_group', 'index' => 'banner_group_name', 'width' => 80, 'align' => 'left'), array('name' => 'banner_type', 'index' => 'banner_type', 'width' => 60, 'align' => 'center', 'search' => false), array('name' => 'action', 'index' => 'action', 'align' => 'center', 'sortable' => false, 'search' => false)); $grid = $this->dispatch('common/listing_grid', array($grid_settings)); $this->data['listing_grid'] = $grid->dispatchGetOutput(); $this->data['search_form'] = $grid_search_form; $grid = $this->dispatch('common/listing_grid', array($grid_settings)); $listing_grid = $grid->dispatchGetOutput(); unset($grid); // add js-scripts for grid rows selecting (redeclare onSelectRow event for grid) $view = new AView($this->registry, 0); $view->batchAssign(array('id' => $multivalue_hidden_id, 'form_name' => $form_name . '_' . $multivalue_hidden_id, 'table_id' => $grid_settings['table_id'], 'listing_grid' => $listing_grid, 'heading_title' => $this->language->get('text_select_banners'))); $this->data['response'] = $view->fetch('responses/extension/banner_listing.tpl'); //update controller data $this->extensions->hk_UpdateData($this, __FUNCTION__); $this->response->setOutput($this->data['response']); }
public function buildListingGridForSelect() { //init controller data $this->extensions->hk_InitData($this, __FUNCTION__); $this->load->library('json'); $custom_block_id = (int) $this->request->get['custom_block_id']; $form_name = has_value($this->request->get['form_name']) ? $this->request->get['form_name'] : 'BlockFrm'; $lm = new AListingManager($custom_block_id); $this->data['data_sources'] = $lm->getListingDataSources(); $listing_datasource = $this->request->post_or_get('listing_datasource'); $this->loadLanguage($this->data['data_sources'][$listing_datasource]['language']); //remember selected rows for response if (isset($this->request->post['selected'])) { $this->session->data['listing_selected'] = AJson::decode(html_entity_decode($this->request->post['selected']), true); } $grid_settings = array('table_id' => 'product_grid', 'url' => $this->html->getSecureURL('listing_grid/blocks_grid/getCustomListListingGridData', '&custom_block_id=' . $custom_block_id . '&listing_datasource=' . $listing_datasource), 'editurl' => '', 'sortname' => 'name', 'actions' => array(), 'multiselect_noselectbox' => true); $grid_settings['colNames'] = array($this->language->get('column_image'), $this->language->get('column_name')); if (strpos($listing_datasource, 'product') !== FALSE) { $grid_settings['colNames'][] = $this->language->get('column_model'); } $grid_settings['colNames'][] = $this->language->get('column_action'); $grid_settings['colModel'] = array(array('name' => 'image', 'index' => 'image', 'align' => 'center', 'width' => 50, 'sortable' => false, 'search' => false), array('name' => 'name', 'index' => 'name', 'align' => 'left', 'width' => 200)); if (strpos($listing_datasource, 'product') !== FALSE) { $grid_settings['colModel'][] = array('name' => 'model', 'index' => 'model', 'align' => 'center', 'width' => 60, 'sortable' => true); } $grid_settings['colModel'][] = array('name' => 'action', 'index' => 'action', 'align' => 'center', 'width' => 30, 'sortable' => false, 'search' => false); $grid_settings['search_form'] = true; $grid = $this->dispatch('common/listing_grid', array($grid_settings)); $this->data['response'] = $grid->dispatchGetOutput(); $view = new AView($this->registry, 0); $view->batchAssign(array('form_name' => $form_name, 'table_id' => $grid_settings['table_id'])); //add scripts $this->data['response'] .= $view->fetch('responses/design/block_custom_listing_js.tpl'); //update controller data $this->extensions->hk_UpdateData($this, __FUNCTION__); $this->response->setOutput($this->data['response']); }
public function getMediaListingSubForm() { //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')); $rl = new AResourceManager(); $types = $rl->getResourceTypes(); $resource_types[''] = $this->language->get('text_select'); foreach ($types as $type) { $resource_types[$type['type_name']] = $type['type_name']; } $view = new AView($this->registry, 0); $view->batchAssign(array('entry_media_resource_type' => $this->language->get('entry_resource_type'), 'media_resource_type' => $form->getFieldHtml(array('type' => 'selectbox', 'name' => 'resource_type', 'value' => (string) $content['resource_type'], 'options' => $resource_types, 'style' => 'no-save', 'help_url' => $this->gen_help_url('block_resource_type'))), 'entry_media_resource_limit' => $this->language->get('entry_limit'), 'media_resource_limit' => $form->getFieldHtml(array('type' => 'input', 'name' => 'limit', 'value' => $content['limit'], 'style' => 'no-save', 'help_url' => $this->gen_help_url('block_limit'))))); $this->data['response'] = $view->fetch('responses/design/block_media_listing_subform.tpl'); //update controller data $this->extensions->hk_UpdateData($this, __FUNCTION__); $this->response->setOutput($this->data['response']); }
public function Main() { //init controller data $this->extensions->hk_InitData($this, __FUNCTION__); $this->load->library('json'); $response_type = $this->request->get['response_type']; $form_name = isset($this->request->get['form_name']) ? $this->request->get['form_name'] : 'productFrm'; $multivalue_hidden_id = isset($this->request->get['multivalue_hidden_id']) ? $this->request->get['multivalue_hidden_id'] : 'popup'; if ($response_type != 'json') { $this->loadLanguage('catalog/product'); //remember selected rows for response if (isset($this->request->post['selected'])) { $this->session->data['listing_selected'] = AJson::decode(html_entity_decode($this->request->post['selected']), true); } $grid_settings = array('table_id' => 'product_grid', 'url' => $this->html->getSecureURL('catalog/product_listing', '&response_type=json'), 'editurl' => '', 'sortname' => 'name', 'sortorder' => 'asc', 'actions' => array(), 'multiselect_noselectbox' => true); $grid_settings['colNames'] = array($this->language->get('column_image'), $this->language->get('column_name')); $grid_settings['colNames'][] = $this->language->get('column_model'); $grid_settings['colNames'][] = $this->language->get('column_action'); $grid_settings['colModel'] = array(array('name' => 'image', 'index' => 'image', 'align' => 'center', 'width' => 50, 'sortable' => false, 'search' => false), array('name' => 'name', 'index' => 'name', 'align' => 'left', 'width' => 200), array('name' => 'model', 'index' => 'model', 'align' => 'center', 'width' => 60, 'sortable' => false), array('name' => 'action', 'index' => 'action', 'align' => 'center', 'width' => 30, 'sortable' => false, 'search' => false)); $form = new AForm(); $form->setForm(array('form_name' => 'product_listing_search')); $grid_search_form = array(); $grid_search_form['id'] = 'product_listing_search'; $grid_search_form['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'product_grid_search', 'action' => '')); $grid_search_form['submit'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'submit', 'text' => $this->language->get('button_go'), 'style' => 'button1')); $grid_search_form['reset'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'reset', 'text' => $this->language->get('button_reset'), 'style' => 'button2')); $grid_search_form['fields']['keyword'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'keyword', 'value' => '')); $grid_search_form['fields']['match'] = $form->getFieldHtml(array('type' => 'selectbox', 'name' => 'match', 'options' => array('any' => $this->language->get('filter_any_word'), 'all' => $this->language->get('filter_all_words'), 'exact' => $this->language->get('filter_exact_match')))); $grid_search_form['fields']['pfrom'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'pfrom', 'value' => '')); $grid_search_form['fields']['pto'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'pto', 'value' => '')); $this->loadModel('catalog/category'); $categories = array('' => $this->language->get('text_select_category')); $results = $this->model_catalog_category->getCategories(0); foreach ($results as $r) { $categories[$r['category_id']] = $r['name']; } $grid_search_form['fields']['category'] = $form->getFieldHtml(array('type' => 'selectbox', 'name' => 'category', 'options' => $categories, 'style' => 'medium-field')); $grid_settings['search_form'] = true; $grid = $this->dispatch('common/listing_grid', array($grid_settings)); $listing_grid = $grid->dispatchGetOutput(); unset($grid); // add js-scripts for grid rows selecting (redeclare onSelectRow event for grid) $view = new AView($this->registry, 0); $view->batchAssign(array('id' => $multivalue_hidden_id, 'form_name' => $form_name . '_' . $multivalue_hidden_id, 'table_id' => $grid_settings['table_id'], 'search_form' => $grid_search_form, 'listing_grid' => $listing_grid, 'filter_product' => $this->language->get('filter_product'), 'filter_price_max' => $this->language->get('filter_price_max'))); $this->data['response'] = $view->fetch('responses/catalog/product_listing.tpl'); } else { // json-response for jqgrid $this->loadLanguage('catalog/product'); $this->loadModel('catalog/product'); $this->loadModel('tool/image'); //Prepare filter config //Clean up parametres if needed if (isset($this->request->get['keyword']) && $this->request->get['keyword'] == $this->language->get('filter_product')) { unset($this->request->get['keyword']); } if (isset($this->request->get['pfrom']) && $this->request->get['pfrom'] == 0) { unset($this->request->get['pfrom']); } if (isset($this->request->get['pto']) && $this->request->get['pto'] == $this->language->get('filter_price_max')) { unset($this->request->get['pto']); } //Prepare filter config $filter_params = array('category', 'status', 'keyword', 'match', 'pfrom', 'pto'); $grid_filter_params = array('name', 'sort_order', 'model'); $filter_form = new AFilter(array('method' => 'get', 'filter_params' => $filter_params)); $filter_grid = new AFilter(array('method' => 'post', 'grid_filter_params' => $grid_filter_params)); $total = $this->model_catalog_product->getTotalProducts(array_merge($filter_form->getFilterData(), $filter_grid->getFilterData())); $response = new stdClass(); $response->page = $filter_grid->getParam('page'); $response->total = $filter_grid->calcTotalPages($total); $response->records = $total; $results = $this->model_catalog_product->getProducts(array_merge($filter_form->getFilterData(), $filter_grid->getFilterData())); $i = 0; $resource = new AResource('image'); $response->userdata = (object) array('page' => $page); $data_type = 'product_id'; $list = $this->session->data['listing_selected']; $id_list = array(); foreach ($list as $id => $row) { if ($id == $this->session->data['multivalue_excludes']['product_id']) { continue; } if ($row['status']) { $id_list[] = $id; } } if ($results) { foreach ($results as $result) { if ($result[$data_type] == $this->session->data['multivalue_excludes']['product_id']) { continue; } if (in_array($result[$data_type], $id_list)) { $response->userdata->selId[] = $result[$data_type]; } $thumbnail = $resource->getMainThumb('products', $result[$data_type], 27, 27, true); $response->rows[$i]['id'] = $result[$data_type]; $response->rows[$i]['cell'] = array($thumbnail['thumb_html'], $result['name'], $result['model'], '<a class="btn_action" href="JavaScript:void(0);" onclick="showPopup(\'' . $this->html->getSecureURL('catalog/product/update', '&' . $data_type . '=' . $result[$data_type]) . '\')" title="' . $this->language->get('text_view') . '">' . '<img height="27" src="' . RDIR_TEMPLATE . 'image/icons/icon_grid_view.png" alt="' . $this->language->get('text_edit') . '" /></a>'); $i++; } } $this->data['response'] = $response; } //update controller data $this->extensions->hk_UpdateData($this, __FUNCTION__); if ($response_type == 'json') { $this->data['response'] = AJson::encode($this->data['response']); } $this->response->setOutput($this->data['response']); }
private function _get_refund_form($data = array(), $payment_method_data = array(), $not_refunded = 0) { $refunded_amount = has_value($payment_method_data['refunded_amount']) ? (double) $payment_method_data['refunded_amount'] : 0; if ($not_refunded) { $data['add_to_capture'] = true; $not_refunded = (double) $not_refunded; } else { $data['add_to_capture'] = false; $not_refunded = (double) $payment_method_data['AMT']; } $data['payment_status'] = $this->baseObject->language->get('text_processing'); if ((double) $refunded_amount > 0) { $data['payment_status'] = $this->baseObject->language->get('text_partially_refunded'); $data['refunded_amount'] = $this->baseObject->currency->format($refunded_amount, $this->baseObject->data['currency']['code'], $this->baseObject->data['order_info']['value']); } if ((double) $refunded_amount < $not_refunded) { $data['pp_refund_amount'] = $this->baseObject->html->buildInput(array('name' => 'pp_refund_amount', 'value' => $not_refunded - $refunded_amount, 'style' => 'no-save')); $data['text_do_paypal_refund'] = $this->baseObject->language->get('text_do_paypal_refund'); $data['pp_refund_submit'] = $this->baseObject->html->buildButton(array('text' => $this->baseObject->language->get('text_refund'), 'name' => 'pp_refund_submit', 'style' => 'button3')); $params = '&order_id=' . (int) $this->baseObject->data['order_info']['order_id'] . '¤cy=' . $this->baseObject->data['currency']['code']; if ($data['add_to_capture']) { $params .= '&refund_captured=1'; } $data['pp_refund_action'] = $this->baseObject->html->getSecureURL('r/extension/default_pp_pro/refund', $params); } else { $data['payment_status'] = $this->baseObject->language->get('text_refunded'); } $data['text_already_refunded'] = $this->baseObject->language->get('text_already_refunded'); $data['error_wrong_amount'] = $this->baseObject->language->get('error_wrong_amount'); $view = new AView(Registry::getInstance(), 0); $view->batchAssign($data); $this->baseObject->view->addHookVar('order_details', $view->fetch('pages/extension/paypal_refund.tpl')); }
/** * Process and render the form with HTML output. * * @param bool $fieldsOnly * @return string html */ public function getFormHtml($fieldsOnly = false) { // if no form was loaded return empty string if (empty($this->form)) { return ''; } $fields_html = array(); $view = new AView($this->registry, 0); foreach ($this->fields as $field) { //check for enabled recaptcha instead of default captcha if ($this->config->get('config_recaptcha_site_key') && $field['element_type'] == 'K') { $field['element_type'] = 'J'; } //build data array for each field HTML template $data = array('type' => HtmlElementFactory::getElementType($field['element_type']), 'name' => $field['field_name'], 'form' => $this->form['form_name'], 'attr' => $field['attributes'], 'required' => $field['required'], 'value' => $field['value'], 'options' => $field['options']); //populate customer entered values from session (if present) if (is_array($this->session->data['custom_form_' . $this->form['form_id']])) { $data['value'] = $this->session->data['custom_form_' . $this->form['form_id']][$field['field_name']]; } //custom data based on the HTML element type switch ($data['type']) { case 'multiselectbox': $data['name'] .= '[]'; break; case 'checkboxgroup': $data['name'] .= '[]'; break; case 'captcha': $data['captcha_url'] = $this->html->getURL('common/captcha'); break; case 'recaptcha': $data['recaptcha_site_key'] = $this->config->get('config_recaptcha_site_key'); $data['language_code'] = $this->language->getLanguageCode(); break; } $item = HtmlElementFactory::create($data); switch ($data['type']) { case 'IPaddress': case 'hidden': $fields_html[$field['field_id']] = $item->getHtml(); break; default: $view->batchAssign(array('element_id' => $item->element_id, 'type' => $data['type'], 'title' => $field['name'], 'description' => !empty($field['description']) ? $field['description'] : '', 'error' => !empty($this->errors[$field['field_name']]) ? $this->errors[$field['field_name']] : '', 'item_html' => $item->getHtml())); $fields_html[$field['field_id']] = $view->fetch('form/form_field.tpl'); } } $output = ''; if (!empty($this->groups)) { foreach ($this->groups as $group) { $view->batchAssign(array('group' => $group, 'fields_html' => $fields_html)); $output .= $view->fetch('form/form_group.tpl'); } } else { $view->batchAssign(array('fields_html' => $fields_html)); $output .= $view->fetch('form/form_no_group.tpl'); } // add submit button and form open/close tag if (!$fieldsOnly) { $data = array('type' => 'submit', 'form' => $this->form['form_name'], 'name' => $this->language->get('button_submit')); $submit = HtmlElementFactory::create($data); $data = array('type' => 'form', 'name' => $this->form['form_name'], 'attr' => ' class="form" ', 'action' => $this->html->getSecureURL($this->form['controller'], '&form_id=' . $this->form['form_id'], true)); $form_open = HtmlElementFactory::create($data); $form_close = $view->fetch('form/form_close.tpl'); $js = $this->addFormJs(); $view->batchAssign(array('description' => $this->form['description'], 'form' => $output, 'form_open' => $js . $form_open->getHtml(), 'form_close' => $form_close, 'submit' => $submit)); $output = $view->fetch('form/form.tpl'); } return $output; }
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']); }
public function callback() { if (isset($this->request->post['callbackPW']) && $this->request->post['callbackPW'] == $this->config->get('default_worldpay_password')) { $this->loadLanguage('default_worldpay/default_worldpay'); $template_data['title'] = sprintf($this->language->get('heading_title'), $this->config->get('store_name')); if (!isset($this->request->server['HTTPS']) || $this->request->server['HTTPS'] != 'on') { $template_data['base'] = HTTP_SERVER; } else { $template_data['base'] = HTTPS_SERVER; } $template_data['charset'] = 'utf-8'; $template_data['language'] = $this->language->get('code'); $template_data['direction'] = $this->language->get('direction'); $template_data['heading_title'] = sprintf($this->language->get('heading_title'), $this->config->get('store_name')); $template_data['text_response'] = $this->language->get('text_response'); $template_data['text_success'] = $this->language->get('text_success'); $template_data['text_success_wait'] = sprintf($this->language->get('text_success_wait'), $this->html->getSecureURL('checkout/success')); $template_data['text_failure'] = $this->language->get('text_failure'); if ($this->request->get['rt'] != 'checkout/guest_step_3') { $template_data['text_failure_wait'] = sprintf($this->language->get('text_failure_wait'), $this->html->getSecureURL('checkout/payment')); } else { $template_data['text_failure_wait'] = sprintf($this->language->get('text_failure_wait'), $this->html->getSecureURL('checkout/guest_step_2')); } if (isset($this->request->post['transStatus']) && $this->request->post['transStatus'] == 'Y') { $this->load->model('checkout/order'); $this->model_checkout_order->confirm($this->request->post['cartId'], $this->config->get('default_worldpay_order_status_id')); $message = ''; if (isset($this->request->post['transId'])) { $message .= 'transId: ' . $this->request->post['transId'] . "\n"; } if (isset($this->request->post['transStatus'])) { $message .= 'transStatus: ' . $this->request->post['transStatus'] . "\n"; } if (isset($this->request->post['countryMatch'])) { $message .= 'countryMatch: ' . $this->request->post['countryMatch'] . "\n"; } if (isset($this->request->post['AVS'])) { $message .= 'AVS: ' . $this->request->post['AVS'] . "\n"; } if (isset($this->request->post['rawAuthCode'])) { $message .= 'rawAuthCode: ' . $this->request->post['rawAuthCode'] . "\n"; } if (isset($this->request->post['authMode'])) { $message .= 'authMode: ' . $this->request->post['authMode'] . "\n"; } if (isset($this->request->post['rawAuthMessage'])) { $message .= 'rawAuthMessage: ' . $this->request->post['rawAuthMessage'] . "\n"; } if (isset($this->request->post['wafMerchMessage'])) { $message .= 'wafMerchMessage: ' . $this->request->post['wafMerchMessage'] . "\n"; } $this->model_checkout_order->update($this->request->post['cartId'], $this->config->get('default_worldpay_order_status_id'), $message, FALSE); $template_data['continue'] = $this->html->getSecureURL('checkout/success'); $this->template = 'extension/default_worldpay_success.tpl'; } else { $template_data['continue'] = $this->html->getSecureURL('checkout/cart'); $this->template = 'extension/default_worldpay_failure.tpl'; } $view = new AView($this->registry, 0); $view->batchAssign($template_data); $html = $view->fetch($this->template); $this->response->setOutput($html); } }
public function onControllerPagesSaleOrder_UpdateData() { $that = $this->baseObject; if (IS_ADMIN && $that->user->isLogged() && $this->baseObject_method == 'payment_details' && has_value($that->data['order_info']['payment_method_data'] == 'PayPal Express Checkout')) { $payment_method_data = unserialize($that->data['order_info']['payment_method_data']); $payment_status = strtolower($payment_method_data['PAYMENTINFO_0_PAYMENTSTATUS']); $data = array(); $data['text_payment_status'] = $that->language->get('text_payment_status'); $data['payment_status'] = $payment_method_data['PAYMENTINFO_0_PAYMENTSTATUS']; if (has_value($payment_method_data['PAYMENTINFO_0_PENDINGREASON'])) { $data['pending_reason'] = $that->language->get('text_reason') . ' ' . $payment_method_data['PAYMENTINFO_0_PENDINGREASON']; } $data['error_service_unavailable'] = $that->language->get('error_service_unavailable'); if ($payment_status == 'pending' && $payment_method_data['PAYMENTINFO_0_PENDINGREASON'] == 'authorization' || has_value($payment_method_data['captured_transaction_id'])) { // show "capture" form $tpl_data = $this->_get_capture_form($data, $payment_method_data); } elseif ($payment_status == 'completed') { // show "refund" form/button $tpl_data = $this->_get_refund_form($data, $payment_method_data); } elseif ($payment_status == 'partially refunded') { // show "refund" form/button $tpl_data = $this->_get_refund_form($data, $payment_method_data); } if ($tpl_data) { $view = new AView(Registry::getInstance(), 0); $view->batchAssign($that->language->getASet('default_pp_express/default_pp_express')); $view->batchAssign($tpl_data); $that->view->addHookVar('extension_payment_details', $view->fetch('pages/sale/pp_express_payment_details.tpl')); } } }
/** * Process and render the form with HTML output. * * @param bool $fieldsOnly * @return string html */ public function getFormHtml($fieldsOnly = false) { // if no form was loaded return empty string if (empty($this->form)) { return ''; } $fields_html = array(); $view = new AView($this->registry, 0); foreach ($this->fields as $field) { $data = array('type' => HtmlElementFactory::getElementType($field['element_type']), 'name' => $field['field_name'], 'form' => $this->form['form_name'], 'attr' => $field['attributes'], 'required' => $field['required'], 'value' => $field['value'], 'options' => $field['options']); switch ($data['type']) { case 'multiselectbox': $data['name'] .= '[]'; break; case 'checkboxgroup': $data['name'] .= '[]'; break; case 'captcha': $data['captcha_url'] = $this->html->getURL('common/captcha'); break; } $item = HtmlElementFactory::create($data); switch ($data['type']) { case 'IPaddress': case 'hidden': $fields_html[$field['field_id']] = $item->getHtml(); break; default: $view->batchAssign(array('element_id' => $item->element_id, 'title' => $field['name'], 'description' => !empty($this->form['description']) ? $field['description'] : '', 'error' => !empty($this->errors[$field['field_name']]) ? $this->errors[$field['field_name']] : '', 'item_html' => $item->getHtml())); $fields_html[$field['field_id']] = $view->fetch('form/form_field.tpl'); } } $output = ''; if (!empty($this->groups)) { foreach ($this->groups as $group) { $view->batchAssign(array('group' => $group, 'fields_html' => $fields_html)); $output .= $view->fetch('form/form_group.tpl'); } } else { $view->batchAssign(array('fields_html' => $fields_html)); $output .= $view->fetch('form/form_no_group.tpl'); } // add submit button and form open/close tag if (!$fieldsOnly) { $data = array('type' => 'submit', 'form' => $this->form['form_name'], 'name' => $this->language->get('button_continue'), 'icon' => 'icon-arrow-right'); $submit = HtmlElementFactory::create($data); $data = array('type' => 'form', 'name' => $this->form['form_name'], 'attr' => ' class="form" ', 'action' => $this->html->getSecureURL($this->form['controller'], '&form_id=' . $this->form['form_id'], true)); $form_open = HtmlElementFactory::create($data); $form_close = $view->fetch('form/form_close.tpl'); $js = $this->addFormJs(); $view->batchAssign(array('description' => $this->form['description'], 'form' => $output, 'form_open' => $js . $form_open->getHtml(), 'form_close' => $form_close, 'submit' => $submit->getHtml())); $output = $view->fetch('form/form.tpl'); } return $output; }
public function Main() { //init controller data $this->extensions->hk_InitData($this, __FUNCTION__); $this->load->library('json'); $response_type = $this->request->get['response_type']; $form_name = isset($this->request->get['form_name']) ? $this->request->get['form_name'] : 'productFrm'; $multivalue_hidden_id = isset($this->request->get['multivalue_hidden_id']) ? $this->request->get['multivalue_hidden_id'] : 'popup'; if ($response_type != 'json') { $this->loadLanguage('catalog/category'); //remember selected rows for response if (isset($this->request->post['selected'])) { $this->session->data['listing_selected'] = AJson::decode(html_entity_decode($this->request->post['selected']), true); } $grid_settings = array('table_id' => 'category_grid', 'url' => $this->html->getSecureURL('catalog/category_listing', '&response_type=json'), 'editurl' => '', 'sortname' => 'name', 'sortorder' => 'asc', 'actions' => array(), 'multiselect_noselectbox' => true); $grid_settings['colNames'] = array($this->language->get('column_image'), $this->language->get('column_name')); $grid_settings['colNames'][] = $this->language->get('column_action'); $grid_settings['colModel'] = array(array('name' => 'image', 'index' => 'image', 'align' => 'center', 'width' => 50, 'sortable' => false, 'search' => false), array('name' => 'name', 'index' => 'name', 'align' => 'left', 'sortable' => false, 'width' => 200), array('name' => 'action', 'index' => 'action', 'align' => 'center', 'width' => 30, 'sortable' => false, 'search' => false)); $grid_settings['search_form'] = true; $grid = $this->dispatch('common/listing_grid', array($grid_settings)); $this->data['response'] = $grid->dispatchGetOutput(); unset($grid); // add js-scripts for grid rows selecting (redeclare onSelectRow event for grid) $view = new AView($this->registry, 0); $view->batchAssign(array('id' => $multivalue_hidden_id, 'form_name' => $form_name . '_' . $multivalue_hidden_id, 'table_id' => $grid_settings['table_id'])); $this->data['response'] .= $view->fetch('responses/catalog/category_listing.tpl'); } else { // json-response for jqgrid $this->loadLanguage('catalog/category'); $this->loadModel('catalog/category'); $this->loadModel('tool/image'); //Prepare filter config $grid_filter_params = array('name'); $filter = new AFilter(array('method' => 'post', 'grid_filter_params' => $grid_filter_params)); $filter_data = $filter->getFilterData(); //Add custom params if (!$filter_data['subsql_filter']) { // without search $parent_id = isset($this->request->get['parent_id']) ? $this->request->get['parent_id'] : 0; $results = $this->model_catalog_category->getCategories($parent_id); $total = sizeof($results); $results = array_slice($results, $filter_data['start'], $filter_data['limit']); } else { $total = $this->model_catalog_category->getTotalCategories($filter_data); $results = $this->model_catalog_category->getCategoriesData($filter_data); } $response = new stdClass(); $response->page = $filter->getParam('page'); $response->total = $filter->calcTotalPages($total); $response->records = $total; $resource = new AResource('image'); $i = 0; $response->userdata = (object) array('page' => $this->request->post['page']); $data_type = 'category_id'; $list = $this->session->data['listing_selected']; $id_list = array(); foreach ($list as $id => $row) { if ($row['status']) { $id_list[] = $id; } } if ($results) { foreach ($results as $result) { if (in_array($result[$data_type], $id_list)) { $response->userdata->selId[] = $result[$data_type]; } $thumbnail = $resource->getMainThumb('categories', $result[$data_type], 36, 36, true); $response->rows[$i]['id'] = $result[$data_type]; $response->rows[$i]['cell'] = array($thumbnail['thumb_html'], $result['name'], '<a class="btn_action" href="JavaScript:void(0);" onclick="showPopup(\'' . $this->html->getSecureURL('catalog/category/update', '&' . $data_type . '=' . $result[$data_type]) . '\')" title="' . $this->language->get('text_view') . '">' . '<img src="' . RDIR_TEMPLATE . 'image/icons/icon_grid_view.png" alt="' . $this->language->get('text_edit') . '" /></a>'); $i++; } } $this->data['response'] = $response; } //update controller data $this->extensions->hk_UpdateData($this, __FUNCTION__); if ($response_type == 'json') { $this->data['response'] = AJson::encode($this->data['response']); } $this->response->setOutput($this->data['response']); }