示例#1
0
 public function main()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $grid_settings = array('table_id' => 'report_coupons_grid', 'url' => $this->html->getSecureURL('listing_grid/report_sale/coupons'), 'sortname' => 'date_end', 'columns_search' => false, 'multiselect' => 'false');
     $form = new AForm();
     $form->setForm(array('form_name' => 'report_coupons_grid_search'));
     $this->data['grid_search_form'] = array();
     $this->data['grid_search_form']['id'] = 'report_coupons_grid_search';
     $this->data['grid_search_form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'report_coupons_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())));
     $grid_settings['search_form'] = true;
     $grid_settings['colNames'] = array($this->language->get('column_coupon_name'), $this->language->get('column_code'), $this->language->get('column_orders'), $this->language->get('column_total'), $this->language->get('column_discount_total'));
     $grid_settings['colModel'] = array(array('name' => 'coupon_name', 'index' => 'coupon_name', 'width' => 100, 'align' => 'center', 'sorttype' => 'string'), array('name' => 'code', 'index' => 'code', 'width' => 100, 'align' => 'center', 'sorttype' => 'string'), array('name' => 'orders', 'index' => 'orders', 'width' => 100, 'align' => 'center'), array('name' => 'total', 'index' => 'total', 'width' => 110, 'align' => 'center'), array('name' => 'discount_total', 'index' => 'discount_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/coupon'), 'text' => $this->language->get('heading_title'), 'separator' => ' :: ', 'current' => true));
     $this->processTemplate('pages/report/sale/coupons.tpl');
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
 }
示例#2
0
 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__);
 }
示例#3
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__);
 }
示例#4
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');
 }
示例#5
0
 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()
 {
     $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');
 }
 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__);
 }
 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');
 }
示例#9
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__);
 }
示例#10
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');
 }
示例#11
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()
 {
     //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__);
 }
示例#13
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');
 }
示例#14
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()
 {
     $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()
 {
     $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();
 }
 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__);
 }
示例#19
0
 public function main()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $grid_settings = array('table_id' => 'customer_order_grid', 'url' => $this->html->getSecureURL('listing_grid/report_customer/orders'), 'sortname' => 'customer', 'columns_search' => true, 'multiselect' => 'false', 'actions' => array('view' => array('text' => $this->language->get('text_view'), 'href' => $this->html->getSecureURL('sale/customer/update', '&customer_id=%ID%'))));
     $grid_settings['search_form'] = true;
     $grid_settings['colNames'] = array($this->language->get('column_customer_id'), $this->language->get('column_customer'), $this->language->get('column_group'), $this->language->get('column_order_count'), $this->language->get('column_total'));
     $grid_settings['colModel'] = array(array('name' => 'customer_id', 'index' => 'customer_id', 'width' => 80, 'align' => 'center', 'search' => true), array('name' => 'customer', 'index' => 'customer', 'width' => 120, 'align' => 'center', 'search' => true), array('name' => 'group', 'index' => 'group', 'width' => 100, 'align' => 'center', 'sorttype' => 'string', 'search' => false), array('name' => 'order_count', 'index' => 'order_count', 'width' => 80, 'align' => 'center', 'search' => false), array('name' => 'total', 'index' => 'total', 'width' => 100, 'align' => 'center', 'search' => 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' => 'customer_order_grid_search'));
     $this->data['grid_search_form'] = array();
     $this->data['grid_search_form']['id'] = 'customer_order_grid_search';
     $this->data['grid_search_form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'customer_order_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())));
     $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')));
     $this->view->assign('search_form', $this->data['grid_search_form']);
     $this->view->assign('reset', $this->html->getSecureURL('report/customer/orders'));
     $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/customer/orders'), 'text' => $this->language->get('heading_title'), 'separator' => ' :: ', 'current' => true));
     $this->processTemplate('pages/report/customer/orders.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->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));
 }
示例#22
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'));
 }
示例#24
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');
 }
 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__);
 }
