public function main()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $this->document->setTitle($this->language->get('heading_title'));
     $this->document->initBreadcrumb();
     $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE));
     $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('tool/message_manager'), 'text' => $this->language->get('heading_title'), 'separator' => ' :: '));
     $grid_settings = array('table_id' => 'message_grid', 'url' => $this->html->getSecureURL('listing_grid/message_grid'), 'editurl' => $this->html->getSecureURL('listing_grid/message_grid/update'), 'update_field' => $this->html->getSecureURL('listing_grid/message_grid/update_field'), 'sortname' => 'status', 'actions' => array(), 'columns_search' => false, 'sortable' => true, 'multiaction_options' => array('delete' => $this->language->get('text_delete_selected')));
     $grid_settings['colNames'] = array($this->language->get('column_status'), $this->language->get('column_title'), $this->language->get('column_create_date'), $this->language->get('column_action'));
     $grid_settings['colModel'] = array(array('name' => 'status', 'index' => 'status', 'width' => 50, 'align' => 'center', 'sorttype' => 'string'), array('name' => 'title', 'index' => 'title', 'width' => 250, 'align' => 'left', 'sorttype' => 'string'), array('name' => 'create_date', 'index' => 'create_date', 'width' => 70, 'align' => 'center', 'sorttype' => 'string'), array('name' => 'action', 'index' => 'action', 'width' => 70, 'align' => 'center', 'sorttype' => 'string'));
     $form = new AForm('ff');
     $grid = $this->dispatch('common/listing_grid', array($grid_settings));
     $this->view->assign('listing_grid', $grid->dispatchGetOutput());
     $this->view->assign('popup_action', $this->html->getSecureURL('listing_grid/message_grid/update'));
     $this->view->assign('notifier', $this->html->getSecureURL('listing_grid/message_grid/getNotify'));
     $this->view->assign('status', $this->language->get('text_status'));
     $this->view->assign('status_field', $form->getFieldHtml(array('type' => 'input', 'name' => 'msg_status', 'id' => 'msg_status', 'attr' => 'disabled readonly ')));
     $this->view->assign('create_date', $this->language->get('text_date'));
     $this->view->assign('create_date_field', $form->getFieldHtml(array('type' => 'input', 'name' => 'msg_create_date', 'id' => 'msg_create_date', 'attr' => 'disabled readonly ')));
     $this->view->assign('repeats', $this->language->get('text_repeats'));
     $this->view->assign('repeat_field', $form->getFieldHtml(array('type' => 'input', 'name' => 'msg_repeat', 'id' => 'msg_repeat', 'attr' => 'disabled readonly ')));
     $this->view->assign('delete', $this->language->get('text_delete'));
     $this->view->assign('close', $this->language->get('text_close'));
     $this->view->assign('confirm', $this->language->get('text_confirm'));
     $this->view->batchAssign($this->language->getASet());
     $this->view->assign('help_url', $this->gen_help_url());
     $this->processTemplate('pages/tool/message_manager.tpl');
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
 }
 public function main()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $this->document->setTitle($this->language->get('heading_title'));
     $this->document->initBreadcrumb(array('href' => $this->html->getSecureURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE));
     $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('tool/cache'), 'text' => $this->language->get('heading_title'), 'separator' => ' :: ', 'current' => true));
     $this->data['sections'] = array(array('id' => 'configuration', 'text' => $this->language->get('text_configuration'), 'description' => $this->language->get('desc_configuration'), 'keywords' => 'settings,store,stores,attribute,attributes,length_class,contents,tax_class,order_status,stock_status,weight_class,storefront_menu,tables'), array('id' => 'layout', 'text' => $this->language->get('text_layouts_blocks'), 'description' => $this->language->get('desc_layouts_blocks'), 'keywords' => 'layout'), array('id' => 'flexyforms', 'text' => $this->language->get('text_flexyforms'), 'description' => $this->language->get('desc_flexyforms'), 'keywords' => 'forms'), array('id' => 'translation', 'text' => $this->language->get('text_translations'), 'description' => $this->language->get('desc_translations'), 'keywords' => 'lang'), array('id' => 'image', 'text' => $this->language->get('text_images'), 'description' => $this->language->get('desc_images'), 'keywords' => 'image,resources'), array('id' => 'product', 'text' => $this->language->get('text_products'), 'description' => $this->language->get('desc_products'), 'keywords' => 'product'), array('id' => 'category', 'text' => $this->language->get('text_categories'), 'description' => $this->language->get('desc_categories'), 'keywords' => 'category'), array('id' => 'manufacturer', 'text' => $this->language->get('text_manufacturers'), 'description' => $this->language->get('desc_manufacturers'), 'keywords' => 'manufacturer'), array('id' => 'localisation', 'text' => $this->language->get('text_localisations'), 'description' => $this->language->get('desc_localisations'), 'keywords' => 'currency,country,zone,language'), array('id' => 'error_log', 'text' => $this->language->get('text_error_log'), 'description' => $this->language->get('desc_error_log'), 'keywords' => 'error_log'));
     $form = new AForm('ST');
     $form->setForm(array('form_name' => 'cacheFrm'));
     $this->data['form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'cacheFrm', 'action' => $this->html->getSecureURL('tool/cache/delete')));
     $this->data['form']['submit'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'submit', 'text' => $this->language->get('text_clear_cache'), 'style' => 'button1'));
     if (isset($this->error['warning'])) {
         $this->data['error_warning'] = $this->error['warning'];
     } else {
         $this->data['error_warning'] = '';
     }
     if (isset($this->session->data['success'])) {
         $this->data['success'] = $this->session->data['success'];
         unset($this->session->data['success']);
     } else {
         $this->data['success'] = '';
     }
     $this->view->batchAssign($this->data);
     $this->view->assign('help_url', $this->gen_help_url());
     $this->processTemplate('pages/tool/cache.tpl');
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
 }
 public function main()
 {
     $this->loadModel('tool/developer_tools');
     $this->loadLanguage('developer_tools/developer_tools');
     $prj_id = func_get_arg(0);
     $prj_config = $this->model_tool_developer_tools->getProjectConfig($prj_id);
     $this->data['text_layout_xml_tab'] = $this->language->get('text_layout_xml_tab');
     $this->data['text_select_template'] = $this->language->get('text_select_template');
     $this->data['filepath'] = DIR_EXT . $prj_config['extension_txt_id'] . '/layout.xml';
     $this->data['relative_path'] = 'extensions/' . $prj_config['extension_txt_id'] . '/layout.xml';
     $exist = file_exists($this->data['filepath']) ? true : false;
     if ($exist) {
         $this->data['text_view_layout_xml'] = $this->language->get('text_view_layout_xml');
     }
     $result = $this->db->query("SELECT DISTINCT template_id\n\t\t\t\t\t\t\t\t\tFROM " . DB_PREFIX . "layouts");
     foreach ($result->rows as $row) {
         $templates[$row['template_id']] = $row['template_id'];
     }
     $form = new AForm('ST');
     $form->setForm(array('form_name' => 'extLayoutFrm', 'update' => ''));
     $this->data['form']['id'] = 'extLayoutFrm';
     $this->data['form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'extLayoutFrm', 'action' => $this->data['action']));
     $this->data['form']['submit'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'submit', 'text' => $this->language->get('text_save_layout_xml'), 'style' => 'button1'));
     $this->data['form']['template'] = $form->getFieldHtml(array('type' => 'selectbox', 'name' => 'template_id', 'options' => $templates, 'value' => $prj_config['extension_txt_id']));
     $this->data['xml_build_url'] = $this->html->getSecureUrl('tool/developer_tools_other/savelayoutxml', '&prj_id=' . $prj_id);
     $this->data['text_save_layout_xml'] = $this->language->get('text_save_layout_xml');
     $this->view->batchAssign($this->data);
     $this->processTemplate('responses/tool/developer_tools_other.tpl');
 }
Example #4
0
 public function main()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     if (!$this->customer->isLogged()) {
         $this->session->data['redirect'] = $this->html->getSecureURL('account/newsletter');
         $this->redirect($this->html->getSecureURL('account/login'));
     }
     $this->document->setTitle($this->language->get('heading_title'));
     if ($this->request->is_POST()) {
         $this->loadModel('account/customer');
         $this->model_account_customer->editNewsletter($this->request->post['newsletter']);
         $this->session->data['success'] = $this->language->get('text_success');
         $this->redirect($this->html->getURL('account/account'));
     }
     $this->document->resetBreadcrumbs();
     $this->document->addBreadcrumb(array('href' => $this->html->getURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE));
     $this->document->addBreadcrumb(array('href' => $this->html->getURL('account/account'), 'text' => $this->language->get('text_account'), 'separator' => $this->language->get('text_separator')));
     $this->document->addBreadcrumb(array('href' => $this->html->getURL('account/newsletter'), 'text' => $this->language->get('text_newsletter'), 'separator' => $this->language->get('text_separator')));
     $form = new AForm();
     $form->setForm(array('form_name' => 'newsFrm'));
     $this->data['form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'newsFrm', 'action' => $this->html->getSecureURL('account/newsletter')));
     $this->data['form']['newsletter'] = $form->getFieldHtml(array('type' => 'radio', 'name' => 'newsletter', 'value' => $this->customer->getNewsletter(), 'options' => array('1' => $this->language->get('text_yes'), '0' => $this->language->get('text_no'))));
     $this->data['form']['continue'] = $form->getFieldHtml(array('type' => 'submit', 'icon' => 'fa fa-check', 'name' => $this->language->get('button_continue')));
     $this->data['back'] = $this->html->getURL('account/account');
     $back = HtmlElementFactory::create(array('type' => 'button', 'name' => 'back', 'text' => $this->language->get('button_back'), 'icon' => 'fa fa-arrow-left', 'style' => 'button'));
     $this->data['form']['back'] = $back;
     $this->view->batchAssign($this->data);
     $this->processTemplate('pages/account/newsletter.tpl');
     //init controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
 }
 public function main()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $this->document->setTitle($this->language->get('heading_title'));
     $this->document->initBreadcrumb();
     $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE));
     $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('tool/datasets_manager'), 'text' => $this->language->get('heading_title'), 'separator' => ' :: ', 'current' => true));
     $grid_settings = array('table_id' => 'dataset_grid', 'url' => $this->html->getSecureURL('listing_grid/datasets_grid'), 'editurl' => $this->html->getSecureURL('listing_grid/datasets_grid/update'), 'update_field' => $this->html->getSecureURL('listing_grid/datasets_grid/update_field'), 'sortname' => 'dataset_id', 'actions' => array('view' => array('text' => $this->language->get('text_show'), 'href' => $this->html->getSecureURL('listing_grid/datasets_grid/info', '&dataset_id=%ID%'))), 'columns_search' => false, 'sortable' => true, 'multiselect' => 'false', 'grid_ready' => 'grid_ready();');
     $grid_settings['colNames'] = array($this->language->get('column_id'), $this->language->get('column_name'), $this->language->get('column_key'));
     $grid_settings['colModel'] = array(array('name' => 'dataset_id', 'index' => 'dataset_id', 'width' => 30, 'align' => 'center', 'sorttype' => 'string'), array('name' => 'dataset_name', 'index' => 'dataset_name', 'width' => 450, 'align' => 'left', 'sorttype' => 'string'), array('name' => 'dataset_key', 'index' => 'dataset_key', 'width' => 150, 'align' => 'left', 'sorttype' => 'string'));
     $form = new AForm('ds');
     $grid = $this->dispatch('common/listing_grid', array($grid_settings));
     $this->view->assign('listing_grid', $grid->dispatchGetOutput());
     $this->view->assign('popup_action', $this->html->getSecureURL('listing_grid/datasets_grid/info'));
     $this->view->assign('popup_title', $this->language->get('text_popup_title'));
     $this->view->assign('date_added', $this->language->get('text_date'));
     $this->view->assign('create_date_field', $form->getFieldHtml(array('type' => 'input', 'name' => 'msg_create_date', 'id' => 'msg_create_date', 'attr' => 'readonly=true')));
     $this->view->assign('repeats', $this->language->get('text_repeats'));
     $this->view->assign('repeat_field', $form->getFieldHtml(array('type' => 'input', 'name' => 'msg_repeat', 'id' => 'msg_repeat', 'attr' => 'readonly=true')));
     //$this->view->assign ( 'delete', $this->language->get ( 'text_delete' ) );
     $this->view->assign('confirm', $this->language->get('text_confirm'));
     $this->view->batchAssign($this->language->getASet());
     $this->view->assign('help_url', $this->gen_help_url());
     $this->processTemplate('pages/tool/datasets_manager.tpl');
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
 }
