Beispiel #1
0
 public function actonbehalf()
 {
     $this->extensions->hk_InitData($this, __FUNCTION__);
     if (isset($this->request->get['customer_id'])) {
         //NOTE: if need to act on additional store - redirect to it's admin side.
         // and then to storefront because crossdomain restriction for session cookie
         $this->loadModel('setting/store');
         $store_settings = $this->model_setting_store->getStore($this->session->data['current_store_id']);
         if ($this->config->get('config_url') != $this->model_setting_store->getStoreURL($this->session->data['current_store_id'])) {
             if ($store_settings) {
                 if ($store_settings['config_ssl']) {
                     $add_store_url = $store_settings['config_ssl_url'] . '?s=' . ADMIN_PATH . '&rt=sale/customer/actonbehalf&customer_id=' . $this->request->get['customer_id'];
                 } else {
                     $add_store_url = $store_settings['config_url'] . '?s=' . ADMIN_PATH . '&rt=sale/customer/actonbehalf&customer_id=' . $this->request->get['customer_id'];
                 }
                 $this->redirect($add_store_url);
             }
         } else {
             startStorefrontSession($this->user->getId(), array('customer_id' => $this->request->get['customer_id']));
             if ($store_settings['config_ssl']) {
                 $this->redirect($this->html->getCatalogURL('account/account', '', '', true));
             } else {
                 $this->redirect($this->html->getCatalogURL('account/account'));
             }
         }
     }
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
     $this->redirect($this->html->getSecureURL('sale/customer'));
 }