示例#26
0
 public function files()
 {
     $this->data = array();
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $this->document->setTitle($this->language->get('heading_title'));
     if (has_value($this->session->data['error'])) {
         $this->data['error']['warning'] = $this->session->data['error'];
         unset($this->session->data['error']);
     }
     if (isset($this->request->get['order_id'])) {
         $order_id = $this->request->get['order_id'];
     } else {
         $order_id = 0;
     }
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->_validateForm()) {
         if (has_value($this->request->post['downloads'])) {
             $data = $this->request->post['downloads'];
             $this->loadModel('catalog/download');
             foreach ($data as $order_download_id => $item) {
                 if (isset($item['expire_date'])) {
                     $item['expire_date'] = $item['expire_date'] ? dateDisplay2ISO($item['expire_date'], $this->language->get('date_format_short')) : '';
                 }
                 $this->model_catalog_download->editOrderDownload($order_download_id, $item);
             }
         }
         //add download to order
         if (has_value($this->request->post['push'])) {
             $this->load->library('json');
             foreach ($this->request->post['push'] as $order_product_id => $items) {
                 $items = AJson::decode(html_entity_decode($items), true);
                 if ($items) {
                     foreach ($items as $download_id => $info) {
                         $download_info = $this->download->getDownloadInfo($download_id);
                         $download_info['attributes_data'] = serialize($this->download->getDownloadAttributesValues($download_id));
                         $this->download->addProductDownloadToOrder($order_product_id, $order_id, $download_info);
                     }
                 }
             }
         }
         $this->session->data['success'] = $this->language->get('text_success');
         $this->redirect($this->html->getSecureURL('sale/order/files', '&order_id=' . $this->request->get['order_id']));
     }
     $order_info = $this->model_sale_order->getOrder($order_id);
     $this->data['order_info'] = $order_info;
     //set content language to order language ID.
     if ($this->language->getContentLanguageID() != $order_info['language_id']) {
         //reset content language
         $this->language->setCurrentContentLanguage($order_info['language_id']);
     }
     if (empty($order_info)) {
         $this->session->data['error'] = $this->language->get('error_order_load');
         $this->redirect($this->html->getSecureURL('sale/order'));
     }
     $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('sale/order'), 'text' => $this->language->get('heading_title'), 'separator' => ' :: '));
     $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('sale/order/files', '&order_id=' . $this->request->get['order_id']), 'text' => $this->language->get('heading_title') . ' #' . $order_info['order_id'], 'separator' => ' :: '));
     if (isset($this->session->data['success'])) {
         $this->data['success'] = $this->session->data['success'];
         unset($this->session->data['success']);
     } else {
         $this->data['success'] = '';
     }
     $this->data['heading_title'] = $this->language->get('heading_title') . ' #' . $order_info['order_id'];
     $this->data['token'] = $this->session->data['token'];
     $this->data['invoice'] = $this->html->getSecureURL('sale/invoice', '&order_id=' . (int) $this->request->get['order_id']);
     $this->data['button_invoice'] = $this->html->buildButton(array('name' => 'btn_invoice', 'text' => $this->language->get('text_invoice'), 'style' => 'button3'));
     $this->data['invoice_generate'] = $this->html->getSecureURL('sale/invoice/generate');
     $this->data['category_products'] = $this->html->getSecureURL('product/product/category');
     $this->data['product_update'] = $this->html->getSecureURL('catalog/product/update');
     $this->data['order_id'] = $this->request->get['order_id'];
     $this->data['action'] = $this->html->getSecureURL('sale/order/files', '&order_id=' . $this->request->get['order_id']);
     $this->data['cancel'] = $this->html->getSecureURL('sale/order');
     $this->_initTabs('files');
     $this->loadModel('localisation/order_status');
     $status = $this->model_localisation_order_status->getOrderStatus($order_info['order_status_id']);
     if ($status) {
         $this->data['order_status'] = $status['name'];
     } else {
         $this->data['order_status'] = '';
     }
     $this->loadModel('sale/customer_group');
     $customer_group_info = $this->model_sale_customer_group->getCustomerGroup($order_info['customer_group_id']);
     if ($customer_group_info) {
         $this->data['customer_group'] = $customer_group_info['name'];
     } else {
         $this->data['customer_group'] = '';
     }
     $this->data['form_title'] = $this->language->get('edit_title_files');
     $this->data['update'] = $this->html->getSecureURL('listing_grid/order/update_field', '&id=' . $this->request->get['order_id']);
     $form = new AForm('HS');
     $form->setForm(array('form_name' => 'orderFrm', 'update' => $this->data['update']));
     $this->data['form']['id'] = 'orderFrm';
     $this->data['form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'orderFrm', 'attr' => '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' => 'button1'));
     $this->data['form']['cancel'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'cancel', 'text' => $this->language->get('button_cancel'), 'style' => 'button2'));
     $this->addChild('pages/sale/order_summary', 'summary_form', 'pages/sale/order_summary.tpl');
     /** ORDER DOWNLOADS */
     $this->data['downloads'] = array();
     $order_downloads = $this->model_sale_order->getOrderDownloads($this->request->get['order_id']);
     if ($order_downloads) {
         $rl = new AResource('image');
         if (!$this->registry->has('jqgrid_script')) {
             $locale = $this->session->data['language'];
             if (!file_exists(DIR_ROOT . '/' . RDIR_TEMPLATE . 'javascript/jqgrid/js/i18n/grid.locale-' . $locale . '.js')) {
                 $locale = 'en';
             }
             $this->document->addScript(RDIR_TEMPLATE . 'javascript/jqgrid/js/i18n/grid.locale-' . $locale . '.js');
             $this->document->addScript(RDIR_TEMPLATE . 'javascript/jqgrid/js/jquery.jqGrid.min.js');
             $this->document->addScript(RDIR_TEMPLATE . 'javascript/jqgrid/plugins/jquery.grid.fluid.js');
             $this->document->addScript(RDIR_TEMPLATE . 'javascript/jqgrid/js/jquery.ba-bbq.min.js');
             $this->document->addScript(RDIR_TEMPLATE . 'javascript/jqgrid/js/grid.history.js');
             //set flag to not include scripts/css twice
             $this->registry->set('jqgrid_script', true);
         }
         $this->session->data['multivalue_excludes'] = array();
         $this->loadModel('catalog/download');
         foreach ($order_downloads as $product_id => $order_download) {
             $downloads = (array) $order_download['downloads'];
             $this->data['order_downloads'][$product_id]['product_name'] = $order_download['product_name'];
             $this->data['order_downloads'][$product_id]['product_thumbnail'] = $rl->getMainThumb('products', $product_id, $this->config->get('config_image_grid_width'), $this->config->get('config_image_grid_height'));
             foreach ($downloads as $download_info) {
                 $download_info['order_status_id'] = $order_info['order_status_id'];
                 $attributes = $this->download->getDownloadAttributesValuesForDisplay($download_info['download_id']);
                 $order_product_id = $download_info['order_product_id'];
                 $is_file = $this->download->isFileAvailable($download_info['filename']);
                 foreach ($download_info['download_history'] as &$h) {
                     $h['time'] = dateISO2Display($h['time'], $this->language->get('date_format_short') . ' ' . $this->language->get('time_format'));
                 }
                 unset($h);
                 $status_text = $this->model_catalog_download->getTextStatusForOrderDownload($download_info);
                 if ($status_text) {
                     $status = $status_text;
                 } else {
                     $status = $form->getFieldHtml(array('type' => 'checkbox', 'name' => 'downloads[' . (int) $download_info['order_download_id'] . '][status]', 'value' => $download_info['status'], 'style' => 'btn_switch'));
                 }
                 $this->data['order_downloads'][$product_id]['downloads'][] = array('name' => $download_info['name'], 'attributes' => $attributes, 'href' => $this->html->getSecureURL('catalog/product_files', '&product_id=' . $product_id . '&download_id=' . $download_info['download_id']), 'resource' => $download_info['filename'], 'is_file' => $is_file, 'mask' => $download_info['mask'], 'status' => $status, 'remaining' => $form->getFieldHtml(array('type' => 'input', 'name' => 'downloads[' . (int) $download_info['order_download_id'] . '][remaining_count]', 'value' => $download_info['remaining_count'], 'placeholder' => '-', 'style' => 'small-field')), 'expire_date' => $form->getFieldHtml(array('type' => 'date', 'name' => 'downloads[' . (int) $download_info['order_download_id'] . '][expire_date]', 'value' => $download_info['expire_date'] ? dateISO2Display($download_info['expire_date']) : '', 'default' => '', 'dateformat' => format4Datepicker($this->language->get('date_format_short')), 'highlight' => 'future', 'style' => 'medium-field')), 'download_history' => $download_info['download_history']);
                 // exclude downloads from multivalue list. why we need relate recursion?
                 $this->session->data['multivalue_excludes'][] = $download_info['download_id'];
             }
             $this->data['order_downloads'][$product_id]['push'] = $form->getFieldHtml(array('id' => 'popup' . $product_id, 'type' => 'multivalue', 'name' => 'popup' . $product_id, 'title' => $this->language->get('text_select_from_list'), 'selected_name' => 'push[' . $order_product_id . ']', 'selected' => "{}", 'content_url' => $this->html->getSecureUrl('catalog/download_listing', '&form_name=orderFrm&multivalue_hidden_id=popup' . $product_id), 'postvars' => '', 'return_to' => '', 'popup_height' => 708, 'text' => array('selected' => $this->language->get('text_count_selected'), 'edit' => $this->language->get('text_save_edit'), 'apply' => $this->language->get('text_apply'), 'save' => $this->language->get('text_add'), 'reset' => $this->language->get('button_reset'))));
         }
     }
     $this->view->batchAssign($this->data);
     $this->view->assign('help_url', $this->gen_help_url('order_files'));
     $this->processTemplate('pages/sale/order_files.tpl');
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
 }
