예제 #1
0
 public function main()
 {
     $page_controller = 'pages/product/manufacturer';
     $page_key_param = 'manufacturer_id';
     $manufacturer_id = (int) $this->request->get['manufacturer_id'];
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $this->loadLanguage('catalog/manufacturer');
     $this->document->setTitle($this->language->get('heading_title'));
     $this->loadModel('catalog/manufacturer');
     $manufacturer_info = $this->model_catalog_manufacturer->getManufacturer($manufacturer_id);
     if (has_value($manufacturer_id) && $this->request->server['REQUEST_METHOD'] != 'POST') {
         if (!$manufacturer_info) {
             $this->session->data['warning'] = $this->language->get('error_manufacturer_not_found');
             $this->redirect($this->html->getSecureURL('catalog/manufacturer'));
         }
     }
     $this->data['heading_title'] = $this->language->get('text_edit') . $this->language->get('text_manufacturer') . ' - ' . $manufacturer_info['name'];
     $this->data['manufacturer_edit'] = $this->html->getSecureURL('catalog/manufacturer/update', '&manufacturer_id=' . $manufacturer_id);
     $this->data['tab_edit'] = $this->language->get('entry_edit');
     $this->data['tab_layout'] = $this->language->get('entry_layout');
     $this->data['manufacturer_layout'] = $this->html->getSecureURL('catalog/manufacturer_layout', '&manufacturer_id=' . $manufacturer_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/manufacturer'), 'text' => $this->language->get('heading_title'), 'separator' => ' :: '));
     $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('catalog/manufacturer/update', '&manufacturer_id=' . $manufacturer_id), 'text' => $this->language->get('text_edit') . $this->language->get('text_manufacturer') . ' - ' . $manufacturer_info['name'], 'separator' => ' :: '));
     $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('catalog/manufacturer_layout', '&manufacturer_id=' . $manufacturer_id), 'text' => $this->language->get('entry_layout'), 'separator' => ' :: '));
     $this->data['active'] = 'layout';
     $this->view->batchAssign($this->data);
     $layout = new ALayoutManager();
     //get existing page layout or generic
     $page_layout = $layout->getPageLayoutIDs($page_controller, $page_key_param, $manufacturer_id);
     $page_id = $page_layout['page_id'];
     $layout_id = $page_layout['layout_id'];
     $tmpl_id = $this->config->get('config_storefront_template');
     // insert external form of layout
     $layout = new ALayoutManager($tmpl_id, $page_id, $layout_id);
     $settings = array();
     $settings['action'] = $this->html->getSecureURL('catalog/manufacturer_layout/save');
     // hidden fields of layout form
     $settings['hidden']['page_id'] = $page_id;
     $settings['hidden']['layout_id'] = $layout_id;
     $settings['hidden']['manufacturer_id'] = $manufacturer_id;
     $settings['allow_clone'] = true;
     $layoutform = $this->dispatch('common/page_layout', array($settings, $layout));
     $this->view->assign('help_url', $this->gen_help_url('manufacturer_layout'));
     $this->view->assign('layoutform', $layoutform->dispatchGetOutput());
     $this->processTemplate('pages/catalog/manufacturer_layout.tpl');
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
 }