Example #6
0
 public function main()
 {
     $this->data = array();
     $run_level = $this->request->get['runlevel'];
     if (isset($run_level)) {
         if (!in_array((int) $run_level, array(1, 2, 3, 4, 5))) {
             $this->redirect(HTTP_SERVER . 'index.php?rt=activation' . '&admin_path=' . $this->request->post['admin_path']);
         }
         if (!$this->session->data['install_step_data'] && (int) $run_level == 1) {
             if (filesize(DIR_ABANTECART . 'system/config.php')) {
                 $this->redirect(HTTP_SERVER . 'index.php?rt=activation');
             } else {
                 $this->redirect(HTTP_SERVER . 'index.php?rt=license');
             }
         }
         echo $this->runlevel((int) $run_level);
         return null;
     }
     if ($this->request->is_POST() && $this->_validate()) {
         $this->session->data['install_step_data'] = $this->request->post;
         $this->redirect(HTTP_SERVER . 'index.php?rt=install&runlevel=1');
     }
     $this->data['error'] = $this->error;
     $this->data['action'] = HTTP_SERVER . 'index.php?rt=install';
     $fields = array('db_driver', 'db_host', 'db_user', 'db_password', 'db_name', 'db_prefix', 'username', 'password', 'password_confirm', 'email', 'admin_path');
     $defaults = array('', 'localhost', '', '', '', 'abc_', 'admin', '', '', '', '');
     $place_holder = array('Select Database Driver', 'Enter Database Hostname', 'Enter Database Username', 'Enter Password, if any', 'Enter Database Name', 'Add prefix to database tables', 'Enter new admin username', 'Enter Secret Admin Password', 'Repeat the password', 'Provide valid email of administrator', 'Enter your secret admin key');
     foreach ($fields as $k => $field) {
         if (isset($this->request->post[$field])) {
             $this->data[$field] = $this->request->post[$field];
         } else {
             $this->data[$field] = $defaults[$k];
         }
     }
     $form = new AForm('ST');
     $form->setForm(array('form_name' => 'form', 'update' => ''));
     $this->data['form']['id'] = 'form';
     $this->data['form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'editFrm', 'action' => $this->data['action']));
     foreach ($fields as $k => $field) {
         if ($field != 'db_driver') {
             $this->data['form'][$field] = $form->getFieldHtml(array('type' => in_array($field, array('password', 'password_confirm')) ? 'password' : 'input', 'name' => $field, 'value' => $this->data[$field], 'placeholder' => $place_holder[$k], 'required' => in_array($field, array('db_host', 'db_user', 'db_name', 'username', 'password', 'password_confirm', 'email', 'admin_path'))));
         } else {
             $options = array();
             //regular mysql is not supported on PHP 5.5.+
             if (extension_loaded('mysql') && version_compare(phpversion(), '5.5.0', '<') == TRUE) {
                 $options['mysql'] = 'MySQL';
             }
             if (extension_loaded('mysqli')) {
                 $options['amysqli'] = 'MySQLi';
             }
             $this->data['form'][$field] = $form->getFieldHtml(array('type' => 'selectbox', 'name' => $field, 'value' => $this->data[$field], 'options' => $options, 'required' => true));
         }
     }
     $this->view->assign('back', HTTP_SERVER . 'index.php?rt=settings');
     $this->addChild('common/header', 'header', 'common/header.tpl');
     $this->addChild('common/footer', 'footer', 'common/footer.tpl');
     $this->view->batchAssign($this->data);
     $this->processTemplate('pages/install.tpl');
 }
Example #7
0
 public function main()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $this->loadLanguage('catalog/product');
     $this->document->setTitle($this->language->get('heading_title'));
     $this->loadModel('catalog/product');
     $this->loadModel('tool/image');
     if (isset($this->request->get['product_id'])) {
         $product_info = $this->model_catalog_product->getProduct($this->request->get['product_id']);
         if (!$product_info) {
             $this->session->data['warning'] = $this->language->get('error_product_not_found');
             $this->redirect($this->html->getSecureURL('catalog/product'));
         }
     }
     if ($this->request->server['REQUEST_METHOD'] == 'POST') {
         $this->model_catalog_product->updateProductImages($this->request->get['product_id'], $this->request->post);
         $this->session->data['success'] = $this->language->get('text_success');
         $this->redirect($this->html->getSecureURL('catalog/product_images', '&product_id=' . $this->request->get['product_id']));
     }
     $this->data['product_description'] = $this->model_catalog_product->getProductDescriptions($this->request->get['product_id']);
     $this->view->assign('error_warning', $this->error['warning']);
     $this->view->assign('success', $this->session->data['success']);
     if (isset($this->session->data['success'])) {
         unset($this->session->data['success']);
     }
     $this->document->initBreadcrumb(array('href' => $this->html->getSecureURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE));
     $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('catalog/product'), 'text' => $this->language->get('heading_title'), 'separator' => ' :: '));
     $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('catalog/product/update', '&product_id=' . $this->request->get['product_id']), 'text' => $this->language->get('text_edit') . '&nbsp;' . $this->language->get('text_product') . ' - ' . $this->data['product_description'][$this->session->data['content_language_id']]['name'], 'separator' => ' :: '));
     $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('catalog/product_images', '&product_id=' . $this->request->get['product_id']), 'text' => $this->language->get('tab_media'), 'separator' => ' :: '));
     $this->data['no_image'] = $this->model_tool_image->resize('no_image.jpg', 100, 100);
     $this->data['active'] = 'images';
     //load tabs controller
     $tabs_obj = $this->dispatch('pages/catalog/product_tabs', array($this->data));
     $this->data['product_tabs'] = $tabs_obj->dispatchGetOutput();
     unset($tabs_obj);
     $this->data['button_add_image'] = $this->html->buildButton(array('text' => $this->language->get('button_add_image'), 'style' => 'button1'));
     $this->data['action'] = $this->html->getSecureURL('catalog/product_images', '&product_id=' . $this->request->get['product_id']);
     $this->data['form_title'] = $this->language->get('text_edit') . '&nbsp;' . $this->language->get('text_product');
     $this->data['update'] = '';
     $form = new AForm('HS');
     $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']));
     $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->view->batchAssign($this->data);
     $this->view->assign('help_url', $this->gen_help_url('product_media'));
     $this->addChild('pages/catalog/product_summary', 'summary_form', 'pages/catalog/product_summary.tpl');
     $this->addChild('responses/common/resource_library/get_resources_html', 'resources_html', 'responses/common/resource_library_scripts.tpl');
     $resources_scripts = $this->dispatch('responses/common/resource_library/get_resources_scripts', array('object_name' => 'products', 'object_id' => $this->request->get['product_id'], 'types' => array('image', 'audio', 'video', 'pdf')));
     $this->view->assign('resources_scripts', $resources_scripts->dispatchGetOutput());
     $this->processTemplate('pages/catalog/product_images.tpl');
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
 }
 public function main()
 {
     $this->loadLanguage('blocks/newsletter_signup');
     $form = new AForm();
     $this->data['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'subscribeFrm', 'method' => 'get', 'action' => $this->html->getSecureURL('account/subscriber', '', true)));
     $this->data['heading_title'] = $this->language->get('heading_title');
     $this->data['text_signup'] = $this->language->get('text_signup');
     $this->data['text_sign_in'] = $this->language->get('text_sign_in');
     $this->data['text_subscribe'] = $this->language->get('text_subscribe');
     $this->data['form_fields']['rt'] = 'account/subscriber';
     $this->view->batchAssign($this->data);
     $this->processTemplate();
 }
Example #9
0
 public function main()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $grid_settings = array('table_id' => 'report_sales_grid', 'url' => $this->html->getSecureURL('listing_grid/report_sale'), 'sortname' => 'date_end', 'columns_search' => false, 'multiselect' => 'false');
     $form = new AForm();
     $form->setForm(array('form_name' => 'report_sales_grid_search'));
     $this->data['grid_search_form'] = array();
     $this->data['grid_search_form']['id'] = 'report_sales_grid_search';
     $this->data['grid_search_form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'report_sales_grid_search', 'action' => ''));
     $this->data['grid_search_form']['submit'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'submit', 'text' => $this->language->get('button_go'), 'style' => 'button1'));
     $this->data['grid_search_form']['reset'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'reset', 'text' => $this->language->get('button_reset'), 'style' => 'button2'));
     $this->view->assign('js_date_format', format4Datepicker($this->language->get('date_format_short')));
     $this->data['grid_search_form']['fields']['date_start'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'date_start', 'default' => dateInt2Display(strtotime('-7 day'))));
     $this->data['grid_search_form']['fields']['date_end'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'date_end', 'default' => dateInt2Display(time())));
     $groups = array();
     $groups['year'] = $this->language->get('text_year');
     $groups['month'] = $this->language->get('text_month');
     $groups['week'] = $this->language->get('text_week');
     $groups['day'] = $this->language->get('text_day');
     $this->data['grid_search_form']['fields']['status'] = $form->getFieldHtml(array('type' => 'selectbox', 'name' => 'group', 'options' => $groups, 'value' => "week"));
     $grid_settings['search_form'] = true;
     $grid_settings['colNames'] = array($this->language->get('column_date_start'), $this->language->get('column_date_end'), $this->language->get('column_orders'), $this->language->get('column_total'));
     $grid_settings['colModel'] = array(array('name' => 'date_start', 'index' => 'date_start', 'width' => 100, 'align' => 'center', 'sorttype' => 'string'), array('name' => 'date_end', 'index' => 'date_end', 'width' => 100, 'align' => 'center', 'sorttype' => 'string'), array('name' => 'orders', 'index' => 'orders', 'width' => 100, 'align' => 'center', 'sorttype' => 'string'), array('name' => 'total', 'index' => 'total', 'width' => 110, 'align' => 'right'));
     $grid = $this->dispatch('common/listing_grid', array($grid_settings));
     $this->view->assign('listing_grid', $grid->dispatchGetOutput());
     $this->view->assign('search_form', $this->data['grid_search_form']);
     $this->document->setTitle($this->language->get('heading_title'));
     $this->document->initBreadcrumb(array('href' => $this->html->getSecureURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE));
     $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('report/viewed'), 'text' => $this->language->get('heading_title'), 'separator' => ' :: '));
     $this->document->addScript(RDIR_TEMPLATE . 'javascript/jquery/ui/jquery.ui.datepicker.js');
     $this->processTemplate('pages/report/sale.tpl');
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
 }