示例#27
0
 private function _getBlockForm()
 {
     if (isset($this->session->data['warning'])) {
         $this->data['error_warning'] = $this->session->data['warning'];
         $this->session->data['warning'] = '';
     } else {
         $this->data['error_warning'] = '';
     }
     $this->load->library('json');
     $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('design/blocks'), 'text' => $this->language->get('heading_title'), 'separator' => ' :: '));
     $this->data['cancel'] = $this->html->getSecureURL('design/blocks');
     $custom_block_id = (int) $this->request->get['custom_block_id'];
     // need to get data of custom listing
     $options_list = array();
     if ($custom_block_id) {
         $lm = new ALayoutManager();
         $block_info = $lm->getBlockDescriptions($custom_block_id);
         $language_id = $this->session->data['content_language_id'];
         if (!isset($block_info[$language_id])) {
             $language_id = key($block_info);
         }
         foreach ($block_info[$language_id] as $k => $v) {
             $this->data[$k] = $v;
         }
         $content = $block_info[$this->language->getContentLanguageID()]['content'];
         if ($content) {
             $content = unserialize($content);
         } else {
             $content = current($block_info);
             $content = unserialize($content['content']);
         }
         $this->data['banner_group_name'] = $content['banner_group_name'];
         $lm = new AListingManager($this->request->get['custom_block_id']);
         $list = $lm->getCustomList();
         $options_list = array();
         if ($list) {
             foreach ($list as $row) {
                 $options_list[(int) $row['id']] = array();
             }
             $ids = array_keys($options_list);
             $assigned_banners = $this->model_extension_banner_manager->getBanners(array('subsql_filter' => 'b.banner_id IN (' . implode(', ', $ids) . ')'));
             $rm = new AResourceManager();
             $rm->setType('image');
             foreach ($assigned_banners as $banner) {
                 $id = $banner['banner_id'];
                 if (in_array($id, $ids)) {
                     $thumbnail = $rm->getMainThumb('banners', $banner['banner_id'], (int) $this->config->get('config_image_grid_width'), (int) $this->config->get('config_image_grid_height'), false);
                     $icon = $thumbnail['thumb_html'] ? $thumbnail['thumb_html'] : '<i class="fa fa-code fa-4x"></i>&nbsp;';
                     $options_list[$id] = array('image' => $icon, 'id' => $id, 'name' => $banner['name'], 'sort_order' => (int) $banner['sort_order']);
                 }
             }
         }
     }
     if (!$custom_block_id) {
         $this->data['action'] = $this->html->getSecureURL('extension/banner_manager/insert_block');
         $this->data['form_title'] = $this->language->get('text_create_block');
         $this->data['update'] = '';
         $form = new AForm('ST');
     } else {
         $this->data['action'] = $this->html->getSecureURL('extension/banner_manager/edit_block', '&custom_block_id=' . $custom_block_id);
         $this->data['form_title'] = $this->language->get('text_edit') . ' ' . $this->data['name'];
         $this->data['update'] = $this->html->getSecureURL('listing_grid/blocks_grid/update_field', '&custom_block_id=' . $custom_block_id);
         $form = new AForm('HS');
     }
     $this->document->addBreadcrumb(array('href' => $this->data['action'], 'text' => $this->data['form_title'], 'separator' => ' :: ', 'current' => true));
     $form->setForm(array('form_name' => 'BannerBlockFrm', 'update' => $this->data['update']));
     $this->data['form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'BannerBlockFrm', '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'), 'style' => 'button1'));
     $this->data['form']['cancel'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'cancel', 'text' => $this->language->get('button_cancel'), 'style' => 'button2'));
     if ($custom_block_id) {
         $this->data['form']['fields']['block_status'] = $form->getFieldHtml(array('type' => 'checkbox', 'name' => 'block_status', 'value' => $this->data['status'], 'style' => 'btn_switch'));
         $this->data['form']['text']['block_status'] = $this->html->convertLinks($this->language->get('entry_block_status'));
         $this->data['form']['fields']['block_status_note'] = '';
         $this->data['form']['text']['block_status_note'] = $this->html->convertLinks($this->language->get('entry_block_status_note'));
     }
     $this->data['form']['fields']['block_name'] = $form->getFieldHtml(array('type' => 'hidden', 'name' => 'block_id', 'value' => $this->data['block_id']));
     $this->data['form']['fields']['block_name'] .= $form->getFieldHtml(array('type' => 'input', 'name' => 'block_name', 'value' => $this->data['name'], 'required' => true));
     $this->data['form']['text']['block_name'] = $this->language->get('entry_block_name');
     $this->data['form']['fields']['block_title'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'block_title', 'required' => true, 'value' => $this->data['title']));
     $this->data['form']['text']['block_title'] = $this->language->get('entry_block_title');
     // list of templates for block
     $tmpl_ids = $this->extensions->getInstalled('template');
     $tmpl_ids[] = 'default';
     $this->data['block_wrappers'] = array();
     foreach ($tmpl_ids as $tmpl_id) {
         // for tpls of block that stores in db
         $layout_manager = new ALayoutManager($tmpl_id);
         $block = $layout_manager->getBlockByTxtId('banner_block');
         $block_templates = (array) $layout_manager->getBlockTemplates($block['block_id']);
         foreach ($block_templates as $item) {
             if ($item['template']) {
                 $this->data['block_wrappers'][$item['template']] = $item['template'];
             }
         }
         //Automatic block template selection mode based on parent is limited to 1 template per location
         //To extend, allow custom block's template to be selected to suppress automatic selection
         //for tpls that stores in main.php (other extensions templates)
         $ext_tpls = $this->extensions->getExtensionTemplates();
         foreach ($ext_tpls as $section) {
             foreach ($section as $s => $tpls) {
                 if ($s != 'storefront') {
                     continue;
                 }
                 foreach ($tpls as $tpl) {
                     if (isset($this->data['block_wrappers'][$tpl]) || strpos($tpl, 'blocks/banner_block/') === false) {
                         continue;
                     }
                     $this->data['block_wrappers'][$tpl] = $tpl;
                 }
             }
         }
         $tpls = glob(DIR_STOREFRONT . 'view/*/template/blocks/banner_block/*.tpl');
         foreach ($tpls as $tpl) {
             $pos = strpos($tpl, 'blocks/banner_block/');
             $tpl = substr($tpl, $pos);
             if (!isset($this->data['block_wrappers'][$tpl])) {
                 $this->data['block_wrappers'][$tpl] = $tpl;
             }
         }
     }
     ksort($this->data['block_wrappers']);
     array_unshift($this->data['block_wrappers'], $this->language->get('text_automatic'));
     if ($this->data['block_wrapper'] && !isset($this->data['block_wrappers'][$this->data['block_wrapper']])) {
         $this->data['block_wrappers'] = array_merge(array($this->data['block_wrapper'] => $this->data['block_wrapper']), $this->data['block_wrappers']);
     }
     $this->data['form']['fields']['block_wrapper'] = $form->getFieldHtml(array('type' => 'selectbox', 'name' => 'block_wrapper', 'options' => $this->data['block_wrappers'], 'value' => $this->data['block_wrapper'], 'help_url' => $this->gen_help_url('block_wrapper')));
     $this->data['form']['text']['block_wrapper'] = $this->language->get('entry_block_wrapper');
     $this->data['form']['fields']['block_framed'] = $form->getFieldHtml(array('type' => 'checkbox', 'name' => 'block_framed', 'value' => $this->data['block_framed'], 'style' => 'btn_switch', 'help_url' => $this->gen_help_url('block_framed')));
     $this->data['form']['text']['block_framed'] = $this->language->get('entry_block_framed');
     $this->data['form']['fields']['block_description'] = $form->getFieldHtml(array('type' => 'textarea', 'name' => 'block_description', 'value' => $this->data['description'], 'attr' => ' style="height: 50px;"'));
     $this->data['form']['text']['block_description'] = $this->language->get('entry_block_description');
     // groups of banners
     $this->loadModel('extension/banner_manager');
     $result = $this->model_extension_banner_manager->getBannerGroups();
     $groups = array('0' => $this->language->get('text_select'));
     if ($result) {
         foreach ($result as $row) {
             $groups[$row['banner_group_name']] = $row['banner_group_name'];
         }
     }
     $this->data['form']['fields']['banner_group_name'] = $form->getFieldHtml(array('type' => 'selectbox', 'name' => 'banner_group_name', 'options' => $groups, 'value' => $this->data['banner_group_name'], 'style' => 'no-save'));
     $this->data['form']['text']['banner_group_name'] = $this->language->get('entry_banner_group_name');
     $this->data['form']['text']['listed_banners'] = $this->language->get('entry_banners_selected');
     //load only prior saved products
     $this->data['banners'] = array();
     $this->data['form']['fields']['listed_banners'] = $form->getFieldHtml(array('type' => 'multiselectbox', 'name' => 'block_banners[]', 'value' => $ids, 'options' => $options_list, 'style' => 'no-save chosen', 'ajax_url' => $this->html->getSecureURL('listing_grid/banner_manager/banners'), 'placeholder' => $this->language->get('text_select_from_lookup')));
     $this->view->batchAssign($this->language->getASet());
     $this->view->batchAssign($this->data);
     $this->view->assign('form_language_switch', $this->html->getContentLanguageSwitcher());
     $this->view->assign('language_code', $this->session->data['language']);
     $this->view->assign('help_url', $this->gen_help_url('banner_edit'));
     $this->view->assign('rl', $this->html->getSecureURL('common/resource_library', '&object_name=banners&type=image&mode=url'));
     $this->processTemplate('pages/extension/banner_manager_block_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');
     if (isset($this->request->get['product_id']) && $this->request->is_GET()) {
         $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->is_POST()) {
         $this->model_catalog_product->updateProductLinks($this->request->get['product_id'], $this->request->post);
         $this->session->data['success'] = $this->language->get('text_success');
         $this->redirect($this->html->getSecureURL('catalog/product_relations', '&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_relations', '&product_id=' . $this->request->get['product_id']), 'text' => $this->language->get('tab_relations'), 'separator' => ' :: ', 'current' => true));
     $this->loadModel('catalog/category');
     $this->data['categories'] = array();
     $results = $this->model_catalog_category->getCategories(0);
     foreach ($results as $r) {
         $this->data['categories'][$r['category_id']] = $r['name'];
     }
     $this->loadModel('setting/store');
     $this->data['stores'] = array(0 => $this->language->get('text_default'));
     $results = $this->model_setting_store->getStores();
     foreach ($results as $r) {
         $this->data['stores'][$r['store_id']] = $r['name'];
     }
     $this->data['product_category'] = $this->model_catalog_product->getProductCategories($this->request->get['product_id']);
     $this->data['product_store'] = $this->model_catalog_product->getProductStores($this->request->get['product_id']);
     $this->data['product_related'] = $this->model_catalog_product->getProductRelated($this->request->get['product_id']);
     $this->data['active'] = 'relations';
     //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['category_products'] = $this->html->getSecureURL('product/product/category');
     $this->data['related_products'] = $this->html->getSecureURL('product/product/related');
     $this->data['action'] = $this->html->getSecureURL('catalog/product_relations', '&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'] = $this->html->getSecureURL('listing_grid/product/update_relations_field', '&id=' . $this->request->get['product_id']);
     $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'], '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'), 'style' => 'button1'));
     $this->data['form']['cancel'] = $form->getFieldHtml(array('type' => 'button', 'href' => $this->html->getSecureURL('catalog/product/update', '&product_id=' . $this->request->get['product_id']), 'name' => 'cancel', 'text' => $this->language->get('button_cancel'), 'style' => 'button2'));
     $this->data['cancel'] = $this->html->getSecureURL('catalog/product');
     $this->loadModel('catalog/category');
     $this->data['categories'] = array();
     $results = $this->model_catalog_category->getCategories(0);
     foreach ($results as $r) {
         $this->data['categories'][$r['category_id']] = $r['name'];
     }
     $this->data['form']['fields']['category'] = $form->getFieldHtml(array('type' => 'checkboxgroup', 'name' => 'product_category[]', 'value' => $this->data['product_category'], 'options' => $this->data['categories'], 'style' => 'chosen', 'placeholder' => $this->language->get('text_select_category')));
     //load only prior saved products
     $resource = new AResource('image');
     $this->data['products'] = array();
     if (count($this->data['product_related'])) {
         $this->loadModel('catalog/product');
         $filter = array('subsql_filter' => 'p.product_id in (' . implode(',', $this->data['product_related']) . ')');
         $results = $this->model_catalog_product->getProducts($filter);
         foreach ($results as $r) {
             $thumbnail = $resource->getMainThumb('products', $r['product_id'], (int) $this->config->get('config_image_grid_width'), (int) $this->config->get('config_image_grid_height'), true);
             $this->data['products'][$r['product_id']]['name'] = $r['name'] . " (" . $r['model'] . ")";
             $this->data['products'][$r['product_id']]['image'] = $thumbnail['thumb_html'];
         }
     }
     $this->data['form']['fields']['related'] = $form->getFieldHtml(array('type' => 'multiselectbox', 'name' => 'product_related[]', 'value' => $this->data['product_related'], 'options' => $this->data['products'], 'style' => 'chosen', 'ajax_url' => $this->html->getSecureURL('r/product/product/products'), 'placeholder' => $this->language->get('text_select_from_lookup')));
     $this->data['form']['fields']['store'] = $form->getFieldHtml(array('type' => 'checkboxgroup', 'name' => 'product_store[]', 'value' => $this->data['product_store'], 'options' => $this->data['stores'], 'style' => 'chosen'));
     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->addChild('pages/catalog/product_summary', 'summary_form', 'pages/catalog/product_summary.tpl');
     $this->view->assign('help_url', $this->gen_help_url('?p=62'));
     $this->view->batchAssign($this->data);
     $this->processTemplate('pages/catalog/product_relations.tpl');
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
 }