예제 #2
0
 public function main()
 {
     $page_controller = 'pages/product/product';
     $page_key_param = 'product_id';
     $product_id = (int) $this->request->get['product_id'];
     $page_url = $this->html->getSecureURL('catalog/product_layout', '&product_id=' . $product_id);
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $this->loadLanguage('catalog/product');
     $this->loadLanguage('design/layout');
     $this->document->setTitle($this->language->get('heading_title'));
     $this->loadModel('catalog/product');
     if (has_value($product_id) && $this->request->is_GET()) {
         $product_info = $this->model_catalog_product->getProduct($product_id);
         if (!$product_info) {
             unset($this->session->data['success']);
             $this->session->data['warning'] = $this->language->get('error_product_not_found');
             $this->redirect($this->html->getSecureURL('catalog/product'));
         }
     }
     $this->data['help_url'] = $this->gen_help_url('product_layout');
     $this->data['product_description'] = $this->model_catalog_product->getProductDescriptions($product_id);
     $this->data['heading_title'] = $this->language->get('text_edit') . $this->language->get('text_product') . ' - ' . $this->data['product_description'][$this->session->data['content_language_id']]['name'];
     $this->document->setTitle($this->data['heading_title']);
     // Alert messages
     if (isset($this->session->data['warning'])) {
         $this->data['error_warning'] = $this->session->data['warning'];
         unset($this->session->data['warning']);
     }
     if (isset($this->session->data['success'])) {
         $this->data['success'] = $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=' . $product_id), 'text' => $this->data['heading_title'], 'separator' => ' :: '));
     $this->document->addBreadcrumb(array('href' => $page_url, 'text' => $this->language->get('tab_layout'), 'separator' => ' :: ', 'current' => true));
     //active tab
     $this->data['active'] = 'layout';
     //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->addChild('pages/catalog/product_summary', 'summary_form', 'pages/catalog/product_summary.tpl');
     $layout = new ALayoutManager();
     //get existing page layout or generic
     $page_layout = $layout->getPageLayoutIDs($page_controller, $page_key_param, $product_id);
     $page_id = $page_layout['page_id'];
     $layout_id = $page_layout['layout_id'];
     if (isset($this->request->get['tmpl_id'])) {
         $tmpl_id = $this->request->get['tmpl_id'];
     } else {
         $tmpl_id = $this->config->get('config_storefront_template');
     }
     $params = array('product_id' => $product_id, 'page_id' => $page_id, 'layout_id' => $layout_id, 'tmpl_id' => $tmpl_id);
     $url = '&' . $this->html->buildURI($params);
     // get templates
     $this->data['templates'] = array();
     $directories = glob(DIR_STOREFRONT . 'view/*', GLOB_ONLYDIR);
     foreach ($directories as $directory) {
         $this->data['templates'][] = basename($directory);
     }
     $enabled_templates = $this->extensions->getExtensionsList(array('filter' => 'template', 'status' => 1));
     foreach ($enabled_templates->rows as $template) {
         $this->data['templates'][] = $template['key'];
     }
     $action = $this->html->getSecureURL('catalog/product_layout/save');
     // Layout form data
     $form = new AForm('HT');
     $form->setForm(array('form_name' => 'layout_form'));
     $this->data['form_begin'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'layout_form', 'attr' => 'data-confirm-exit="true"', 'action' => $action));
     $this->data['hidden_fields'] = '';
     foreach ($params as $name => $value) {
         $this->data[$name] = $value;
         $this->data['hidden_fields'] .= $form->getFieldHtml(array('type' => 'hidden', 'name' => $name, 'value' => $value));
     }
     $this->data['page_url'] = $page_url;
     $this->data['current_url'] = $this->html->getSecureURL('catalog/product_layout', $url);
     // insert external form of layout
     $layout = new ALayoutManager($tmpl_id, $page_id, $layout_id);
     $layoutform = $this->dispatch('common/page_layout', array($layout));
     $this->data['layoutform'] = $layoutform->dispatchGetOutput();
     //build pages and available layouts for clonning
     $this->data['pages'] = $layout->getAllPages();
     $av_layouts = array("0" => $this->language->get('text_select_copy_layout'));
     foreach ($this->data['pages'] as $page) {
         if ($page['layout_id'] != $layout_id) {
             $av_layouts[$page['layout_id']] = $page['layout_name'];
         }
     }
     $form = new AForm('HT');
     $form->setForm(array('form_name' => 'cp_layout_frm'));
     $this->data['cp_layout_select'] = $form->getFieldHtml(array('type' => 'selectbox', 'name' => 'layout_change', 'value' => '', 'options' => $av_layouts));
     $this->data['cp_layout_frm'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'cp_layout_frm', 'attr' => 'class="aform form-inline"', 'action' => $action));
     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->batchAssign($this->data);
     $this->processTemplate('pages/catalog/product_layout.tpl');
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
 }
예제 #3
0
 public function edit_layout()
 {
     $page_controller = 'pages/content/content';
     $page_key_param = 'content_id';
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $this->document->setTitle($this->language->get('update_title'));
     $this->acm = new AContentManager();
     $url = '';
     if (!isset($this->request->get['content_id']) || !(int) $this->request->get['content_id']) {
         $this->redirect($this->html->getSecureURL('design/content'));
     }
     $content_id = (int) $this->request->get['content_id'];
     $url .= '&content_id=' . $content_id;
     $content = $this->acm->getContent($content_id);
     $this->view->assign('error_warning', isset($this->error['warning']) ? $this->error['warning'] : '');
     $this->view->assign('success', isset($this->session->data['success']) ? $this->session->data['success'] : '');
     if (isset($this->session->data['success'])) {
         unset($this->session->data['success']);
     }
     $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('design/content', $url), 'text' => $this->language->get('heading_title'), 'separator' => ' :: '));
     $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('design/content/update', '&content_id=' . $content_id), 'text' => $this->language->get('update_title'), 'separator' => ' :: '));
     $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('design/content/edit_layout', '&content_id=' . $content_id), 'text' => $this->language->get('tab_layout'), 'separator' => ' :: '));
     $this->view->assign('content_layout', $this->html->getSecureURL('design/content/edit_layout', '&content_id=' . $content_id));
     $this->view->assign('content_form', $this->html->getSecureURL('design/content/update', '&content_id=' . $content_id));
     $this->view->assign('tab_form', $this->language->get('tab_form'));
     $this->view->assign('tab_layout', $this->language->get('tab_layout'));
     $layout = new ALayoutManager();
     $page_layout = $layout->getPageLayoutIDs($page_controller, $page_key_param, $content_id);
     $page_id = $page_layout['page_id'];
     $layout_id = $page_layout['layout_id'];
     $tmpl_id = $this->config->get('config_storefront_template');
     // insert external form of layout
     $layout = new ALayoutManager($tmpl_id, $page_id, $layout_id);
     $settings = array();
     $settings['action'] = $this->html->getSecureURL('design/content/save_layout', $url);
     // hidden fields of layout form
     $settings['hidden']['page_id'] = $page_id;
     $settings['hidden']['layout_id'] = $layout_id;
     $settings['hidden']['content_id'] = $content_id;
     $settings['allow_clone'] = true;
     //process layout template with passing settings and layout object
     $layoutform = $this->dispatch('common/page_layout', array($settings, $layout));
     $this->view->assign('heading_title', $this->language->get('heading_title'));
     $this->view->assign('layoutform', $layoutform->dispatchGetOutput());
     $this->view->assign('help_url', $this->gen_help_url('content_layout'));
     $this->processTemplate('pages/design/content_layout.tpl');
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
 }