Example #10
0
 public function download()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     if ($this->user->canAccess('tool/files')) {
         $filename = str_replace(array('../', '..\\', '\\', '/'), '', $this->request->get['filename']);
         if ($this->request->get['attribute_type'] == 'field') {
             $this->loadModel('tool/file_uploads');
             $attribute_data = $this->model_tool_file_uploads->getField($this->request->get['attribute_id']);
         } elseif (strpos($this->request->get['attribute_type'], 'AForm:') === 0) {
             // for aform fields
             $form_info = explode(':', $this->request->get['attribute_type']);
             $aform = new AForm('ST');
             $aform->loadFromDb($form_info[1]);
             $attribute_data = $aform->getField($form_info[2]);
         } elseif ($this->request->get['order_option_id']) {
             $this->loadModel('sale/order');
             $attribute_data = $this->model_sale_order->getOrderOption($this->request->get['order_option_id']);
             $attribute_data['settings'] = unserialize($attribute_data['settings']);
         } else {
             $am = new AAttribute($this->request->get['attribute_type']);
             $attribute_data = $am->getAttribute($this->request->get['attribute_id']);
         }
         if (has_value($attribute_data['settings']['directory'])) {
             $file = DIR_APP_SECTION . 'system/uploads/' . $attribute_data['settings']['directory'] . '/' . $filename;
         } else {
             $file = DIR_APP_SECTION . 'system/uploads/' . $filename;
         }
         if (file_exists($file)) {
             header('Content-Description: File Transfer');
             header('Content-Type: application/x-gzip');
             header('Content-Disposition: attachment; filename=' . $filename);
             header('Content-Transfer-Encoding: binary');
             header('Expires: 0');
             header('Cache-Control: must-revalidate');
             header('Pragma: public');
             header('Content-Length: ' . filesize($file));
             ob_end_clean();
             flush();
             readfile($file);
             exit;
         } else {
             echo 'Error: File ' . $file . ' does not exists!';
             exit;
         }
     } else {
         return $this->dispatch('error/permission');
     }
 }
 public function main()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $this->document->setTitle($this->language->get('heading_title'));
     $this->loadModel('setting/setting');
     if ($this->request->is_POST() && $this->_validate()) {
         $this->model_setting_setting->editSetting('sub_total', $this->request->post);
         $this->session->data['success'] = $this->language->get('text_success');
         $this->redirect($this->html->getSecureURL('total/sub_total'));
     }
     if (isset($this->error['warning'])) {
         $this->data['error_warning'] = $this->error['warning'];
     } else {
         $this->data['error_warning'] = '';
     }
     $this->data['success'] = $this->session->data['success'];
     if (isset($this->session->data['success'])) {
         unset($this->session->data['success']);
     }
     $this->document->initBreadcrumb(array('href' => $this->html->getSecureURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE));
     $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('extension/total'), 'text' => $this->language->get('text_total'), 'separator' => ' :: '));
     $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('total/sub_total'), 'text' => $this->language->get('heading_title'), 'separator' => ' :: ', 'current' => true));
     foreach ($this->fields as $f) {
         if (isset($this->request->post[$f])) {
             $this->data[$f] = $this->request->post[$f];
         } else {
             $this->data[$f] = $this->config->get($f);
         }
     }
     $this->data['action'] = $this->html->getSecureURL('total/sub_total');
     $this->data['cancel'] = $this->html->getSecureURL('extension/total');
     $this->data['heading_title'] = $this->language->get('text_edit') . ' ' . $this->language->get('text_total');
     $this->data['form_title'] = $this->language->get('heading_title');
     $this->data['update'] = $this->html->getSecureURL('listing_grid/total/update_field', '&id=sub_total');
     $form = new AForm('HS');
     $form->setForm(array('form_name' => 'editFrm', 'update' => $this->data['update']));
     $this->data['form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'editFrm', 'action' => $this->data['action'], 'attr' => 'data-confirm-exit="true" class="aform form-horizontal"'));
     $this->data['form']['submit'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'submit', 'text' => $this->language->get('button_save')));
     $this->data['form']['cancel'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'cancel', 'text' => $this->language->get('button_cancel')));
     $this->data['form']['fields']['status'] = $form->getFieldHtml(array('type' => 'checkbox', 'name' => 'sub_total_status', 'value' => $this->data['sub_total_status'], 'style' => 'btn_switch status_switch'));
     $this->loadLanguage('extension/extensions');
     $options = array('subtotal' => $this->language->get('text_subtotal'), 'shipping' => $this->language->get('text_shipping'), 'fee' => $this->language->get('text_fee'), 'discount' => $this->language->get('text_discount'), 'total' => $this->language->get('text_total'), 'tax' => $this->language->get('text_tax'));
     $this->data['form']['fields']['total_type'] = $form->getFieldHtml(array('type' => 'selectbox', 'name' => 'sub_total_total_type', 'options' => $options, 'value' => $this->data['sub_total_total_type']));
     $this->data['form']['fields']['sort_order'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'sub_total_sort_order', 'value' => $this->data['sub_total_sort_order']));
     $this->data['form']['fields']['calculation_order'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'sub_total_calculation_order', 'value' => $this->data['sub_total_calculation_order']));
     $this->view->assign('help_url', $this->gen_help_url('edit_sub_total'));
     $this->view->batchAssign($this->data);
     $this->processTemplate('pages/total/form.tpl');
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
 }
 private function _getForm()
 {
     if (isset($this->error['warning'])) {
         $this->data['error_warning'] = $this->error['warning'];
     } else {
         $this->data['error_warning'] = '';
     }
     $this->data['error'] = $this->error;
     $this->data['cancel'] = $this->html->getSecureURL('localisation/language_definitions');
     if (!isset($this->request->get['language_definition_id'])) {
         $this->data['action'] = $this->html->getSecureURL($this->rt . '/update', '&target=' . $this->request->get['target']);
         $this->data['heading_title'] = $this->language->get('text_insert') . ' ' . $this->language->get('text_definition');
         $this->data['update'] = '';
         $form = new AForm('ST');
         $this->data['language_definition_id'] = (int) $this->request->get['language_definition_id'];
         $this->data['check_url'] = $this->html->getSecureURL('listing_grid/language_definitions/checkdefinition');
     } else {
         $this->data['action'] = $this->html->getSecureURL($this->rt . '/update', '&language_definition_id=' . $this->request->get['language_definition_id'] . '&target=' . $this->request->get['target']);
         $this->data['heading_title'] = $this->language->get('text_edit') . ' ' . $this->language->get('text_definition');
         $this->data['update'] = $this->html->getSecureURL('listing_grid/language_definitions/update_field', '&id=' . $this->request->get['language_definition_id']);
         $form = new AForm('HS');
     }
     $dispatch = $this->dispatch('responses/common/form_collector', array('form_id' => 'definitionQFrm', 'target' => $this->request->get['target']));
     $this->data['form_collector'] = $dispatch->dispatchGetOutput();
     $this->document->addBreadcrumb(array('href' => $this->data['action'], 'text' => $this->data['heading_title'], 'separator' => ' :: '));
     $form->setForm(array('form_name' => 'definitionQFrm', 'update' => $this->data['update']));
     $this->data['form']['id'] = 'definitionQFrm';
     $this->data['form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'definitionQFrm', 'action' => $this->data['action']));
     //build the rest of the form and data
     $ret_data = $this->model_localisation_language_definitions->buildFormData($this->request, $this->data, $form);
     if ($ret_data['redirect_params']) {
         $this->redirect($this->data['action'] . $ret_data['redirect_params']);
     }
     $this->view->assign('form_language_switch', $this->html->getContentLanguageFlags());
     $this->view->assign('ajax_wrapper_id', $this->request->get['target']);
     $this->view->assign('ajax_reload_url', $this->html->getSecureURL($this->rt . '/update', '&language_definition_id=' . $this->request->get['language_definition_id'] . '&target=' . $this->request->get['target']));
     $this->view->assign('help_url', $this->gen_help_url('language_definition_edit'));
     $this->view->batchAssign($this->data);
     $this->view->setTemplate('responses/localisation/language_definitions_form.tpl');
     $this->view->render();
     $output['html'] = $this->view->getOutput();
     $output['title'] = $this->data['heading_title'];
     $this->load->library('json');
     $this->response->setOutput(AJson::encode($output));
 }
Example #13
0
 public function main()
 {
     $this->load->model('checkout/order');
     $order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']);
     $data['action'] = '';
     $form = new AForm();
     $form->setForm(array('form_name' => 'checkout'));
     $data['form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'checkout', 'action' => 'https://www.liqpay.com/?do=clickNbuy'));
     $xml = '<response>';
     $xml .= '	<version>1.2</version>';
     $xml .= '	<result_url>' . $this->html->getSecureURL('checkout/success') . '</result_url>';
     $xml .= '	<server_url>' . $this->html->getSecureURL('extension/liqpay/callback') . '</server_url>';
     $xml .= '	<merchant_id>' . $this->config->get('default_liqpay_merchant') . '</merchant_id>';
     $xml .= '	<order_id>' . $this->session->data['order_id'] . '</order_id>';
     $xml .= '	<amount>' . $this->currency->format($order_info['total'], $order_info['currency'], $order_info['value'], FALSE) . '</amount>';
     $xml .= '	<currency>' . $order_info['currency'] . '</currency>';
     $xml .= '	<description>' . $this->config->get('store_name') . ' ' . $order_info['payment_firstname'] . ' ' . $order_info['payment_address_1'] . ' ' . $order_info['payment_address_2'] . ' ' . $order_info['payment_city'] . ' ' . $order_info['email'] . '</description>';
     $xml .= '	<sender_phone></sender_phone>';
     $xml .= '	<pay_way>' . $this->config->get('default_liqpay_type') . '</pay_way>';
     $xml .= '</response>';
     $data['form']['xml'] = $form->getFieldHtml(array('type' => 'hidden', 'name' => 'xml', 'value' => base64_encode($xml)));
     $data['form']['signature'] = $form->getFieldHtml(array('type' => 'hidden', 'name' => 'signature', 'value' => base64_encode(sha1($this->config->get('default_liqpay_signature') . $xml . $this->config->get('default_liqpay_signature'), TRUE))));
     $back = $this->request->get['rt'] != 'checkout/guest_step_3' ? $this->html->getSecureURL('checkout/payment') : $this->html->getSecureURL('checkout/guest_step_2');
     $data['form']['back'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'back', 'text' => $this->language->get('button_back'), 'style' => 'button', 'href' => $back));
     $data['form']['submit'] = $form->getFieldHtml(array('type' => 'submit', 'name' => $this->language->get('button_confirm')));
     $this->view->batchAssign($data);
     $this->processTemplate('responses/default_liqpay.tpl');
 }
Example #14
0
 /**
  * @return bool
  */
 private function _validate()
 {
     $this->error = array_merge($this->form->validateFormData($this->request->post), $this->error);
     if (!$this->error) {
         return TRUE;
     } else {
         $this->form->setErrors($this->error);
         return FALSE;
     }
 }
Example #15
0
 /**
  * @return bool
  */
 private function _validate()
 {
     $this->error = array_merge($this->form->validateFormData($this->request->post), $this->error);
     $this->extensions->hk_ValidateData($this);
     if (!$this->error) {
         return true;
     } else {
         $this->form->setErrors($this->error);
         return false;
     }
 }
 public function main()
 {
     $action = func_get_arg(0);
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $this->loadLanguage('checkout/payment');
     if (!$this->config->get('coupon_status')) {
         return null;
     }
     $this->data['coupon_status'] = $this->config->get('coupon_status');
     $entereted_cpn = isset($this->request->post['coupon']) ? $this->request->post['coupon'] : $this->session->data['coupon'];
     $form = new AForm();
     $form->setForm(array('form_name' => 'coupon'));
     $this->data['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'coupon', 'action' => $action));
     $this->data['coupon'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'coupon', 'value' => $entereted_cpn));
     $this->data['submit'] = $form->getFieldHtml(array('type' => 'submit', 'name' => $this->language->get('button_coupon')));
     $this->view->batchAssign($this->data);
     $this->processTemplate('blocks/coupon_form.tpl');
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
 }
 public function main()
 {
     $this->loadModel('tool/developer_tools');
     $this->loadLanguage('developer_tools/developer_tools');
     $prj_id = $this->session->data['dev_tools_prj_id'];
     $prj_config = $this->model_tool_developer_tools->getProjectConfig($prj_id);
     $this->data['text_layout_xml_title'] = $this->language->get('text_layout_xml_title');
     $this->data['text_select_template'] = $this->language->get('text_select_template');
     $this->data['filepath'] = DIR_EXT . $prj_config['extension_txt_id'] . '/layout.xml';
     if (!is_file($this->data['filepath']) || !is_readable($this->data['filepath'])) {
         $this->data['filepath'] = null;
     }
     $this->data['relative_path'] = 'extensions/' . $prj_config['extension_txt_id'] . '/layout.xml';
     $this->document->initBreadcrumb(array('href' => $this->html->getSecureURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => false));
     $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('tool/developer_tools'), 'text' => $this->language->get('developer_tools_name'), 'separator' => ' :: ', 'current' => true));
     //load tabs controller
     $tabs_obj = $this->dispatch('pages/tool/developer_tools_tabs', array('project'));
     $this->data['dev_tabs'] = $tabs_obj->dispatchGetOutput();
     $tabs_obj = $this->dispatch('pages/tool/developer_tools_tabs/prjtabs', array('other'));
     $this->data['prj_tabs'] = $tabs_obj->dispatchGetOutput();
     $exist = file_exists($this->data['filepath']) ? true : false;
     if ($exist) {
         $this->data['text_view_layout_xml'] = $this->language->get('text_view_layout_xml');
     }
     $result = $this->db->query("SELECT DISTINCT template_id\n\t\t\t\t\t\t\t\t\tFROM " . $this->db->table("layouts"));
     foreach ($result->rows as $row) {
         $templates[$row['template_id']] = $row['template_id'];
     }
     $form = new AForm('ST');
     $form->setForm(array('form_name' => 'extLayoutFrm', 'update' => ''));
     $this->data['form']['id'] = 'extLayoutFrm';
     $this->data['form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'extLayoutFrm', 'action' => $this->data['action']));
     $this->data['form']['submit'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'submit', 'text' => $this->language->get('developer_tools_text_save_layout_xml'), 'style' => 'button1'));
     $this->data['form']['template'] = $form->getFieldHtml(array('type' => 'selectbox', 'name' => 'template_id', 'options' => $templates, 'value' => $prj_config['extension_txt_id']));
     $this->data['xml_build_url'] = $this->html->getSecureUrl('r/tool/developer_tools_other/savelayoutxml', '&prj_id=' . $prj_id);
     $this->data['text_save_layout_xml'] = $this->language->get('text_save_layout_xml');
     $this->data['info'] = $this->language->get('developer_tools_info_about_layouts');
     $this->view->batchAssign($this->data);
     $this->processTemplate('pages/tool/developer_tools_other.tpl');
 }
 public function main()
 {
     $fields = array();
     $this->load->model('checkout/order');
     $this->loadLanguage('default_skrill/default_skrill');
     $cancel_url = $this->request->get['rt'] != 'checkout/guest_step_3' ? $this->html->getSecureURL('checkout/payment') : $this->html->getSecureURL('checkout/guest_step_2');
     if (is_file(DIR_RESOURCE . $this->config->get('config_logo'))) {
         $logo = HTTPS_DIR_RESOURCE . $this->config->get('config_logo');
     } else {
         $logo = $this->config->get('config_logo');
     }
     $order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']);
     $products = '';
     foreach ($this->cart->getProducts() as $product) {
         $products .= $product['quantity'] . ' x ' . $product['name'] . ', ';
     }
     $this->load->library('encryption');
     $encryption = new AEncryption($this->config->get('encryption_key'));
     $skrill_url = 'https://pay.skrill.com';
     //$skrill_url = 'https://sandbox.dev.skrillws.net/pay';
     $fields = array('rid' => '53571612', 'ext_ref_id' => 'abantecart', 'pay_to_email' => $this->config->get('default_skrill_email'), 'recipient_description' => $this->config->get('store_name'), 'transaction_id' => $this->session->data['order_id'] . '_' . UNIQUE_ID, 'return_url' => $this->html->getSecureURL('checkout/success'), 'cancel_url' => $cancel_url, 'status_url' => $this->html->getSecureURL('extension/default_skrill/callback'), 'language' => $this->session->data['language'], 'logo_url' => $logo, 'pay_from_email' => $order_info['email'], 'firstname' => $order_info['payment_firstname'], 'lastname' => $order_info['payment_lastname'], 'address' => $order_info['payment_address_1'], 'address2' => $order_info['payment_address_2'], 'phone_number' => $order_info['telephone'], 'postal_code' => substr($order_info['payment_postcode'], 0, 9), 'city' => $order_info['payment_city'], 'state' => $order_info['payment_zone'], 'country' => $order_info['payment_iso_code_3'], 'amount' => $this->currency->format($order_info['total'], $order_info['currency'], $order_info['value'], FALSE), 'currency' => $order_info['currency'], 'detail1_text' => $products, 'merchant_fields' => 'order_id', 'order_id' => $encryption->encrypt($this->session->data['order_id']));
     $form = new AForm();
     $form->setForm(array('form_name' => 'checkout'));
     $data['form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'checkout', 'action' => $skrill_url));
     foreach ($fields as $key => $value) {
         $data['form'][$key] = $form->getFieldHtml(array('type' => 'hidden', 'name' => $key, 'value' => $value));
     }
     $data['form']['back'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'back', 'text' => $this->language->get('button_back'), 'style' => 'button', 'href' => $back));
     $data['form']['submit'] = $form->getFieldHtml(array('type' => 'submit', 'name' => $this->language->get('button_confirm')));
     $this->view->batchAssign($data);
     $this->processTemplate('responses/default_skrill.tpl');
 }
 protected function getBlockContent($instance_id)
 {
     $block_info = $this->layout->getBlockDetails($instance_id);
     $custom_block_id = $block_info['custom_block_id'];
     $descriptions = $this->layout->getBlockDescriptions($custom_block_id);
     if ($descriptions[$this->config->get('storefront_language_id')]) {
         $key = $this->config->get('storefront_language_id');
     } else {
         $key = $descriptions ? key($descriptions) : null;
     }
     if ($descriptions[$key]['content']) {
         $content = unserialize($descriptions[$key]['content']);
     } else {
         $content = array('form_id' => null);
     }
     $this->loadModel('tool/forms_manager');
     $form_data = $this->model_tool_forms_manager->getForm($content['form_id']);
     if (empty($form_data)) {
         return array();
     }
     $field_types = $this->model_tool_forms_manager->getFieldTypes($content['form_id']);
     $form = new AForm();
     $form->loadFromDb($form_data['form_name']);
     $form_info = $form->getForm();
     $form_info['controller'] = $form_info['controller'] . '&form_id=' . $content['form_id'];
     $form->setForm($form_info);
     if (isset($this->session->data['custom_form_' . $content['form_id']]['errors'])) {
         $form->setErrors($this->session->data['custom_form_' . $content['form_id']]['errors']);
         unset($this->session->data['custom_form_' . $content['form_id']]['errors']);
     }
     $output = array('title' => $key ? $descriptions[$key]['title'] : '', 'content' => $form->getFormHtml(), 'block_wrapper' => $key ? $descriptions[$key]['block_wrapper'] : 0, 'block_framed' => $key ? (int) $descriptions[$key]['block_framed'] : 0);
     return $output;
 }