Beispiel #2
0
 /**
  * update only one field
  *
  * @return void
  */
 public function update_field()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     if (!$this->user->canModify('listing_grid/setting')) {
         $error = new AError('');
         return $error->toJSONResponse('NO_PERMISSIONS_402', array('error_text' => sprintf($this->language->get('error_permission_modify'), 'listing_grid/setting'), 'reset_value' => true));
     }
     $this->loadLanguage('setting/setting');
     $this->loadModel('setting/setting');
     if (isset($this->request->get['group'])) {
         $group = $this->request->get['group'];
         //for appearance settings per template
         if ($this->request->get['group'] == 'appearance' && has_value($this->request->get['tmpl_id']) && $this->request->get['tmpl_id'] != 'default') {
             $group = $this->request->get['tmpl_id'];
         }
         //request sent from edit form. ID in url
         foreach ($this->request->post as $key => $value) {
             $err = $this->_validateField($group, $key, $value);
             if (!empty($err)) {
                 $error = new AError('');
                 return $error->toJSONResponse('VALIDATION_ERROR_406', array('error_text' => $err));
             }
             $data = array($key => $value);
             //html decode store name
             if (has_value($data['store_name'])) {
                 $data['store_name'] = html_entity_decode($data['store_name'], ENT_COMPAT, 'UTF-8');
             }
             $this->model_setting_setting->editSetting($group, $data, $this->request->get['store_id']);
             startStorefrontSession($this->user->getId());
         }
         return null;
     }
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
 }
 public function actonbehalf()
 {
     $this->extensions->hk_InitData($this, __FUNCTION__);
     if (isset($this->request->get['customer_id'])) {
         startStorefrontSession($this->user->getId(), array('customer_id' => $this->request->get['customer_id']));
         $this->redirect($this->html->getCatalogURL('account/account'));
     }
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
     $this->redirect($this->html->getSecureURL('sale/customer'));
 }
 public function main()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $this->document->setTitle($this->language->get('heading_title'));
     $group = $this->request->get['active'];
     if ($this->request->is_POST() && $this->_validate($this->request->get['active'])) {
         if (has_value($this->request->post['config_logo'])) {
             $this->request->post['config_logo'] = html_entity_decode($this->request->post['config_logo'], ENT_COMPAT, 'UTF-8');
         } else {
             if (!$this->request->post['config_logo'] && isset($this->request->post['config_logo_resource_id'])) {
                 //we save resource ID vs resource path
                 $this->request->post['config_logo'] = $this->request->post['config_logo_resource_id'];
             }
         }
         if (has_value($this->request->post['config_icon'])) {
             $this->request->post['config_icon'] = html_entity_decode($this->request->post['config_icon'], ENT_COMPAT, 'UTF-8');
         } else {
             if (!$this->request->post['config_icon'] && isset($this->request->post['config_icon_resource_id'])) {
                 //we save resource ID vs resource path
                 $this->request->post['config_icon'] = $this->request->post['config_icon_resource_id'];
             }
         }
         //html decode store name
         if (has_value($this->request->post['store_name'])) {
             $this->request->post['store_name'] = html_entity_decode($this->request->post['store_name'], ENT_COMPAT, 'UTF-8');
         }
         $this->model_setting_setting->editSetting($group, $this->request->post, $this->request->get['store_id']);
         if ($this->config->get('config_currency_auto')) {
             $this->loadModel('localisation/currency');
             $this->model_localisation_currency->updateCurrencies();
         }
         $this->session->data['success'] = $this->language->get('text_success');
         if (has_value($this->request->post['config_maintenance']) && $this->request->post['config_maintenance']) {
             //mark storefront session as merchant session
             startStorefrontSession($this->user->getId());
         }
         $redirect_url = $this->html->getSecureURL('setting/setting', '&active=' . $this->request->get['active'] . '&store_id=' . (int) $this->request->get['store_id']);
         $this->redirect($redirect_url);
     }
     $this->data['store_id'] = 0;
     if ($this->request->get['store_id']) {
         $this->data['store_id'] = $this->request->get['store_id'];
     } else {
         $this->data['store_id'] = $this->session->data['current_store_id'];
     }
     $this->data['groups'] = $this->groups;
     if (isset($this->request->get['active']) && strpos($this->request->get['active'], '-') !== false) {
         $this->request->get['active'] = substr($this->request->get['active'], 0, strpos($this->request->get['active'], '-'));
     }
     $this->data['active'] = isset($this->request->get['active']) && in_array($this->request->get['active'], $this->data['groups']) ? $this->request->get['active'] : $this->data['groups'][0];
     $this->data['token'] = $this->session->data['token'];
     $this->data['error'] = $this->error;
     $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('setting/setting'), 'text' => $this->language->get('heading_title'), 'separator' => ' :: ', 'current' => true));
     if (isset($this->session->data['success'])) {
         $this->data['success'] = $this->session->data['success'];
         unset($this->session->data['success']);
     }
     if (isset($this->session->data['error'])) {
         $this->error['warning'] = $this->session->data['error'];
         unset($this->session->data['error']);
     }
     $this->data['new_store_button'] = $this->html->buildElement(array('type' => 'button', 'title' => $this->language->get('button_add_store'), 'text' => ' ', 'href' => $this->html->getSecureURL('setting/store/insert')));
     if ($this->data['store_id'] > 0) {
         $this->data['edit_store_button'] = $this->html->buildElement(array('type' => 'button', 'title' => $this->language->get('text_edit_store'), 'text' => $this->language->get('text_edit_store'), 'href' => $this->html->getSecureURL('setting/store/update', '&store_id=' . $this->data['store_id']), 'style' => 'button2'));
     }
     $this->data['cancel'] = $this->html->getSecureURL('setting/setting');
     $this->data['action'] = $this->html->getSecureURL('setting/setting');
     require_once DIR_CORE . 'lib/config_manager.php';
     $this->conf_mngr = new AConfigManager();
     //activate quick start guide button
     $this->loadLanguage('common/quick_start');
     $this->data['quick_start_url'] = $this->html->getSecureURL('setting/setting_quick_form/quick_start');
     $group = $this->data['active'];
     if ($this->data['active'] == 'appearance') {
         $this->data['manage_extensions'] = $this->html->buildElement(array('type' => 'button', 'name' => 'manage_extensions', 'href' => $this->html->getSecureURL('extension/extensions/template'), 'text' => $this->language->get('button_manage_extensions'), 'title' => $this->language->get('button_manage_extensions')));
     }
     $this->data['settings'] = $this->model_setting_setting->getSetting($group, $this->data['store_id']);
     unset($this->data['settings']['one_field']);
     //remove sign of single form field
     foreach ($this->data['settings'] as $key => $value) {
         if (isset($this->request->post[$key])) {
             $this->data['settings'][$key] = $this->request->post[$key];
         }
     }
     $this->loadModel('setting/store');
     $store_info = $this->model_setting_store->getStore($this->data['store_id']);
     $this->data['status_off'] = '';
     if (!$store_info['status']) {
         $this->data['status_off'] = 'status_off';
     }
     $this->_getForm();
     $this->data['content_language_id'] = $this->session->data['content_language_id'];
     $this->data['common_zone'] = $this->html->getSecureURL('common/zone');
     $this->data['template_image'] = $this->html->getSecureURL('setting/template_image');
     //load tabs controller
     $tabs_obj = $this->dispatch('pages/setting/setting_tabs', array($this->data));
     $this->data['setting_tabs'] = $tabs_obj->dispatchGetOutput();
     unset($tabs_obj);
     $this->view->assign('form_store_switch', $this->html->getStoreSwitcher());
     $this->view->assign('help_url', $this->gen_help_url($this->data['active']));
     $this->view->batchAssign($this->data);
     $this->processTemplate('pages/setting/setting.tpl');
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
 }