示例#29
0
 public function edit()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $extension = $this->request->get['extension'];
     if (!$extension) {
         $this->redirect($this->html->getSecureURL('extension/extensions'));
     }
     $this->document->resetBreadcrumbs();
     $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('extension/extensions/' . $this->session->data['extension_filter']), 'text' => $this->language->get('heading_title'), 'separator' => ' :: '));
     $this->loadLanguage('extension/extensions');
     $this->loadLanguage($extension . '/' . $extension);
     $store_id = (int) $this->session->data['current_store_id'];
     if ($this->request->get_or_post('store_id')) {
         $store_id = $this->request->get_or_post('store_id');
     }
     $ext = new ExtensionUtils($extension, $store_id);
     $settings = $ext->getSettings();
     $this->data['extension_info'] = $this->extensions->getExtensionInfo($extension);
     if (!$this->data['extension_info']) {
         // if extension is not installed yet - redirect to list
         $this->redirect($this->html->getSecureURL('extension/extensions'));
     }
     $this->data['extension_info']['id'] = $extension;
     $this->data['form_store_switch'] = $this->html->getStoreSwitcher();
     /** build aform with settings**/
     $form = new AForm('HS');
     $form->setForm(array('form_name' => 'editSettings', 'update' => $this->html->getSecureURL('listing_grid/extension/update', '&id=' . $extension . '&store_id=' . $store_id)));
     $this->data['form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'editSettings', 'attr' => 'data-confirm-exit="true" class="aform form-horizontal"', 'action' => $this->html->getSecureURL('extension/extensions/edit/', '&action=save&extension=' . $extension . '&store_id=' . $store_id)));
     $result = array('resource_field_list' => array());
     foreach ($settings as $item) {
         $data = array();
         if ($item['name'] == $extension . '_status') {
             $data['attr'] = ' reload_on_save="true"';
             $status = $item['value'];
             //set sign for confirmation modal about dependendants for disable action
             if ($item['value'] == 1) {
                 $children = $this->extension_manager->getChildrenExtensions($extension);
                 if ($children) {
                     foreach ($children as $child) {
                         if ($this->config->get($child['key'] . '_status')) {
                             $this->data['has_dependants'] = true;
                             break;
                         }
                     }
                 }
             }
         }
         $data['name'] = $item['name'];
         $data['type'] = $item['type'];
         $data['value'] = $item['value'];
         $data['required'] = (bool) $item['required'];
         if ($item['note']) {
             $data['note'] = $item['note'];
         } else {
             $note_text = $this->language->get($data['name']);
             // if text definition not found - seek it in default settings definitions
             if ($note_text == $data['name']) {
                 $new_text_key = str_replace($extension . '_', 'text_', $data['name']);
                 $note_text = $this->language->get($new_text_key);
                 if ($note_text == $new_text_key) {
                     $note_text = $this->language->get($new_text_key . '_' . $this->data['extension_info']['type']);
                 }
             }
             $data['note'] = $note_text;
         }
         if ($item['style']) {
             $data['style'] = $item['style'];
         }
         if ($item['attr']) {
             $data['attr'] = $item['attr'];
         }
         if ($item['readonly']) {
             $data['readonly'] = $item['readonly'];
         }
         switch ($data['type']) {
             case 'selectbox':
             case 'multiselectbox':
             case 'checkboxgroup':
                 // if options need to extract from db
                 $data['options'] = $item['options'];
                 if ($item['model_rt'] != '') {
                     //force to load models even before extension is enabled
                     $this->loadModel($item['model_rt'], 'force');
                     $model = $this->{'model_' . str_replace("/", "_", $item['model_rt'])};
                     $method_name = $item['method'];
                     if (method_exists($model, $method_name)) {
                         $res = call_user_func(array($model, $method_name));
                         if ($res) {
                             $field1 = $item['field1'];
                             $field2 = $item['field2'];
                             foreach ($res as $opt) {
                                 $data['options'][$opt[$field1]] = $opt[$field2];
                             }
                         }
                     }
                 }
                 if ($data['type'] == 'checkboxgroup' || $data['type'] == 'multiselectbox') {
                     #custom settings for multivalue
                     $data['scrollbox'] = 'true';
                     if (substr($item['name'], -2) != '[]') {
                         $data['name'] = $item['name'] . "[]";
                     }
                     $data['style'] = "chosen";
                 }
                 break;
             case 'html_template':
                 // if options need to extract from db
                 $data['template'] = $item['template'];
                 $data['options'] = $item['options'];
                 if ($item['model_rt'] != '') {
                     //force to load models even before extension is enabled
                     $this->loadModel($item['model_rt'], 'force');
                     $model = $this->{'model_' . str_replace("/", "_", $item['model_rt'])};
                     $method_name = $item['method'];
                     if (method_exists($model, $method_name)) {
                         $data['options'][$method_name] = call_user_func(array($model, $method_name));
                     }
                 }
                 break;
             case 'checkbox':
                 $data['style'] = "btn_switch";
                 if ($item['name'] == $extension . '_status') {
                     $data['style'] .= " status_switch";
                 }
                 break;
             case 'resource':
                 $item['resource_type'] = (string) $item['resource_type'];
                 $data['rl_types'] = array($item['resource_type']);
                 $data['rl_type'] = $item['resource_type'];
                 //check if ID for resource is provided or path
                 if (is_numeric($item['value'])) {
                     $data['resource_id'] = $item['value'];
                 } else {
                     $data['resource_path'] = $item['value'];
                 }
                 if (!$result['rl_scripts']) {
                     $scripts = $this->dispatch('responses/common/resource_library/get_resources_scripts', array('object_name' => '', 'object_id' => '', 'types' => array($item['resource_type']), 'onload' => true, 'mode' => 'single'));
                     $result['rl_scripts'] = $scripts->dispatchGetOutput();
                     unset($scripts);
                 }
                 break;
             default:
         }
         $html = '';
         //if template process diffrently
         if (has_value((string) $data['template'])) {
             //build path to template directory.
             $dir_template = DIR_EXT . $extension . DIR_EXT_ADMIN . DIR_EXT_TEMPLATE . $this->config->get('admin_template') . "/template/" . $data['template'];
             //validate template and report issue
             if (!file_exists($dir_template)) {
                 $warning = new AWarning(sprintf($this->language->get('error_could_not_load_override'), $dir_template, $extension));
                 $warning->toLog()->toDebug();
             } else {
                 $this->view->batchAssign($data);
                 $html = $this->view->fetch($dir_template);
             }
         } else {
             $html = $form->getFieldHtml($data);
         }
         $result['html'][$data['name']] = array('note' => $data['note'], 'value' => $html);
     }
     // end building aform
     $this->data['settings'] = $result['html'];
     $this->data['resources_scripts'] = $result['rl_scripts'];
     $this->data['target_url'] = $this->html->getSecureURL('extension/extensions/edit', '&extension=' . $extension . '&store_id=' . $store_id);
     //check if we restore settings to default values
     if (isset($this->request->get['restore']) && $this->request->get['restore']) {
         $this->extension_manager->editSetting($extension, $ext->getDefaultSettings());
         $this->cache->delete('settings.extension');
         $this->session->data['success'] = $this->language->get('text_restore_success');
         $this->redirect($this->data['target_url']);
     }
     //check if we save settings with the post
     if ($this->request->is_POST() && $this->_validateSettings($extension, $store_id)) {
         $save_data = $this->request->post;
         foreach ($settings as $item) {
             if (!isset($this->request->post[$item['name']])) {
                 $save_data[$item['name']] = 0;
             }
         }
         $save_data['store_id'] = $store_id;
         $this->extension_manager->editSetting($extension, $save_data);
         $this->cache->delete('settings.extension');
         $this->session->data['success'] = $this->language->get('text_save_success');
         $this->redirect($this->data['target_url']);
     }
     $conflict_resources = $ext->validateResources();
     if (!empty($conflict_resources)) {
         ob_start();
         print_r($conflict_resources);
         $err = ob_get_clean();
         ADebug::warning('resources conflict', AC_ERR_USER_WARNING, $extension . ' Extension resources conflict detected.<br/><pre>' . $err . '</pre>');
     }
     $this->document->setTitle($this->language->get($extension . '_name'));
     $this->document->addBreadcrumb(array('href' => $this->data['target_url'], 'text' => $this->language->get($extension . '_name'), 'separator' => ' :: ', 'current' => true));
     $this->data['heading_title'] = $this->language->get($extension . '_name');
     $this->data['text_version'] = $this->language->get('text_version');
     $this->data['text_installed_on'] = $this->language->get('text_installed_on');
     $this->data['text_date_added'] = $this->language->get('text_date_added');
     $this->data['text_license'] = $this->language->get('text_license');
     $this->data['text_dependency'] = $this->language->get('text_dependency');
     $this->data['text_configuration_settings'] = $this->language->get('text_configuration_settings');
     $this->data['button_back'] = $this->html->buildElement(array('type' => 'button', 'name' => 'btn_back', 'text' => $this->language->get('text_back')));
     $this->data['button_reload'] = $this->html->buildElement(array('type' => 'button', 'name' => 'btn_reload', 'text' => $this->language->get('text_reload')));
     $this->data['button_restore_defaults'] = $this->html->buildElement(array('type' => 'button', 'name' => 'button_restore_defaults', 'text' => $this->language->get('button_restore_defaults'), 'href' => $this->html->getSecureURL('extension/extensions/edit', '&extension=' . $extension . '&reload=1')));
     $this->data['button_save'] = $this->html->buildElement(array('type' => 'button', 'name' => 'btn_save', 'text' => $this->language->get('button_save')));
     $this->data['button_save_green'] = $this->html->buildElement(array('type' => 'button', 'name' => 'btn_save', 'text' => $this->language->get('button_save')));
     $this->data['button_reset'] = $this->html->buildElement(array('type' => 'button', 'name' => 'btn_reset', 'text' => $this->language->get('text_reset')));
     $this->data['reload'] = $this->html->getSecureURL('extension/extensions/edit', '&extension=' . $extension);
     $this->data['back'] = $this->html->getSecureURL('extension/extensions/' . $this->session->data['extension_filter']);
     $this->data['update'] = $this->html->getSecureURL('listing_grid/extension/update', '&id=' . $extension . '&store_id=' . $store_id);
     $this->data['dependants_url'] = $this->html->getSecureURL('listing_grid/extension/dependants', '&extension=' . $extension);
     if (!$this->extension_manager->validateDependencies($extension, getExtensionConfigXml($extension))) {
         $this->error['warning'] = $this->language->get('error_dependencies');
     }
     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'] = '';
     }
     if (isset($this->session->data['error'])) {
         $this->data['error_warning'] = $this->session->data['error'];
         unset($this->session->data['error']);
     } else {
         $this->data['error'] = '';
     }
     //info about available updates
     $upd = $this->cache->get('extensions.updates');
     if (is_array($upd) && in_array($extension, array_keys($upd))) {
         $this->data['info'] = sprintf($this->language->get('text_update_available'), $upd[$extension]['version'], $this->html->getSecureURL('tool/package_installer', '&extension_key=' . $upd[$extension]['installation_key']));
     }
     $missing_extensions = $this->extensions->getMissingExtensions();
     //if extension is missing - do redirect on extensions list with alert!
     if (in_array($extension, $missing_extensions)) {
         $this->session->data['error'] = sprintf($this->language->get('text_missing_extension'), $extension);
         $this->redirect($this->html->getSecureURL('extension/extensions'));
     }
     $this->data['extension_info']['note'] = $ext->getConfig('note') ? $this->html->convertLinks($this->language->get($extension . '_note')) : '';
     $config = $ext->getConfig();
     if (!empty($config->preview->item)) {
         foreach ($config->preview->item as $item) {
             if (!is_file(DIR_EXT . $extension . DIR_EXT_IMAGE . (string) $item)) {
                 continue;
             }
             $this->data['extension_info']['preview'][] = HTTPS_EXT . $extension . DIR_EXT_IMAGE . (string) $item;
         }
         //image gallery scripts and css for previews
         $this->document->addStyle(array('href' => RDIR_TEMPLATE . 'javascript/blueimp-gallery/css/bootstrap-image-gallery.css', 'rel' => 'stylesheet'));
         $this->document->addStyle(array('href' => RDIR_TEMPLATE . 'javascript/blueimp-gallery/css/blueimp-gallery.min.css', 'rel' => 'stylesheet'));
         $this->document->addScript(RDIR_TEMPLATE . 'javascript/blueimp-gallery/jquery.blueimp-gallery.min.js');
         $this->document->addScript(RDIR_TEMPLATE . 'javascript/blueimp-gallery/bootstrap-image-gallery.js');
     }
     if ($ext->getConfig('help_link')) {
         $this->data['extension_info']['help'] = array('ext_link' => array('text' => $this->language->get('text_developer_site'), 'link' => $ext->getConfig('help_link')));
     }
     if ($ext->getConfig('help_file')) {
         $this->data['extension_info']['help']['file'] = array('link' => $this->html->getSecureURL('extension/extension/help', '&extension=' . $this->request->get['extension']), 'text' => $this->language->get('button_howto'));
     }
     $this->data['extension_info']['dependencies'] = array();
     $this->data['extension_info']['extensions'] = $this->extensions->getEnabledExtensions();
     $missing_extensions = $this->extensions->getMissingExtensions();
     $db_extensions = $this->extensions->getDbExtensions();
     if (isset($config->dependencies->item)) {
         foreach ($config->dependencies->item as $item) {
             $id = (string) $item;
             $actions = array();
             if ($this->config->has($id . '_status')) {
                 $status = $this->language->get('text_installed') . ' (' . $this->language->get('text_enabled') . ')';
             } else {
                 $status = $this->language->get('text_not_installed') . ' (' . $this->language->get('text_disabled') . ')';
             }
             if (in_array($id, $db_extensions)) {
                 if (in_array($id, $missing_extensions)) {
                     $class = 'warning';
                     $status = sprintf($this->language->get('text_missing_extension'), $id);
                     $actions['delete'] = $this->html->buildElement(array('type' => 'button', 'href' => $this->html->getSecureURL('extension/extensions/delete', '&extension=' . $id), 'target' => '_blank', 'style' => 'btn_delete', 'icon' => 'fa fa-trash-o', 'title' => $this->language->get('text_delete')));
                 } else {
                     if (!$this->config->has($id . '_status')) {
                         $actions['install'] = $this->html->buildElement(array('type' => 'button', 'href' => $this->html->getSecureURL('extension/extensions/install', '&extension=' . $id), 'target' => '_blank', 'style' => 'btn_install', 'icon' => 'fa fa-play', 'title' => $this->language->get('text_install')));
                         $actions['delete'] = $this->html->buildElement(array('type' => 'button', 'href' => $this->html->getSecureURL('extension/extensions/delete', '&extension=' . $id), 'target' => '_blank', 'style' => 'btn_delete', 'icon' => 'fa fa-trash-o', 'title' => $this->language->get('text_delete')));
                     } else {
                         $actions['edit'] = $this->html->buildElement(array('type' => 'button', 'href' => $this->html->getSecureURL('extension/extensions/edit', '&extension=' . $id), 'target' => '_blank', 'style' => 'btn_edit', 'icon' => 'fa fa-edit', 'title' => $this->language->get('text_edit')));
                         if (!(bool) $item['required']) {
                             $actions['uninstall'] = $this->html->buildElement(array('type' => 'button', 'href' => $this->html->getSecureURL('extension/extensions/uninstall', '&extension=' . $id), 'target' => '_blank', 'style' => 'btn_uninstall', 'icon' => 'fa fa-times', 'title' => $this->language->get('text_uninstall')));
                         }
                     }
                 }
             } else {
                 $actions['mp'] = $this->html->buildElement(array('type' => 'button', 'href' => $this->html->getSecureURL('extension/extensions_store', '&extension=' . $id), 'target' => '_blank', 'style' => 'btn_mp', 'icon' => 'fa fa-play', 'title' => $this->language->get('text_visit_repository')));
             }
             $this->data['extension_info']['dependencies'][] = array('required' => (bool) $item['required'], 'id' => $id, 'status' => $status, 'actions' => $actions, 'class' => $class);
             unset($class);
         }
     }
     // additional settings page
     if ($ext->getConfig('additional_settings')) {
         $btn_param = array('type' => 'button', 'name' => 'btn_addsett', 'href' => $this->html->getSecureURL($ext->getConfig('additional_settings')), 'text' => $this->language->get('text_additional_settings'), 'style' => 'button1');
         if ($store_id) {
             $this->loadModel('setting/store');
             $store_info = $this->model_setting_store->getStore($store_id);
             $btn_param['link'] = $store_info['config_url'] . '?s=' . ADMIN_PATH . '&rt=' . $ext->getConfig('additional_settings');
             $btn_param['target'] = '_blank';
             $btn_param['onclick'] = 'onclick="return confirm(\'' . $this->language->get('additional_settings_confirm') . '\');"';
         }
         $this->data['add_sett'] = $this->html->buildElement($btn_param);
     }
     $this->data['target_url'] = $this->html->getSecureURL('extension/extensions/edit', '&extension=' . $extension);
     $this->view->assign('help_url', $this->gen_help_url('extension_edit'));
     $template = 'pages/extension/extensions_edit.tpl';
     //#PR set custom templates for extension settings page.
     if (has_value((string) $config->custom_settings_template)) {
         //build path to template directory.
         $dir_template = DIR_EXT . $extension . DIR_EXT_ADMIN . DIR_EXT_TEMPLATE . $this->config->get('admin_template') . "/template/";
         $dir_template .= (string) $config->custom_settings_template;
         //validate template and report issue
         if (!file_exists($dir_template)) {
             $warning = new AWarning(sprintf($this->language->get('error_could_not_load_override'), $dir_template, $extension));
             $warning->toLog()->toDebug();
         } else {
             $template = $dir_template;
         }
     }
     //load tabs controller for addtional settings
     if ($this->data['add_sett']) {
         $this->data['groups'][] = 'additional_settings';
         $this->data['link_additional_settings'] = $this->data['add_sett']->href . '&extension=' . $extension;
     }
     $tabs_obj = $this->dispatch('pages/extension/extension_tabs', array($this->data));
     $this->data['tabs'] = $tabs_obj->dispatchGetOutput();
     unset($tabs_obj);
     $obj = $this->dispatch('pages/extension/extension_summary', array($this->data));
     $this->data['extension_summary'] = $obj->dispatchGetOutput();
     unset($obj);
     $this->view->batchAssign($this->data);
     $this->processTemplate($template);
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
 }