Example #20
0
 public function main()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $grid_settings = array('table_id' => 'report_purchased_grid', 'url' => $this->html->getSecureURL('listing_grid/report_purchased'), 'sortname' => 'quantity', 'columns_search' => false, 'multiselect' => 'false', 'search_form' => true);
     $grid_settings['colNames'] = array($this->language->get('column_name'), $this->language->get('column_model'), $this->language->get('column_quantity'), $this->language->get('column_total'));
     $grid_settings['colModel'] = array(array('name' => 'name', 'index' => 'name', 'width' => 300, 'align' => 'left', 'sortable' => false), array('name' => 'model', 'index' => 'model', 'width' => 80, 'align' => 'center', 'sortable' => false), array('name' => 'quantity', 'index' => 'quantity', 'width' => 50, 'align' => 'center', 'sortable' => false), array('name' => 'total', 'index' => 'total', 'width' => 90, 'align' => 'center', 'sortable' => false));
     $grid = $this->dispatch('common/listing_grid', array($grid_settings));
     $this->view->assign('listing_grid', $grid->dispatchGetOutput());
     //prepare the filter form
     //Note: External search form needs to be named [grid_name]_search
     //		In this case it will be auto submited to filter grid
     $form = new AForm();
     $form->setForm(array('form_name' => 'report_purchased_grid_search'));
     $this->data['grid_search_form'] = array();
     $this->data['grid_search_form']['id'] = 'report_purchased_grid_search';
     $this->data['grid_search_form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'report_purchased_grid_search', 'action' => ''));
     $this->data['grid_search_form']['submit'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'submit', 'text' => $this->language->get('button_go'), 'style' => 'button1'));
     $this->view->assign('js_date_format', format4Datepicker($this->language->get('date_format_short')));
     $this->data['grid_search_form']['fields']['date_start'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'date_start', 'default' => dateInt2Display(strtotime('-30 day'))));
     $this->data['grid_search_form']['fields']['date_end'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'date_end', 'default' => dateInt2Display(time())));
     $this->view->assign('search_form', $this->data['grid_search_form']);
     $this->document->initBreadcrumb(array('href' => $this->html->getSecureURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE));
     $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('report/purchased'), 'text' => $this->language->get('heading_title'), 'separator' => ' :: ', 'current' => true));
     $this->document->setTitle($this->language->get('heading_title'));
     $this->processTemplate('pages/report/purchased.tpl');
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
 }