Beispiel #5
0
 /**
  * update only one field
  *
  * @return void
  */
 public function update_field()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     if (!$this->user->canModify('listing_grid/setting')) {
         $error = new AError('');
         return $error->toJSONResponse('NO_PERMISSIONS_402', array('error_text' => sprintf($this->language->get('error_permission_modify'), 'listing_grid/setting'), 'reset_value' => true));
     }
     $this->loadLanguage('setting/setting');
     $this->loadModel('setting/setting');
     if (isset($this->request->get['group'])) {
         //request sent from edit form. ID in url
         foreach ($this->request->post as $key => $value) {
             $err = $this->_validateField($this->request->get['group'], $key, $value);
             if (!empty($err)) {
                 $dd = new ADispatcher('responses/error/ajaxerror/validation', array('error_text' => $err));
                 return $dd->dispatch();
             }
             $data = array($key => $value);
             $this->model_setting_setting->editSetting($this->request->get['group'], $data, $this->request->get['store_id']);
             startStorefrontSession($this->user->getId());
         }
         return null;
     }
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
 }
Beispiel #6
0
 public function main()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $this->document->setTitle($this->language->get('heading_title'));
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->_validate($this->request->get['active'])) {
         if (isset($this->request->post['config_logo'])) {
             $this->request->post['config_logo'] = html_entity_decode($this->request->post['config_logo'], ENT_COMPAT, 'UTF-8');
         }
         if (isset($this->request->post['config_icon'])) {
             $this->request->post['config_icon'] = html_entity_decode($this->request->post['config_icon'], ENT_COMPAT, 'UTF-8');
         }
         $this->model_setting_setting->editSetting($this->request->get['active'], $this->request->post, $this->request->get['store_id']);
         if ($this->config->get('config_currency_auto')) {
             $this->loadModel('localisation/currency');
             $this->model_localisation_currency->updateCurrencies();
         }
         $this->session->data['success'] = $this->language->get('text_success');
         if (has_value($this->request->post['config_maintenance']) && $this->request->post['config_maintenance']) {
             //mark storefront session as merchant session
             startStorefrontSession($this->user->getId());
         }
         $this->redirect($this->html->getSecureURL('setting/setting', '&active=' . $this->request->get['active'] . '&store_id=' . (int) $this->request->get['store_id']));
     }
     $this->data['store_id'] = 0;
     if ($this->request->get['store_id']) {
         $this->data['store_id'] = $this->request->get['store_id'];
     }
     $this->data['groups'] = $this->groups;
     if (isset($this->request->get['active']) && strpos($this->request->get['active'], '-') !== false) {
         $this->request->get['active'] = substr($this->request->get['active'], 0, strpos($this->request->get['active'], '-'));
     }
     $this->data['active'] = isset($this->request->get['active']) && in_array($this->request->get['active'], $this->data['groups']) ? $this->request->get['active'] : $this->data['groups'][0];
     $this->data['link_all'] = $this->html->getSecureURL('setting/setting/all');
     foreach ($this->data['groups'] as $group) {
         $this->data['link_' . $group] = $this->html->getSecureURL('setting/setting', '&active=' . $group . '&store_id=' . $this->data['store_id']);
     }
     $this->data['token'] = $this->session->data['token'];
     $this->data['error'] = $this->error;
     $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('setting/setting'), 'text' => $this->language->get('heading_title'), 'separator' => ' :: '));
     if (isset($this->session->data['success'])) {
         $this->data['success'] = $this->session->data['success'];
         unset($this->session->data['success']);
     }
     if (isset($this->session->data['error'])) {
         $this->error['warning'] = $this->session->data['error'];
         unset($this->session->data['error']);
     }
     $this->data['new_store_button'] = $this->html->buildButton(array('title' => $this->language->get('button_add_store'), 'text' => ' ', 'style' => 'icon_add', 'href' => $this->html->getSecureURL('setting/store/insert'), 'href_class' => 'btn_toolbar'));
     if ($this->data['store_id'] > 0) {
         $this->data['edit_store_button'] = $this->html->buildButton(array('text' => $this->language->get('text_edit_store'), 'href' => $this->html->getSecureURL('setting/store/update', '&store_id=' . $this->data['store_id']), 'style' => 'button2'));
     }
     $this->data['cancel'] = $this->html->getSecureURL('setting/setting');
     $this->data['action'] = $this->html->getSecureURL('setting/setting');
     $stores = array();
     $stores[0] = $this->language->get('text_default');
     $this->loadModel('setting/store');
     $results = $this->model_setting_store->getStores();
     foreach ($results as $result) {
         $stores[$result['store_id']] = $result['alias'];
     }
     $this->data['store_selector'] = $this->html->buildSelectbox(array('type' => 'selectbox', 'id' => 'store_switcher', 'value' => $this->data['store_id'], 'options' => $stores, 'attr' => 'onchange="location = \'' . $this->html->getSecureURL('setting/setting', '&active=' . $this->data['active']) . '\' + \'&store_id=\' + this.value"'));
     $this->data['settings'] = $this->model_setting_setting->getSetting($this->data['active'], $this->data['store_id']);
     foreach ($this->data['settings'] as $key => $value) {
         if (isset($this->request->post[$key])) {
             $this->data['settings'][$key] = $this->request->post[$key];
         }
     }
     require_once DIR_CORE . 'lib/config_manager.php';
     $this->conf_mngr = new AConfigManager();
     $this->_getForm();
     $this->data['content_language_id'] = $this->session->data['content_language_id'];
     $this->data['common_zone'] = $this->html->getSecureURL('common/zone');
     $this->data['template_image'] = $this->html->getSecureURL('setting/template_image');
     $this->view->assign('help_url', $this->gen_help_url($this->data['active']));
     $this->view->batchAssign($this->data);
     $this->processTemplate('pages/setting/setting.tpl');
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
 }