예제 #4
0
 public function edit_layout()
 {
     $page_controller = 'pages/product/category';
     $page_key_param = 'path';
     $category_id = (int) $this->request->get['category_id'];
     //note: category can not be ID of 0.
     if (!has_value($category_id)) {
         $this->redirect($this->html->getSecureURL('catalog/category'));
     }
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $this->loadLanguage('catalog/category');
     $this->document->setTitle($this->language->get('text_category') . ' ' . $this->language->get('tab_layout'));
     $this->view->assign('help_url', $this->gen_help_url('category_layout_edit'));
     $url = '';
     $url .= '&category_id=' . $category_id;
     if (has_value($category_id) && $this->request->server['REQUEST_METHOD'] != 'POST') {
         $this->loadModel('catalog/category');
         $this->data['category_description'] = $this->model_catalog_category->getCategoryDescriptions($category_id);
     }
     if (isset($this->request->get['tmpl_id'])) {
         $url .= '&tmpl_id=' . $this->request->get['tmpl_id'];
         $tmpl_id = $this->request->get['tmpl_id'];
     } else {
         $tmpl_id = $this->config->get('config_storefront_template');
     }
     $this->view->assign('error_warning', isset($this->error['warning']) ? $this->error['warning'] : '');
     $this->view->assign('success', isset($this->session->data['success']) ? $this->session->data['success'] : '');
     if (isset($this->session->data['success'])) {
         unset($this->session->data['success']);
     }
     $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('catalog/category', $url), 'text' => $this->language->get('heading_title'), 'separator' => ' :: '));
     $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('catalog/category/update', '&category_id=' . $category_id), 'text' => $this->language->get('text_edit') . ' ' . $this->language->get('text_category') . ' - ' . $this->data['category_description'][$this->session->data['content_language_id']]['name'], 'separator' => ' :: '));
     $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('catalog/edit_layout', '&category_id=' . $category_id), 'text' => $this->language->get('tab_layout'), 'separator' => ' :: '));
     $this->view->assign('category_form_general', $this->html->getSecureURL('catalog/category/update', '&category_id=' . $category_id) . '#general');
     $this->view->assign('category_form_data', $this->html->getSecureURL('catalog/category/update', '&category_id=' . $category_id) . '#data');
     $this->view->assign('category_form_image', $this->html->getSecureURL('catalog/category/update', '&category_id=' . $category_id) . '#tab_media');
     $this->view->assign('category_layout', $this->html->getSecureURL('catalog/category/edit_layout', '&category_id=' . $category_id));
     $this->view->assign('tab_form_general', $this->language->get('tab_general'));
     $this->view->assign('tab_form_data', $this->language->get('tab_data'));
     $this->view->assign('tab_layout', $this->language->get('tab_layout'));
     $layout = new ALayoutManager();
     //get existing page layout or generic
     $page_layout = $layout->getPageLayoutIDs($page_controller, $page_key_param, $category_id);
     $page_id = $page_layout['page_id'];
     $layout_id = $page_layout['layout_id'];
     $layout = new ALayoutManager($tmpl_id, $page_id, $layout_id);
     $settings = array();
     $settings['action'] = $this->html->getSecureURL('catalog/category/save_layout', $url);
     // hidden fields of layout form
     $settings['hidden']['page_id'] = $page_id;
     $settings['hidden']['layout_id'] = $layout_id;
     $settings['hidden']['category_id'] = $category_id;
     $settings['allow_clone'] = true;
     $layoutform = $this->dispatch('common/page_layout', array($settings, $layout));
     $this->view->assign('heading_title', $this->language->get('text_edit') . $this->language->get('text_category') . ' - ' . $this->data['category_description'][$this->session->data['content_language_id']]['name']);
     $this->view->assign('layoutform', $layoutform->dispatchGetOutput());
     $this->processTemplate('pages/catalog/category_layout.tpl');
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
 }