Example #21
0
 public function main()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $this->document->setTitle($this->language->get('heading_title'));
     $this->loadModel('setting/setting');
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->_validate()) {
         $this->model_setting_setting->editSetting('balance', $this->request->post);
         $this->session->data['success'] = $this->language->get('text_success');
         $this->redirect($this->html->getSecureURL('total/balance'));
     }
     if (isset($this->error['warning'])) {
         $this->data['error_warning'] = $this->error['warning'];
     } else {
         $this->data['error_warning'] = '';
     }
     $this->data['success'] = $this->session->data['success'];
     if (isset($this->session->data['success'])) {
         unset($this->session->data['success']);
     }
     $this->document->initBreadcrumb(array('href' => $this->html->getSecureURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE));
     $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('extension/total'), 'text' => $this->language->get('text_total'), 'separator' => ' :: '));
     $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('total/balance'), 'text' => $this->language->get('heading_title'), 'separator' => ' :: '));
     foreach ($this->fields as $f) {
         if (isset($this->request->post[$f])) {
             $this->data[$f] = $this->request->post[$f];
         } else {
             $this->data[$f] = $this->config->get($f);
         }
     }
     $this->data['action'] = $this->html->getSecureURL('total/balance');
     $this->data['cancel'] = $this->html->getSecureURL('extension/total');
     $this->data['heading_title'] = $this->language->get('text_edit') . ' ' . $this->language->get('text_total');
     $this->data['form_title'] = $this->language->get('heading_title');
     $this->data['update'] = $this->html->getSecureURL('listing_grid/total/update_field', '&id=balance');
     $form = new AForm('HS');
     $form->setForm(array('form_name' => 'editFrm', 'update' => $this->data['update']));
     $this->data['form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'editFrm', 'action' => $this->data['action']));
     $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']['status'] = $form->getFieldHtml(array('type' => 'checkbox', 'name' => 'balance_status', 'value' => $this->data['balance_status'], 'style' => 'btn_switch'));
     $this->data['form']['fields']['sort_order'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'balance_sort_order', 'value' => $this->data['balance_sort_order']));
     $this->data['form']['fields']['calculation_order'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'balance_calculation_order', 'value' => $this->data['balance_calculation_order']));
     $this->view->assign('help_url', $this->gen_help_url('edit_balance'));
     $this->view->batchAssign($this->data);
     $this->processTemplate('pages/total/form.tpl');
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
 }
 private function _getCloneForm()
 {
     $this->view->assign('cancel', $this->html->getSecureURL('developer_tools_name'));
     $this->data['action'] = $this->html->getSecureURL('r/tool/developer_tools/doCloneTemplate');
     $this->data['heading_title'] = $this->language->get('developer_tools_name');
     $this->data['update'] = '';
     $form = new AForm('ST');
     $form->setForm(array('form_name' => 'extFrm', 'update' => $this->data['update']));
     $this->data['form']['id'] = 'extFrm';
     $this->data['form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'extFrm', 'action' => $this->data['action'], 'attr' => 'data-confirm-exit="true" class="aform form-horizontal"'));
     $this->data['form']['submit'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'submit', 'text' => $this->language->get('developer_tools_tab_clone_template'), 'style' => 'button1'));
     $this->data['form']['cancel'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'cancel', 'text' => $this->language->get('button_cancel'), 'style' => 'button2'));
     $template_list = glob(DIR_STOREFRONT . '/view/*', GLOB_ONLYDIR);
     foreach ($template_list as $t) {
         $tname = basename($t);
         $options[$tname] = $tname;
     }
     $this->data['form']['fields']['common']['proto_template'] = $form->getFieldHtml(array('type' => 'selectbox', 'name' => 'proto_template', 'options' => $options, 'value' => $this->request->get['proto_template'], 'required' => true, 'style' => 'large-field'));
     $this->data['form']['fields']['common']['clone_to'] = $form->getFieldHtml(array('type' => 'radio', 'name' => 'clone_to', 'options' => array('extension' => $this->language->get('developer_tools_entry_clone_to_extension'), 'core_template' => $this->language->get('developer_tools_entry_clone_to_core_template')), 'value' => 'extension', 'style' => 'large-field'));
     $this->data['form']['fields']['common']['clone_method'] = $form->getFieldHtml(array('type' => 'selectbox', 'name' => 'clone_method', 'value' => '', 'options' => array('' => $this->language->get('text_select'), 'full_clone' => $this->language->get('developer_tools_text_full_clone'), 'jscss_clone' => $this->language->get('developer_tools_text_jscss_clone')), 'required' => true, 'style' => 'large-field'));
     $this->data['form']['fields']['common']['template_title'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'extension_title', 'value' => $this->data['extension_title'], 'required' => true, 'style' => 'large-field'));
     $this->data['form']['fields']['common']['template_txt_id'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'extension_txt_id', 'value' => $this->data['extension_txt_id'], 'required' => true, 'style' => 'large-field'));
 }
 public function main()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $grid_settings = array('table_id' => 'report_shipping_grid', 'url' => $this->html->getSecureURL('listing_grid/report_sale/shipping'), 'sortname' => 'date_end', 'columns_search' => false, 'multiselect' => 'false');
     $form = new AForm();
     $form->setForm(array('form_name' => 'report_shipping_grid_search'));
     $this->data['grid_search_form'] = array();
     $this->data['grid_search_form']['id'] = 'report_shipping_grid_search';
     $this->data['grid_search_form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'report_shipping_grid_search', 'action' => ''));
     $this->data['grid_search_form']['submit'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'submit', 'text' => $this->language->get('button_go'), 'style' => 'button1'));
     $this->view->assign('js_date_format', format4Datepicker($this->language->get('date_format_short')));
     $this->data['grid_search_form']['fields']['date_start'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'date_start', 'default' => dateInt2Display(strtotime('-7 day'))));
     $this->data['grid_search_form']['fields']['date_end'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'date_end', 'default' => dateInt2Display(time())));
     $groups = array();
     $groups['year'] = $this->language->get('text_year');
     $groups['month'] = $this->language->get('text_month');
     $groups['week'] = $this->language->get('text_week');
     $groups['day'] = $this->language->get('text_day');
     $this->data['grid_search_form']['fields']['group'] = $form->getFieldHtml(array('type' => 'selectbox', 'name' => 'group', 'options' => $groups, 'value' => "week"));
     $this->loadModel('localisation/order_status');
     $results = $this->model_localisation_order_status->getOrderStatuses();
     $statuses = array('' => $this->language->get('text_all_orders'));
     foreach ($results as $item) {
         $statuses[$item['order_status_id']] = $item['name'];
     }
     $this->data['grid_search_form']['fields']['status'] = $form->getFieldHtml(array('type' => 'selectbox', 'name' => 'order_status', 'options' => $statuses, 'placeholder' => $this->language->get('text_select_status')));
     $grid_settings['search_form'] = true;
     $grid_settings['colNames'] = array($this->language->get('column_date_start'), $this->language->get('column_date_end'), $this->language->get('column_orders'), $this->language->get('column_total'));
     $grid_settings['colModel'] = array(array('name' => 'date_start', 'index' => 'date_start', 'width' => 100, 'align' => 'center', 'sorttype' => 'string'), array('name' => 'date_end', 'index' => 'date_end', 'width' => 100, 'align' => 'center', 'sorttype' => 'string'), array('name' => 'orders', 'index' => 'orders', 'width' => 100, 'align' => 'center'), array('name' => 'total', 'index' => 'total', 'width' => 110, 'align' => 'center'));
     $grid = $this->dispatch('common/listing_grid', array($grid_settings));
     $this->view->assign('listing_grid', $grid->dispatchGetOutput());
     $this->view->assign('search_form', $this->data['grid_search_form']);
     $this->document->setTitle($this->language->get('heading_title'));
     $this->document->initBreadcrumb(array('href' => $this->html->getSecureURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE));
     $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('report/sale/shipping'), 'text' => $this->language->get('heading_title'), 'separator' => ' :: ', 'current' => true));
     $this->processTemplate('pages/report/sale/shipping.tpl');
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
 }