Beispiel #7
0
 public function main()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $this->document->setTitle($this->language->get('heading_title'));
     if ($this->request->is_POST() && $this->_validate($this->request->get['active'])) {
         if (has_value($this->request->post['config_logo'])) {
             $this->request->post['config_logo'] = html_entity_decode($this->request->post['config_logo'], ENT_COMPAT, 'UTF-8');
         } else {
             if (!$this->request->post['config_logo'] && isset($this->request->post['config_logo_resource_id'])) {
                 //we save resource ID vs resource path
                 $this->request->post['config_logo'] = $this->request->post['config_logo_resource_id'];
             }
         }
         if (has_value($this->request->post['config_icon'])) {
             $this->request->post['config_icon'] = html_entity_decode($this->request->post['config_icon'], ENT_COMPAT, 'UTF-8');
         } else {
             if (!$this->request->post['config_icon'] && isset($this->request->post['config_icon_resource_id'])) {
                 //we save resource ID vs resource path
                 $this->request->post['config_icon'] = $this->request->post['config_icon_resource_id'];
             }
         }
         //html decode store name
         if (has_value($this->request->post['store_name'])) {
             $this->request->post['store_name'] = html_entity_decode($this->request->post['store_name'], ENT_COMPAT, 'UTF-8');
         }
         $group = $this->request->get['active'];
         if (has_value($this->request->get['tmpl_id']) && $this->request->get['tmpl_id'] != 'default' && $group == 'appearance') {
             $group = $this->request->get['tmpl_id'];
         }
         $this->model_setting_setting->editSetting($group, $this->request->post, $this->request->get['store_id']);
         if ($this->config->get('config_currency_auto')) {
             $this->loadModel('localisation/currency');
             $this->model_localisation_currency->updateCurrencies();
         }
         $this->session->data['success'] = $this->language->get('text_success');
         if (has_value($this->request->post['config_maintenance']) && $this->request->post['config_maintenance']) {
             //mark storefront session as merchant session
             startStorefrontSession($this->user->getId());
         }
         $redirect_url = $this->html->getSecureURL('setting/setting', '&active=' . $this->request->get['active'] . '&store_id=' . (int) $this->request->get['store_id'] . (has_value($this->request->get['tmpl_id']) ? '&tmpl_id=' . $this->request->get['tmpl_id'] : ''));
         $this->redirect($redirect_url);
     }
     $this->data['store_id'] = 0;
     if ($this->request->get['store_id']) {
         $this->data['store_id'] = $this->request->get['store_id'];
     } else {
         $this->data['store_id'] = $this->config->get('config_store_id');
     }
     $this->data['groups'] = $this->groups;
     if (isset($this->request->get['active']) && strpos($this->request->get['active'], '-') !== false) {
         $this->request->get['active'] = substr($this->request->get['active'], 0, strpos($this->request->get['active'], '-'));
     }
     $this->data['active'] = isset($this->request->get['active']) && in_array($this->request->get['active'], $this->data['groups']) ? $this->request->get['active'] : $this->data['groups'][0];
     $this->data['token'] = $this->session->data['token'];
     $this->data['error'] = $this->error;
     $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('setting/setting'), 'text' => $this->language->get('heading_title'), 'separator' => ' :: ', 'current' => true));
     if (isset($this->session->data['success'])) {
         $this->data['success'] = $this->session->data['success'];
         unset($this->session->data['success']);
     }
     if (isset($this->session->data['error'])) {
         $this->error['warning'] = $this->session->data['error'];
         unset($this->session->data['error']);
     }
     $this->data['new_store_button'] = $this->html->buildElement(array('type' => 'button', 'title' => $this->language->get('button_add_store'), 'text' => ' ', 'href' => $this->html->getSecureURL('setting/store/insert')));
     if ($this->data['store_id'] > 0) {
         $this->data['edit_store_button'] = $this->html->buildElement(array('type' => 'button', 'title' => $this->language->get('text_edit_store'), 'text' => $this->language->get('text_edit_store'), 'href' => $this->html->getSecureURL('setting/store/update', '&store_id=' . $this->data['store_id']), 'style' => 'button2'));
     }
     $this->data['cancel'] = $this->html->getSecureURL('setting/setting');
     $this->data['action'] = $this->html->getSecureURL('setting/setting');
     $group = $this->data['active'];
     require_once DIR_CORE . 'lib/config_manager.php';
     $this->conf_mngr = new AConfigManager();
     if ($this->data['active'] == 'appearance') {
         $group = !$this->request->get['tmpl_id'] || $this->request->get['tmpl_id'] == 'default' ? $group : $this->request->get['tmpl_id'];
         $tmpls = $this->conf_mngr->getTemplatesLIst('storefront');
         foreach ($tmpls as $tmpl) {
             $templates[$tmpl] = array('name' => "   " . $tmpl, 'href' => $this->html->getSecureURL('setting/setting', '&active=' . $this->data['active'] . '&tmpl_id=' . $tmpl));
         }
         array_unshift($templates, array('name' => $this->language->get('text_common_template_settings'), 'href' => $this->html->getSecureURL('setting/setting', '&active=' . $this->data['active'])));
         $this->data['templates'] = $templates;
         $this->data['current_template'] = $this->request->get['tmpl_id'] ? $this->request->get['tmpl_id'] : $this->language->get('text_common_template_settings');
         //button for template cloning
         $dev_tools = $this->extensions->getExtensionsList(array('search' => 'developer_tools'))->row;
         if (is_null($dev_tools['status'])) {
             $href = "http://www.abantecart.com/extension-developer-tools";
         } elseif ($dev_tools['status'] == 1) {
             $href = $this->html->getSecureURL('tool/developer_tools/create');
         } else {
             $href = $this->html->getSecureURL('extension/extensions/edit', '&extension=developer_tools');
         }
         //NOTE: need to show dibberent icon and message if dev tools extension is not installed
         $this->data['clone_button'] = $this->html->buildElement(array('type' => 'button', 'name' => 'clone_button', 'href' => $href, 'text' => $this->language->get('text_clone_template')));
         $this->data['manage_extensions'] = $this->html->buildElement(array('type' => 'button', 'name' => 'manage_extensions', 'href' => $this->html->getSecureURL('extension/extensions/template'), 'text' => $this->language->get('button_manage_extensions'), 'title' => $this->language->get('button_manage_extensions')));
     }
     $this->data['settings'] = $this->model_setting_setting->getSetting($group, $this->data['store_id']);
     unset($this->data['settings']['one_field']);
     //remove sign of single form field
     foreach ($this->data['settings'] as $key => $value) {
         if (isset($this->request->post[$key])) {
             $this->data['settings'][$key] = $this->request->post[$key];
         }
     }
     $this->loadModel('setting/store');
     $store_info = $this->model_setting_store->getStore($this->data['store_id']);
     $this->data['status_off'] = '';
     if (!$store_info['status']) {
         $this->data['status_off'] = 'status_off';
     }
     $this->_getForm();
     $this->data['content_language_id'] = $this->session->data['content_language_id'];
     $this->data['common_zone'] = $this->html->getSecureURL('common/zone');
     $this->data['template_image'] = $this->html->getSecureURL('setting/template_image');
     //load tabs controller
     $tabs_obj = $this->dispatch('pages/setting/setting_tabs', array($this->data));
     $this->data['setting_tabs'] = $tabs_obj->dispatchGetOutput();
     unset($tabs_obj);
     $this->view->assign('form_store_switch', $this->html->getStoreSwitcher());
     $this->view->assign('help_url', $this->gen_help_url($this->data['active']));
     $this->view->batchAssign($this->data);
     $this->processTemplate('pages/setting/setting.tpl');
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
 }