示例#30
0
 public function main()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     //is this an embed mode
     $cart_rt = 'checkout/cart';
     if ($this->config->get('embed_mode') == true) {
         $cart_rt = 'r/checkout/cart/embed';
     }
     if (!$this->cart->hasProducts() || !$this->cart->hasStock() && !$this->config->get('config_stock_checkout')) {
         $this->redirect($this->html->getSecureURL($cart_rt));
     }
     //validate if order min/max are met
     if (!$this->cart->hasMinRequirement() || !$this->cart->hasMaxRequirement()) {
         $this->redirect($this->html->getSecureURL($cart_rt));
     }
     if ($this->customer->isLogged()) {
         $this->redirect($this->html->getSecureURL('checkout/shipping'));
     }
     if (!$this->config->get('config_guest_checkout') || $this->cart->hasDownload()) {
         $this->session->data['redirect'] = $this->html->getSecureURL('checkout/shipping');
         $this->redirect($this->html->getSecureURL('account/login'));
     }
     if (!isset($this->session->data['guest'])) {
         $this->redirect($this->html->getSecureURL('checkout/guest_step_1'));
     }
     if (!$this->cart->hasShipping()) {
         unset($this->session->data['shipping_method']);
         unset($this->session->data['shipping_methods']);
         //$this->tax->setZone($this->config->get('config_country_id'), $this->config->get('config_zone_id'));
         $this->tax->setZone($this->session->data['country_id'], $this->session->data['zone_id']);
     }
     $this->document->setTitle($this->language->get('heading_title'));
     if ($this->request->is_POST() && isset($this->request->post['coupon']) && $this->_validateCoupon()) {
         $this->session->data['coupon'] = $this->request->post['coupon'];
         $this->session->data['success'] = $this->language->get('text_success');
         if ($this->cart->getFinalTotal() == 0 && $this->request->get['mode'] != 'edit') {
             $this->session->data['payment_method'] = array('id' => 'no_payment_required', 'title' => $this->language->get('no_payment_required'));
         }
         //process data
         $this->extensions->hk_ProcessData($this, 'apply_coupon');
         $this->redirect($this->html->getSecureURL('checkout/guest_step_3'));
     }
     if ($this->request->is_POST() && !isset($this->request->post['coupon']) && $this->validate()) {
         if (isset($this->request->post['shipping_method'])) {
             $shipping = explode('.', $this->request->post['shipping_method']);
             $this->session->data['shipping_method'] = $this->session->data['shipping_methods'][$shipping[0]]['quote'][$shipping[1]];
         }
         if ($this->cart->getFinalTotal() == 0 && $this->request->get['mode'] != 'edit') {
             $this->session->data['payment_method'] = array('id' => 'no_payment_required', 'title' => $this->language->get('no_payment_required'));
         } else {
             $this->session->data['payment_method'] = $this->session->data['payment_methods'][$this->request->post['payment_method']];
         }
         $this->session->data['comment'] = $this->request->post['comment'];
         $this->extensions->hk_ProcessData($this);
         $this->redirect($this->html->getSecureURL('checkout/guest_step_3'));
     }
     $this->loadModel('checkout/extension');
     // Shipping Methods
     if ($this->cart->hasShipping() && (!isset($this->session->data['shipping_methods']) || !$this->config->get('config_shipping_session'))) {
         $quote_data = array();
         $results = $this->model_checkout_extension->getExtensions('shipping');
         foreach ($results as $result) {
             $this->loadModel('extension/' . $result['key']);
             if (isset($this->session->data['guest']['shipping'])) {
                 $quote = $this->{'model_extension_' . $result['key']}->getQuote($this->session->data['guest']['shipping']);
             } else {
                 $quote = $this->{'model_extension_' . $result['key']}->getQuote($this->session->data['guest']);
             }
             if ($quote) {
                 $quote_data[$result['key']] = array('title' => $quote['title'], 'quote' => $quote['quote'], 'sort_order' => $quote['sort_order'], 'error' => $quote['error']);
                 //# Add storefront icon if available
                 $ext_setgs = $this->model_checkout_extension->getSettings($result['key']);
                 $icon = $ext_setgs[$result['key'] . "_shipping_storefront_icon"];
                 if (has_value($icon)) {
                     $icon_data = $this->model_checkout_extension->getSettingImage($icon);
                     $icon_data['image'] = $icon;
                     $quote_data[$result['key']]['icon'] = $icon_data;
                 }
             }
         }
         $sort_order = array();
         foreach ($quote_data as $key => $value) {
             $sort_order[$key] = $value['sort_order'];
         }
         array_multisort($sort_order, SORT_ASC, $quote_data);
         $this->session->data['shipping_methods'] = $quote_data;
     }
     // Payment Methods
     $total = $this->cart->buildTotalDisplay();
     $this->data['order_totals'] = $total;
     $method_data = array();
     $results = $this->model_checkout_extension->getExtensions('payment');
     foreach ($results as $result) {
         #filter only allowed payment methods based on total min/max
         $ext_setgs = $this->model_checkout_extension->getSettings($result['key']);
         $min = $ext_setgs[$result['key'] . "_payment_minimum_total"];
         $max = $ext_setgs[$result['key'] . "_payment_maximum_total"];
         if (has_value($min) && $total['total'] < $min || has_value($max) && $total['total'] > $max) {
             continue;
         }
         $this->loadModel('extension/' . $result['key']);
         $method = $this->{'model_extension_' . $result['key']}->getMethod($this->session->data['guest']);
         if ($method) {
             $method_data[$result['key']] = $method;
             $method_data[$result['key']]['extension_id'] = $result['extension_id'];
             //# Add storefront icon if available
             $icon = $ext_setgs[$result['key'] . "_payment_storefront_icon"];
             if (has_value($icon)) {
                 $icon_data = $this->model_checkout_extension->getSettingImage($icon);
                 $icon_data['image'] = $icon;
                 $method_data[$result['key']]['icon'] = $icon_data;
             }
             //check if this is a redirect type of the payment
             if ($ext_setgs[$result['key'] . "_redirect_payment"]) {
                 $method_data[$result['key']]['is_redirect_payment'] = true;
             }
         }
     }
     //sort payments
     $sort_order = array();
     foreach ($method_data as $key => $value) {
         $sort_order[$key] = $value['sort_order'];
     }
     array_multisort($sort_order, SORT_ASC, $method_data);
     $this->session->data['payment_methods'] = $method_data;
     $skip_step = false;
     //# If only 1 shipping and 1 payment it is set to be defaulted, select and skip and redirect to checkout guest_step_3
     if (count($this->session->data['shipping_methods']) == 1) {
         //set only method
         $only_method = $this->session->data['shipping_methods'];
         foreach ($only_method as $method_name => $value) {
             #Check config if we allowed to set this shipping and skip the step
             $ext_config = $this->model_checkout_extension->getSettings($method_name);
             if ($ext_config[$method_name . "_autoselect"]) {
                 //take first qoute. This needs to be acounted for if configure shipping to be autoselected
                 if (sizeof($only_method[$method_name]['quote']) == 1) {
                     $this->session->data['shipping_method'] = current($only_method[$method_name]['quote']);
                     $skip_step = true;
                 }
             }
         }
     } else {
         if (count($this->session->data['shipping_methods']) == 0) {
             //if not shipment, skip
             $skip_step = true;
         }
     }
     if ($skip_step && $this->request->get['mode'] != 'edit') {
         $ac_payments = array();
         #Check config if selected shipping method have accepted payments restriction
         $ship_ext_config = $this->model_checkout_extension->getSettings($method_name);
         $accept_payment_ids = $ship_ext_config[$method_name . "_accept_payments"];
         if (is_array($accept_payment_ids) && count($accept_payment_ids)) {
             #filter only allowed payment methods based on shipping
             foreach ($this->session->data['payment_methods'] as $key => $res_payment) {
                 if (in_array($res_payment['extension_id'], $accept_payment_ids)) {
                     $ac_payments[$key] = $res_payment;
                 }
             }
         } else {
             $ac_payments = $this->session->data['payment_methods'];
         }
         if (count($ac_payments) == 1) {
             //set only method
             $only_method = $ac_payments;
             foreach ($only_method as $method_name => $value) {
                 #Check config if we allowed to set this payment and skip the step
                 $ext_config = $this->model_checkout_extension->getSettings($method_name);
                 if ($ext_config[$method_name . "_autoselect"] && $skip_step) {
                     $this->session->data['payment_method'] = $only_method[$method_name];
                     $this->redirect($this->html->getSecureURL('checkout/guest_step_3'));
                 }
             }
         }
     }
     $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($cart_rt), 'text' => $this->language->get('text_cart'), 'separator' => $this->language->get('text_separator')));
     $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('checkout/guest_step_1'), 'text' => $this->language->get('text_guest_step_1'), 'separator' => $this->language->get('text_separator')));
     $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('checkout/guest_step_2'), 'text' => $this->language->get('text_guest_step_2'), 'separator' => $this->language->get('text_separator')));
     $this->data['text_payment_methods'] = $this->language->get('text_payment_methods');
     $this->data['text_coupon'] = $this->language->get('text_coupon');
     $this->data['entry_coupon'] = $this->language->get('entry_coupon');
     if (isset($this->session->data['error'])) {
         $this->view->assign('error_warning', $this->session->data['error']);
         unset($this->session->data['error']);
     } elseif (isset($this->error['warning'])) {
         $this->view->assign('error_warning', $this->error['warning']);
     } else {
         $this->view->assign('error_warning', '');
     }
     $this->view->assign('success', $this->session->data['success']);
     if (isset($this->session->data['success'])) {
         unset($this->session->data['success']);
     }
     $action = $this->html->getSecureURL('checkout/guest_step_2', $this->request->get['mode'] ? '&mode=' . $this->request->get['mode'] : '', true);
     $this->data['coupon_status'] = $this->config->get('coupon_status');
     $item = $this->html->buildElement(array('type' => 'button', 'name' => 'change_address', 'style' => 'button', 'text' => $this->language->get('button_change_address')));
     $this->data['change_address'] = $item->getHTML();
     $form = new AForm();
     $form->setForm(array('form_name' => 'coupon'));
     $this->data['form0']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'coupon', 'action' => $action));
     $this->data['form0']['coupon'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'coupon', 'value' => isset($this->request->post['coupon']) ? $this->request->post['coupon'] : $this->session->data['coupon']));
     $this->data['form0']['submit'] = $form->getFieldHtml(array('type' => 'submit', 'name' => $this->language->get('button_coupon')));
     if (isset($this->session->data['shipping_methods']) && !$this->session->data['shipping_methods']) {
         $this->view->assign('error_warning', $this->language->get('error_no_shipping'));
     }
     $form = new AForm();
     $form->setForm(array('form_name' => 'guest'));
     $this->data['form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'guest', 'action' => $action));
     $this->data['shipping_methods'] = $this->session->data['shipping_methods'] ? $this->session->data['shipping_methods'] : array();
     $shipping = isset($this->request->post['shipping_method']) ? $this->request->post['shipping_method'] : $this->session->data['shipping_method']['id'];
     if ($this->data['shipping_methods']) {
         foreach ($this->data['shipping_methods'] as $k => $v) {
             foreach ($v['quote'] as $key => $val) {
                 $this->data['shipping_methods'][$k]['quote'][$key]['radio'] = $form->getFieldHtml(array('type' => 'radio', 'id' => $val['id'], 'name' => 'shipping_method', 'options' => array($val['id'] => ''), 'value' => $shipping == $val['id'] ? true : false));
             }
         }
     } else {
         $this->data['shipping_methods'] = array();
     }
     $payment = isset($this->request->post['payment_method']) ? $this->request->post['payment_method'] : $this->session->data['payment_method']['id'];
     if ($this->session->data['payment_methods']) {
         if ($this->session->data['shipping_methods']) {
             //build array with payments available per each shippiment
             foreach ($this->session->data['shipping_methods'] as $method_name => $method_val) {
                 #Check config of selected shipping method and see if we have accepted payments restriction
                 $ship_ext_config = $this->model_checkout_extension->getSettings($method_name);
                 $accept_payment_ids = $ship_ext_config[$method_name . "_accept_payments"];
                 if (is_array($accept_payment_ids) && count($accept_payment_ids)) {
                     #filter only allowed payment methods
                     $ac_payments = array();
                     foreach ($this->session->data['payment_methods'] as $key => $res_payment) {
                         if (in_array($res_payment['extension_id'], $accept_payment_ids)) {
                             $ac_payments[$key] = $res_payment;
                         }
                     }
                 } else {
                     $ac_payments = $this->session->data['payment_methods'];
                 }
                 foreach ($ac_payments as $key => $value) {
                     $this->data['payment_methods'][$method_name][$key] = $value;
                     $this->data['payment_methods'][$method_name][$key]['radio'] = $form->getFieldHtml(array('type' => 'radio', 'name' => 'payment_method', 'options' => array($value['id'] => ''), 'value' => $payment == $value['id'] ? true : false));
                 }
             }
         } else {
             //no shipping available show one set of payments
             foreach ($this->session->data['payment_methods'] as $key => $value) {
                 $this->data['payment_methods']['no_shipping'][$key] = $value;
                 $this->data['payment_methods']['no_shipping'][$key]['radio'] = $form->getFieldHtml(array('type' => 'radio', 'name' => 'payment_method', 'options' => array($value['id'] => ''), 'value' => $payment == $value['id'] ? true : false));
             }
         }
     } else {
         $this->data['payment_methods'] = array();
     }
     $this->data['comment'] = isset($this->request->post['comment']) ? $this->request->post['comment'] : $this->session->data['comment'];
     $this->data['form']['comment'] = $form->getFieldHtml(array('type' => 'textarea', 'name' => 'comment', 'value' => $this->data['comment'], 'attr' => ' rows="3" style="width: 99%" '));
     if ($this->config->get('config_checkout_id')) {
         $this->loadModel('catalog/content');
         $content_info = $this->model_catalog_content->getContent($this->config->get('config_checkout_id'));
         if ($content_info) {
             $this->data['text_agree'] = $this->language->get('text_agree');
             $this->data['text_agree_href'] = $this->html->getURL('r/content/content/loadInfo', '&content_id=' . $this->config->get('config_checkout_id'));
             $this->data['text_agree_href_text'] = $content_info['title'];
         } else {
             $this->data['text_agree'] = '';
         }
     } else {
         $this->data['text_agree'] = '';
     }
     if ($this->data['text_agree']) {
         $this->data['form']['agree'] = $form->getFieldHtml(array('type' => 'checkbox', 'name' => 'agree', 'value' => '1', 'checked' => $this->request->post['agree'] ? true : false));
     }
     $this->data['agree'] = $this->request->post['agree'];
     $this->data['back'] = $this->html->getSecureURL('checkout/guest_step_1');
     $this->data['form']['back'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'back', 'style' => 'button', 'text' => $this->language->get('button_back')));
     $this->data['form']['continue'] = $form->getFieldHtml(array('type' => 'submit', 'name' => $this->language->get('button_continue')));
     //render buttons
     $this->view->batchAssign($this->data);
     $this->view->assign('buttons', $this->view->fetch('pages/checkout/payment.buttons.tpl'));
     $this->processTemplate('pages/checkout/guest_step_2.tpl');
     //init controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
 }