Example #24
0
 public function main()
 {
     $this->load->model('checkout/order');
     $order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']);
     $order_id = $this->session->data['order_id'];
     $description = 'Order #' . $order_id;
     $order_id .= '#' . time();
     $return_url = $this->html->getSecureURL('checkout/success');
     $callback_url = $this->html->getSecureURL('extension/default_liqpay/callback');
     $private_key = $this->config->get('default_liqpay_private_key');
     $public_key = $this->config->get('default_liqpay_public_key');
     $currency = $order_info['currency'];
     if ($currency == 'RUR') {
         $currency = 'RUB';
     }
     $amount = $this->currency->format($order_info['total'], $order_info['currency_code'], $order_info['currency_value'], false);
     $language = $this->language->getCurrentLanguage();
     $language_code = $language['code'] == 'ru' ? 'ru' : 'en';
     $fields = array();
     $fields['version'] = 3;
     $fields['public_key'] = $public_key;
     $fields['amount'] = $amount;
     $fields['currency'] = $currency;
     $fields['description'] = $description;
     $fields['order_id'] = $order_id;
     $fields['result_url'] = $return_url;
     $fields['server_url'] = $callback_url;
     $fields['type'] = 'buy';
     $fields['pay_way'] = 'card,liqpay';
     $fields['language'] = $language_code;
     $fields['sandbox'] = (int) $this->config->get('default_liqpay_test_mode');
     //data - result of base64_encode( $json_string )
     //signature - result of base64_encode( sha1( $private_key . $data . $private_key ) )
     $params = array();
     $params['data'] = base64_encode(json_encode($fields));
     $params['signature'] = base64_encode(sha1($private_key . $params['data'] . $private_key, 1));
     $form = new AForm();
     $form->setForm(array('form_name' => 'checkout'));
     $data['form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'checkout', 'action' => 'https://www.liqpay.com/api/checkout'));
     foreach ($params as $k => $val) {
         $data['form']['fields'][$k] = $form->getFieldHtml(array('type' => 'hidden', 'name' => $k, 'value' => $val));
     }
     $back = $this->request->get['rt'] != 'checkout/guest_step_3' ? $this->html->getSecureURL('checkout/payment') : $this->html->getSecureURL('checkout/guest_step_2');
     $data['form']['back'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'back', 'text' => $this->language->get('button_back'), 'style' => 'button', 'href' => $back));
     $data['form']['submit'] = $form->getFieldHtml(array('type' => 'submit', 'name' => $this->language->get('button_confirm')));
     $this->view->batchAssign($data);
     $this->processTemplate('responses/default_liqpay.tpl');
 }
 public function main()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $this->loadModel('user/user');
     $this->loadLanguage('user/user');
     $this->document->setTitle($this->language->get('text_edit_details'));
     $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE));
     $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('index/edit_details'), 'text' => $this->language->get('text_edit_details'), 'separator' => ' :: ', 'current' => true));
     $this->view->assign('success', $this->session->data['success']);
     if (isset($this->session->data['success'])) {
         unset($this->session->data['success']);
     }
     if ($this->request->is_POST() && $this->_validate()) {
         $this->model_user_user->editUser($this->user->getId(), $this->request->post);
         $this->session->data['success'] = $this->language->get('text_success_details');
         $this->redirect($this->html->getSecureURL('index/edit_details'));
     }
     if ($this->request->is_POST() && $this->_validate()) {
         $this->redirect($this->html->getSecureURL('index/edit_details'));
     }
     $this->data['login'] = $this->html->getSecureURL('index/login');
     $this->data['error'] = $this->error;
     $user_info = $this->model_user_user->getUser($this->user->getId());
     $fields = array('firstname', 'lastname', 'email');
     foreach ($fields as $f) {
         if (isset($this->request->post[$f])) {
             $this->data[$f] = $this->request->post[$f];
         } else {
             $this->data[$f] = $user_info[$f];
         }
     }
     $this->data['action'] = $this->html->getSecureURL('index/edit_details');
     $this->data['update'] = $this->html->getSecureURL('listing_grid/user/update_field', '&id=' . $this->user->getId());
     $form = new AForm('HS');
     $form->setForm(array('form_name' => 'editFrm', 'update' => $this->data['update']));
     $this->data['form']['id'] = 'editFrm';
     $this->data['form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'editFrm', 'attr' => 'data-confirm-exit="true"', 'action' => $this->data['action']));
     $this->data['form']['submit'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'submit', 'text' => $this->language->get('button_save'), 'style' => 'button3'));
     foreach ($fields as $f) {
         $this->data['form']['fields'][$f] = $form->getFieldHtml(array('type' => 'input', 'name' => $f, 'value' => $this->data[$f], 'required' => true));
     }
     $this->data['form']['fields']['password'] = $form->getFieldHtml(array('type' => 'passwordset', 'name' => 'password', 'value' => $this->data['password']));
     $this->view->batchAssign($this->data);
     $this->processTemplate('pages/index/edit_details.tpl');
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
 }
Example #26
0
 public function main()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     if (!$this->customer->isLogged()) {
         $this->session->data['redirect'] = $this->html->getSecureURL('account/password');
         $this->redirect($this->html->getSecureURL('account/login'));
     }
     $this->document->setTitle($this->language->get('heading_title'));
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->_validate()) {
         $this->loadModel('account/customer');
         $this->model_account_customer->editPassword($this->customer->getLoginName(), $this->request->post['password']);
         $this->session->data['success'] = $this->language->get('text_success');
         $this->redirect($this->html->getSecureURL('account/account'));
     }
     $this->document->resetBreadcrumbs();
     $this->document->addBreadcrumb(array('href' => $this->html->getURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE));
     $this->document->addBreadcrumb(array('href' => $this->html->getURL('account/account'), 'text' => $this->language->get('text_account'), 'separator' => $this->language->get('text_separator')));
     $this->document->addBreadcrumb(array('href' => $this->html->getURL('account/password'), 'text' => $this->language->get('heading_title'), 'separator' => $this->language->get('text_separator')));
     $this->view->assign('error_warning', $this->error['warning']);
     $this->view->assign('error_current_password', $this->error['current_password']);
     $this->view->assign('error_password', $this->error['password']);
     $this->view->assign('error_confirm', $this->error['confirm']);
     $form = new AForm();
     $form->setForm(array('form_name' => 'PasswordFrm'));
     $form_open = $form->getFieldHtml(array('type' => 'form', 'name' => 'PasswordFrm', 'action' => $this->html->getSecureURL('account/password')));
     $this->view->assign('form_open', $form_open);
     $current_password = $form->getFieldHtml(array('type' => 'password', 'name' => 'current_password', 'value' => '', 'required' => true));
     $password = $form->getFieldHtml(array('type' => 'password', 'name' => 'password', 'value' => '', 'required' => true));
     $confirm = $form->getFieldHtml(array('type' => 'password', 'name' => 'confirm', 'value' => '', 'required' => true));
     $submit = $form->getFieldHtml(array('type' => 'submit', 'name' => $this->language->get('button_continue'), 'icon' => 'icon-check'));
     $this->view->assign('current_password', $current_password);
     $this->view->assign('password', $password);
     $this->view->assign('submit', $submit);
     $this->view->assign('confirm', $confirm);
     $this->view->assign('back', $this->html->getSecureURL('account/account'));
     $back = HtmlElementFactory::create(array('type' => 'button', 'name' => 'back', 'text' => $this->language->get('button_back'), 'icon' => 'icon-arrow-left', 'style' => 'button'));
     $this->view->assign('button_back', $back);
     $this->processTemplate('pages/account/password.tpl');
     //init controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
 }
 public function main()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $this->view->assign('success', $this->session->data['success']);
     if (isset($this->session->data['success'])) {
         unset($this->session->data['success']);
     }
     $this->document->initBreadcrumb(array('href' => $this->html->getSecureURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE));
     $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL($this->rt), 'text' => $this->language->get('heading_title'), 'separator' => ' :: ', 'current' => true));
     $this->request->get['language_id'] = !isset($this->request->get['language_id']) ? $this->config->get('storefront_language_id') : (int) $this->request->get['language_id'];
     $grid_settings = array('table_id' => 'lang_definition_grid', 'url' => $this->html->getSecureURL('listing_grid/language_definitions', '&language_id=' . $this->request->get['language_id']), 'editurl' => $this->html->getSecureURL('listing_grid/language_definitions/update'), 'update_field' => $this->html->getSecureURL('listing_grid/language_definitions/update_field'), 'sortname' => 'date_modified', 'actions' => array('edit' => array('text' => $this->language->get('text_edit'), 'href' => $this->html->getSecureURL('localisation/language_definition_form/update', '&view_mode=all&language_definition_id=%ID%')), 'save' => array('text' => $this->language->get('button_save')), 'delete' => array('text' => $this->language->get('button_delete'))), 'grid_ready' => 'grid_ready(data);');
     $form = new AForm();
     $form->setForm(array('form_name' => 'lang_definition_grid_search'));
     $grid_search_form = array();
     $grid_search_form['id'] = 'lang_definition_grid_search';
     $grid_search_form['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'lang_definition_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'));
     $languages = $this->language->getAvailableLanguages();
     $options = array(-1 => $this->language->get('text_all_languages'));
     foreach ($languages as $lang) {
         $options[$lang['language_id']] = $lang['name'];
     }
     $grid_search_form['fields']['language_id'] = $form->getFieldHtml(array('type' => 'selectbox', 'name' => 'language_id', 'options' => $options, 'value' => $this->request->get['language_id']));
     $grid_search_form['fields']['section'] = $form->getFieldHtml(array('type' => 'selectbox', 'name' => 'section', 'options' => array('' => $this->language->get('text_all_section'), 'admin' => $this->language->get('text_admin'), 'storefront' => $this->language->get('text_storefront'))));
     $grid_settings['search_form'] = true;
     $grid_settings['colNames'] = array($this->language->get('column_block'), $this->language->get('column_key'), $this->language->get('column_translation'), $this->language->get('column_update_date'));
     $grid_settings['colModel'] = array(array('name' => 'block', 'index' => 'block', 'align' => 'left', 'sorttype' => 'string', 'width' => 200), array('name' => 'language_key', 'index' => 'language_key', 'align' => 'left', 'sorttype' => 'string', 'width' => 200), array('name' => 'language_value', 'index' => 'language_value', 'align' => 'left', 'sorttype' => 'string', 'sortable' => false, 'width' => 260), array('name' => 'date_modified', 'index' => 'date_modified', 'align' => 'center', 'sorttype' => 'string', 'search' => false, 'width' => 90));
     $grid = $this->dispatch('common/listing_grid', array($grid_settings));
     $this->view->assign('listing_grid', $grid->dispatchGetOutput());
     $this->view->assign('search_form', $grid_search_form);
     $this->document->setTitle($this->language->get('heading_title'));
     $this->view->assign('insert', $this->html->getSecureURL('localisation/language_definition_form/update', '&view_mode=all'));
     $this->view->assign('help_url', $this->gen_help_url('language_definitions_listing'));
     $this->processTemplate('pages/localisation/language_definitions_list.tpl');
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
 }
 private function _getForm()
 {
     if (isset($this->error['warning'])) {
         $output['error_text'] = $this->error['warning'];
     } else {
         $this->data['error_warning'] = '';
     }
     $this->data['error'] = $this->error;
     $languages = $this->language->getAvailableLanguages();
     foreach ($languages as $lang) {
         $this->data['languages'][$lang['language_id']] = $lang;
     }
     $this->data['action'] = $this->html->getSecureURL('setting/setting_quick_form', '&target=' . $this->request->get['target'] . '&active=' . $this->request->get['active']);
     $this->data['heading_title'] = $this->language->get('text_edit') . ' ' . $this->language->get('text_setting');
     $form = new AForm('HT');
     $this->data['setting_id'] = (int) $this->request->get['setting_id'];
     $form->setForm(array('form_name' => 'qsFrm', 'update' => $this->data['update']));
     $this->data['form']['id'] = 'qsFrm';
     $this->data['form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'qsFrm', 'action' => $this->data['action'], 'attr' => 'class="aform form-horizontal"'));
     $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'));
     require_once DIR_CORE . 'lib/config_manager.php';
     $conf_mngr = new AConfigManager();
     $data = $this->model_setting_setting->getSetting($this->data['group'], $this->data['store_id']);
     $this->data['form']['fields'] = $conf_mngr->getFormField($this->data['setting_key'], $form, $data, $this->data['store_id'], $this->data['group']);
     $this->data['form_store_switch'] = $this->html->getStoreSwitcher();
     $this->data['template_image'] = $this->html->getSecureURL('setting/template_image');
     $this->data['form_title'] = $this->language->get('tab_' . $this->data['group']);
     $this->data['help_url'] = $this->gen_help_url('setting_edit');
     $this->data['active'] = $this->request->get['active'];
     $this->data['title'] = $this->data['heading_title'];
     $this->view->batchAssign($this->data);
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
     $this->processTemplate('responses/setting/setting_quick_form.tpl');
 }
 public function main()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $this->loadLanguage('catalog/product');
     $this->document->setTitle($this->language->get('heading_title'));
     $this->loadModel('catalog/product');
     $this->attribute_manager = new AAttribute_Manager();
     if ($this->request->is_POST() && $this->_validateForm()) {
         $this->model_catalog_product->addProductOption($this->request->get['product_id'], $this->request->post);
         $this->session->data['success'] = $this->language->get('text_success');
         $this->redirect($this->html->getSecureURL('catalog/product_options', '&product_id=' . $this->request->get['product_id']));
     }
     $product_info = $this->model_catalog_product->getProduct($this->request->get['product_id']);
     if (!$product_info) {
         $this->session->data['warning'] = $this->language->get('error_product_not_found');
         $this->redirect($this->html->getSecureURL('catalog/product'));
     }
     $this->data['attributes'] = array('new' => $this->language->get('text_add_new_option'));
     $results = $this->attribute_manager->getAttributes(array('search' => " ga.attribute_type_id = '" . $this->attribute_manager->getAttributeTypeID('product_option') . "'\n\t\t\t\tAND ga.status = 1\n\t\t\t\tAND ga.attribute_parent_id = 0 ", 'sort' => 'sort_order', 'order' => 'ASC', 'limit' => 1000), $this->session->data['content_language_id']);
     foreach ($results as $type) {
         $this->data['attributes'][$type['attribute_id']] = $type['name'];
     }
     $this->data['product_description'] = $this->model_catalog_product->getProductDescriptions($this->request->get['product_id']);
     $product_options = $this->model_catalog_product->getProductOptions($this->request->get['product_id']);
     $content_language_id = $this->language->getContentLanguageID();
     $default_language_id = $this->language->getDefaultLanguageID();
     foreach ($product_options as &$option) {
         $option_name = trim($option['language'][$content_language_id]['name']);
         $option['language'][$content_language_id]['name'] = $option_name ? $option_name : 'n/a';
         $option_name = trim($option['language'][$default_language_id]['name']);
         $option['language'][$default_language_id]['name'] = $option_name ? $option_name : 'n/a';
     }
     unset($option);
     $this->data['product_options'] = $product_options;
     $this->data['language_id'] = $this->session->data['content_language_id'];
     $this->data['url']['load_option'] = $this->html->getSecureURL('product/product/load_option', '&product_id=' . $this->request->get['product_id']);
     $this->data['url']['update_option'] = $this->html->getSecureURL('product/product/update_option', '&product_id=' . $this->request->get['product_id']);
     $this->data['url']['get_options_list'] = $this->html->getSecureURL('product/product/get_options_list', '&product_id=' . $this->request->get['product_id']);
     $this->view->assign('error', $this->error);
     $this->view->assign('success', $this->session->data['success']);
     if (isset($this->session->data['success'])) {
         unset($this->session->data['success']);
     }
     $this->document->initBreadcrumb(array('href' => $this->html->getSecureURL('index/home'), 'text' => $this->language->get('text_home')));
     $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('catalog/product'), 'text' => $this->language->get('heading_title')));
     $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('catalog/product/update', '&product_id=' . $this->request->get['product_id']), 'text' => $this->language->get('text_edit') . '&nbsp;' . $this->language->get('text_product') . ' - ' . $this->data['product_description'][$this->session->data['content_language_id']]['name']));
     $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('catalog/product_options', '&product_id=' . $this->request->get['product_id']), 'text' => $this->language->get('tab_option'), 'current' => true));
     $this->data['active'] = 'options';
     //load tabs controller
     $tabs_obj = $this->dispatch('pages/catalog/product_tabs', array($this->data));
     $this->data['product_tabs'] = $tabs_obj->dispatchGetOutput();
     unset($tabs_obj);
     $results = HtmlElementFactory::getAvailableElements();
     $element_types = array('' => $this->language->get('text_select'));
     foreach ($results as $key => $type) {
         // allowed field types
         if (in_array($key, array('I', 'T', 'S', 'M', 'R', 'C', 'G', 'H', 'U'))) {
             $element_types[$key] = $type['type'];
         }
     }
     $this->data['button_add_option'] = $this->html->buildButton(array('text' => $this->language->get('button_add_option'), 'style' => 'button1'));
     $this->data['button_add_option_value'] = $this->html->buildButton(array('text' => $this->language->get('button_add_option_value'), 'style' => 'button1'));
     $this->data['button_remove'] = $this->html->buildButton(array('text' => $this->language->get('button_remove'), 'style' => 'button1'));
     $this->data['button_reset'] = $this->html->buildButton(array('text' => $this->language->get('button_reset'), 'style' => 'button2'));
     $this->data['action'] = $this->html->getSecureURL('catalog/product_options', '&product_id=' . $this->request->get['product_id']);
     $this->data['form_title'] = $this->language->get('text_edit') . '&nbsp;' . $this->language->get('text_product');
     $this->data['update'] = '';
     $form = new AForm('HT');
     $product_opt = array();
     foreach ($product_options as $option) {
         $product_opt[$option['product_option_id']] = $option['language'][$content_language_id]['name'];
     }
     $this->data['options'] = $form->getFieldHtml(array('type' => 'selectbox', 'name' => 'option', 'value' => $this->data['product_option_id'], 'options' => $product_opt));
     $form->setForm(array('form_name' => 'product_form', 'update' => $this->data['update']));
     $this->data['form']['id'] = 'product_form';
     $this->data['form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'product_form', 'action' => $this->data['action'], 'attr' => 'data-confirm-exit="true"  class="form-horizontal"'));
     $this->data['form']['submit'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'submit', 'text' => $this->language->get('button_add'), 'style' => 'button1'));
     $this->data['form']['cancel'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'cancel', 'text' => $this->language->get('button_cancel'), 'style' => 'button2'));
     $form->setForm(array('form_name' => 'new_option_form', 'update' => ''));
     $this->data['attributes'] = $form->getFieldHtml(array('type' => 'selectbox', 'name' => 'attribute_id', 'options' => $this->data['attributes'], 'style' => 'chosen'));
     $this->data['option_name'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'option_name', 'required' => true));
     $this->data['status'] = $form->getFieldHtml(array('type' => 'checkbox', 'name' => 'status', 'value' => 1, 'style' => 'btn_switch'));
     $this->data['sort_order'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'sort_order', 'style' => 'small-field'));
     $this->data['required'] = $form->getFieldHtml(array('type' => 'checkbox', 'name' => 'required', 'style' => 'btn_switch'));
     $this->data['element_type'] = $form->getFieldHtml(array('type' => 'selectbox', 'name' => 'element_type', 'required' => true, 'options' => $element_types));
     $this->addChild('pages/catalog/product_summary', 'summary_form', 'pages/catalog/product_summary.tpl');
     $object_title = $this->language->get('text_product') . ' ' . $this->language->get('text_option_value');
     $params = '&object_name=product_option_value&object_title=' . $object_title;
     $this->data['rl_resource_library'] = $this->html->getSecureURL('common/resource_library', $params);
     $this->data['rl_resources'] = $this->html->getSecureURL('common/resource_library/resources', $params);
     $this->data['rl_resource_single'] = $this->html->getSecureURL('common/resource_library/get_resource_details', $params);
     $this->data['rl_delete'] = $this->html->getSecureURL('common/resource_library/delete');
     $this->data['rl_unmap'] = $this->html->getSecureURL('common/resource_library/unmap', $params);
     $this->data['rl_map'] = $this->html->getSecureURL('common/resource_library/map', $params);
     $this->data['rl_download'] = $this->html->getSecureURL('common/resource_library/get_resource_preview');
     $this->data['rl_upload'] = $this->html->getSecureURL('common/resource_library/upload', $params);
     $resources_scripts = $this->dispatch('responses/common/resource_library/get_resources_scripts', array('object_name' => 'product_option_value', 'object_id' => '', 'types' => array('image'), 'onload' => false));
     if ($this->config->get('config_embed_status')) {
         $this->data['embed_url'] = $this->html->getSecureURL('common/do_embed/product', '&product_id=' . $this->request->get['product_id']);
     }
     $this->view->assign('resources_scripts', $resources_scripts->dispatchGetOutput());
     $this->view->assign('help_url', $this->gen_help_url('product_options'));
     $this->view->assign('form_language_switch', $this->html->getContentLanguageSwitcher());
     $this->view->batchAssign($this->data);
     $this->processTemplate('pages/catalog/product_options.tpl');
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
 }
Example #30
0
 /**
  * Form to edit product from order
  */
 public function orderProductForm()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $this->loadModel('catalog/product');
     $this->loadModel('sale/order');
     $this->loadLanguage('catalog/product');
     $this->loadLanguage('sale/order');
     $this->load->library('json');
     $elements_with_options = HtmlElementFactory::getElementsWithOptions();
     $order_product_id = (int) $this->request->get['order_product_id'];
     $order_id = (int) $this->request->get['order_id'];
     $order_info = $this->model_sale_order->getOrder($order_id);
     $tax = new ATax($this->registry);
     $tax->setZone($order_info['country_id'], $order_info['zone_id']);
     $product_id = (int) $this->request->get['product_id'];
     $preset_values = array();
     if ($order_product_id) {
         //if unknown product_id but order_product_id we know
         $order_product_info = $this->model_sale_order->getOrderProducts($order_id, $order_product_id);
         $preset_values['price'] = $this->currency->format($order_product_info[0]['price'], $order_info['currency'], $order_info['value'], false);
         $preset_values['total'] = $this->currency->format($order_product_info[0]['price'] * $order_product_info[0]['quantity'], $order_info['currency'], $order_info['value'], false);
         $preset_values['quantity'] = $order_product_info[0]['quantity'];
         if (!$product_id) {
             $product_id = $order_product_info[0]['product_id'];
         }
         $product_info = $this->model_catalog_product->getProduct($product_id);
         $order_product_options = $this->model_sale_order->getOrderOptions($order_id, $order_product_id);
         foreach ($order_product_options as $v) {
             if ($v['element_type'] == 'R') {
                 $preset_values[$v['product_option_id']] = $v['product_option_value_id'];
             } elseif (in_array($v['element_type'], $elements_with_options)) {
                 $preset_values[$v['product_option_id']][] = $v['product_option_value_id'];
             } else {
                 $preset_values[$v['product_option_id']] = $v['value'];
             }
         }
         $this->data['text_title'] = $this->language->get('text_edit_order_product');
         $form_action = $this->html->getSecureURL('sale/order/update', '&order_id=' . $order_id . '&order_product_id=' . $order_product_id);
     } else {
         $product_info = $this->model_catalog_product->getProduct($product_id);
         $this->data['text_title'] = sprintf($this->language->get('text_add_product_to_order'), $order_id);
         $preset_values['quantity'] = $product_info['minimum'] ? $product_info['minimum'] : 1;
         $preset_values['price'] = $this->currency->format($product_info['price'], $order_info['currency'], $order_info['value'], false);
         $preset_values['total'] = $this->currency->format($product_info['price'] * $preset_values['quantity'], $order_info['currency'], $order_info['value'], false);
         $form_action = $this->html->getSecureURL('sale/order/update', '&order_id=' . $order_id . '&product_id=' . $product_id);
     }
     $this->data['product_href'] = $this->html->getSecureURL('catalog/product/update', '&product_id=' . $product_id);
     $form = new AForm('HT');
     $form->setForm(array('form_name' => 'orderProductFrm'));
     $this->data['form']['id'] = 'orderProductFrm';
     $this->data['form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'orderProductFrm', 'attr' => 'data-confirm-exit="true" class="aform form-horizontal"', 'action' => $form_action));
     $this->data['text_title'] .= ' - ' . $product_info['name'];
     // Prepare options and values for display
     $product_options = $this->model_catalog_product->getOrderProductOptions($product_id);
     $option_values_prices = array();
     foreach ($product_options as $option) {
         if (in_array($option['element_type'], array('U'))) {
             continue;
         }
         //skip files for now. TODO: add edit file-option in the future
         $values = $prices = array();
         $price = $preset_value = $default_value = '';
         foreach ($option['option_value'] as $option_value) {
             //default value
             $default_value = $option_value['default'] && !$order_product_id ? $option_value['product_option_value_id'] : $default_value;
             //early saved value
             $preset_value = $preset_values[$option['product_option_id']];
             //when adds new product in the order
             if (!$order_product_id) {
                 if ($option_value['default'] == 1) {
                     $preset_value = $option_value['product_option_value_id'];
                 } elseif (!in_array($option['element_type'], $elements_with_options)) {
                     $preset_value = $option_value['name'];
                 }
             }
             //Apply option price modifier
             if ($option_value['prefix'] == '%') {
                 $price = $tax->calculate($product_info['price'] * $option_value['price'] / 100, $product_info['tax_class_id'], (bool) $this->config->get('config_tax'));
             } else {
                 $price = $tax->calculate($option_value['price'], $product_info['tax_class_id'], (bool) $this->config->get('config_tax'));
             }
             if ($price != 0) {
                 $price = $this->currency->format($price);
             } else {
                 $price = '';
             }
             //Check stock and status
             $opt_stock_message = '';
             if ($option_value['subtract']) {
                 if ($option_value['quantity'] <= 0) {
                     //show out of stock message
                     $opt_stock_message = ' (' . $this->language->get('text_product_out_of_stock') . ')';
                 } else {
                     if ($this->config->get('config_stock_display')) {
                         $opt_stock_message = ' (' . $option_value['quantity'] . " " . $this->language->get('text_product_in_stock') . ')';
                     }
                 }
             }
             $values[$option_value['product_option_value_id']] = $option_value['name'] . ' ' . $price . ' ' . $opt_stock_message;
         }
         //if not values are build, nothing to show
         if (count($values)) {
             //add price to option name if it is not element with options
             if (!in_array($option['element_type'], $elements_with_options)) {
                 $option['name'] .= ' <small>' . $price . '</small>';
                 if ($opt_stock_message) {
                     $option['name'] .= '<br />' . $opt_stock_message;
                 }
             }
             //set default selection is nothing selected
             if (!has_value($preset_value) && $option['element_type'] != 'C') {
                 if (has_value($default_value)) {
                     $preset_value = $default_value;
                 }
             }
             //show hidden option for admin
             if ($option['html_type'] == 'hidden') {
                 $option['html_type'] = 'input';
             }
             $value = $preset_value;
             //for checkbox with empty value
             if ($value == '' && $option['element_type'] == 'C') {
                 $value = $default_value;
                 $value = $value == '' ? 1 : $value;
             }
             $option_data = array('type' => $option['html_type'], 'name' => !in_array($option['element_type'], HtmlElementFactory::getMultivalueElements()) ? 'product[0][option][' . $option['product_option_id'] . ']' : 'product[0][option][' . $option['product_option_id'] . '][]', 'value' => $value, 'options' => $values, 'placeholder' => $option['option_placeholder'], 'regexp_pattern' => $option['regexp_pattern'], 'error_text' => $option['error_text'], 'attr' => ' data-option-id ="' . $option['product_option_id'] . '"');
             if ($option['element_type'] == 'C') {
                 // note: 0 and 1 must be stirng to prevent collision with 'yes'. (in php 'yes'==1) ;-)
                 $option_data['label_text'] = !in_array($value, array('0', '1')) ? $value : '';
                 $option_data['checked'] = $preset_value ? true : false;
             }
             $options[] = array('name' => $option['name'], 'html' => $form->getFieldHtml($option_data));
         }
     }
     $this->data['options'] = $options;
     // main product image
     $resource = new AResource('image');
     $thumbnail = $resource->getMainThumb('products', $product_id, $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'), true);
     $this->data['image'] = $thumbnail;
     $this->data['form']['submit'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'submit', 'text' => $order_product_id ? $this->language->get('button_save') : $this->language->get('button_add')));
     $this->data['form']['cancel'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'cancel', 'text' => $this->language->get('button_cancel')));
     $this->data['form']['fields']['price'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'product[0][price]', 'value' => $preset_values['price'], 'attr' => ' readonly'));
     if (!$options && $product_info['subtract']) {
         if ($product_info['quantity']) {
             $this->data['column_quantity'] = $this->language->get('column_quantity') . ' (' . $this->language->get('text_product_in_stock') . ': ' . $product_info['quantity'] . ')';
         } else {
             $this->data['column_quantity'] = $this->language->get('column_quantity') . ' (' . $this->language->get('text_product_out_of_stock') . ')';
         }
     }
     $this->data['form']['fields']['quantity'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'product[0][quantity]', 'value' => $preset_values['quantity'], 'attr' => ' size="4"'));
     $this->data['form']['fields']['total'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'product[0][total]', 'value' => $preset_values['total'], 'attr' => 'readonly'));
     $this->data['form']['fields']['product_id'] = $form->getFieldHtml(array('type' => 'hidden', 'name' => 'product_id', 'value' => $product_id));
     $this->data['form']['fields']['order_product_id'] = $form->getFieldHtml(array('type' => 'hidden', 'name' => 'order_product_id', 'value' => (int) $order_product_id));
     //url to storefront response controller. Note: if admin under ssl - use https for url and otherwise
     $order_store_id = $order_info['store_id'];
     $this->loadModel('setting/store');
     $store_info = $this->model_setting_store->getStore($order_store_id);
     if (HTTPS === true && $store_info['config_ssl_url']) {
         $total_calc_url = $store_info['config_ssl_url'] . 'index.php?rt=r/product/product/calculateTotal';
     } elseif (HTTPS === true && !$store_info['config_ssl_url']) {
         $total_calc_url = str_replace('http://', 'https://', $store_info['config_url']) . 'index.php?rt=r/product/product/calculateTotal';
     } else {
         $total_calc_url = $store_info['config_url'] . 'index.php?rt=r/product/product/calculateTotal';
     }
     $this->data['total_calc_url'] = $total_calc_url;
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
     $this->view->batchAssign($this->data);
     $this->processTemplate('responses/product/product_form.tpl');
 }