Example #1
0
 /**
  * Parse the page
  */
 protected function parse()
 {
     // add css
     $this->header->addCSS('/src/Frontend/Modules/' . $this->getModule() . '/Layout/Css/catalog.css');
     // add noty js
     $this->header->addJS('/src/Frontend/Modules/' . $this->getModule() . '/Js/noty/packaged/jquery.noty.packaged.min.js');
     // add breadcrumbs
     $categories = FrontendCatalogModel::getAllCategories();
     $paths = FrontendCatalogModel::traverseUp($categories, $this->record);
     $baseUrl = FrontendNavigation::getURLForBlock('Catalog', 'Category');
     // get full urls
     $parentCategories = array();
     foreach ($paths as $key => $value) {
         $category = FrontendCatalogModel::getCategoryById($key);
         $breadcrumbPaths = FrontendCatalogModel::traverseUp($categories, $category);
         $url = implode('/', $breadcrumbPaths);
         $category['full_url'] = $baseUrl . '/' . $url;
         // add breadcrumb
         $this->breadcrumb->addElement($category['title'], $category['full_url']);
         $parentCategories[] = array('title' => $category['title']);
     }
     if (!empty($parentCategories)) {
         unset($parentCategories[count($parentCategories) - 1]);
     }
     if (!empty($parentCategories)) {
         $this->tpl->assign('parentCategories', $parentCategories);
     }
     // hide action title
     $this->tpl->assign('hideContentTitle', true);
     // show the title
     $this->tpl->assign('title', $this->record['title']);
     // set meta
     $this->header->setPageTitle($this->record['meta_title'], $this->record['meta_title_overwrite'] == 'Y');
     $this->header->addMetaDescription($this->record['meta_description'], $this->record['meta_description_overwrite'] == 'Y');
     $this->header->addMetaKeywords($this->record['meta_keywords'], $this->record['meta_keywords_overwrite'] == 'Y');
     // advanced SEO-attributes
     if (isset($this->record['meta_data']['seo_index'])) {
         $this->header->addMetaData(array('name' => 'robots', 'content' => $this->record['meta_data']['seo_index']));
     }
     if (isset($this->record['meta_data']['seo_follow'])) {
         $this->header->addMetaData(array('name' => 'robots', 'content' => $this->record['meta_data']['seo_follow']));
     }
     // assign items
     $this->tpl->assign('products', $this->products);
     $this->tpl->assign('record', $this->record);
     // flat array of categories
     $this->tpl->assign('subcategoriesFlat', $this->subcategories);
     // multidimensional array of categories
     $this->tpl->assign('subcategoriesTree', $this->subcategoriesTree);
     $this->tpl->assign('categoriesTree', $this->categoriesTree);
     // multidimensional html list of subcategories
     $this->tpl->assign('subcategoriesHTML', FrontendCatalogModel::getTreeHTML($this->subcategoriesTree));
     // parse the pagination
     $this->parsePagination();
 }
Example #2
0
 /**
  * Parse the page
  */
 protected function parse()
 {
     $this->frmContact->parse($this->tpl);
     // add css
     $this->header->addCSS('/src/Frontend/Modules/' . $this->getModule() . '/Layout/Css/catalog.css');
     // add noty js
     $this->header->addJS('/src/Frontend/Modules/' . $this->getModule() . '/Js/noty/packaged/jquery.noty.packaged.min.js');
     // add breadcrumbs for the categories
     $categories = FrontendCatalogModel::getAllCategories();
     $category = FrontendCatalogModel::getCategoryById($this->record['category_id']);
     $paths = FrontendCatalogModel::traverseUp($categories, $category);
     $baseUrl = FrontendNavigation::getURLForBlock('Catalog', 'Category');
     // get full urls
     $parentCategories = array();
     foreach ($paths as $key => $value) {
         $category = FrontendCatalogModel::getCategoryById($key);
         $breadcrumbPaths = FrontendCatalogModel::traverseUp($categories, $category);
         $url = implode('/', $breadcrumbPaths);
         $category['full_url'] = $baseUrl . '/' . $url;
         // add breadcrumb
         $this->breadcrumb->addElement($category['title'], $category['full_url']);
         $parentCategories[] = $category['title'];
     }
     if (!empty($parentCategories)) {
         $parentCategories = array_reverse($parentCategories);
         $this->tpl->assign('parentCategories', implode(' - ', $parentCategories));
     }
     // add into breadcrumb
     $this->breadcrumb->addElement($this->record['meta_title']);
     // hide action title
     $this->tpl->assign('hideContentTitle', true);
     // show title linked with the meta title
     $this->tpl->assign('title', $this->record['title']);
     // set meta
     $this->header->setPageTitle($this->record['meta_title'], $this->record['meta_description_overwrite'] == 'Y');
     $this->header->addMetaDescription($this->record['meta_description'], $this->record['meta_description_overwrite'] == 'Y');
     $this->header->addMetaKeywords($this->record['meta_keywords'], $this->record['meta_keywords_overwrite'] == 'Y');
     // advanced SEO-attributes
     if (isset($this->record['meta_data']['seo_index'])) {
         $this->header->addMetaData(array('name' => 'robots', 'content' => $this->record['meta_data']['seo_index']));
     }
     if (isset($this->record['meta_data']['seo_follow'])) {
         $this->header->addMetaData(array('name' => 'robots', 'content' => $this->record['meta_data']['seo_follow']));
     }
     if (!empty($this->record['image'])) {
         $imgURL = FRONTEND_FILES_URL . '/Media/Images/Source/' . $this->record['image']['filename'];
     } else {
         $imgURL = '';
     }
     $this->header->setTwitterCard($this->record['title'] . ' - ' . implode(' - ', $parentCategories), $this->record['meta_description'], $imgURL);
     // Open Graph-data: add additional OpenGraph data
     // add specified image
     if ($imgURL != '') {
         $this->header->addOpenGraphImage($imgURL);
     }
     // Open Graph-data: add images from content
     $this->header->extractOpenGraphImages($this->record['text']);
     $this->header->addOpenGraphData('title', $this->record['title'] . ' - ' . implode(' - ', $parentCategories), true);
     $this->header->addOpenGraphData('type', 'product', true);
     $this->header->addOpenGraphData('url', SITE_URL . $this->record['full_url'], true);
     $this->header->addOpenGraphData('site_name', $this->get('fork.settings')->get('Core', 'site_title_' . FRONTEND_LANGUAGE, SITE_DEFAULT_TITLE), true);
     $this->header->addOpenGraphData('description', $this->record['meta_description_overwrite'] == 'Y' ? $this->record['meta_description'] : $this->record['title'] . ' - ' . implode(' - ', $parentCategories), true);
     // assign item information
     $this->tpl->assign('item', $this->record);
     $this->tpl->assign('brand', $this->brand);
     if (!empty($this->relatedProducts)) {
         $this->tpl->assign('related', $this->relatedProducts);
     }
     $this->tpl->assign('images', $this->record['images']);
     if ($this->videos != null) {
         $this->tpl->assign('videos', $this->videos);
     }
     if ($this->files != null) {
         $this->tpl->assign('files', $this->files);
     }
     $this->tpl->assign('specifications', $this->specifications);
     $this->tpl->assign('tags', $this->tags);
     //$this->tpl->assign('related', $this->relatedProducts);
     // count comments
     $commentCount = count($this->comments);
     if ($commentCount > 1) {
         $this->tpl->assign('commentsMultiple', true);
     }
     // assign the comments
     $this->tpl->assign('commentsCount', $commentCount);
     $this->tpl->assign('comments', $this->comments);
     if ($this->record["contact"] == 1) {
         $this->tpl->assign('contactAllowed', true);
     }
     // parse the form
     $this->frm->parse($this->tpl);
     // some options
     if ($this->URL->getParameter('comment', 'string') == 'moderation') {
         $this->tpl->assign('commentIsInModeration', true);
     }
     if ($this->URL->getParameter('comment', 'string') == 'spam') {
         $this->tpl->assign('commentIsSpam', true);
     }
     if ($this->URL->getParameter('comment', 'string') == 'true') {
         $this->tpl->assign('commentIsAdded', true);
     }
     $this->tpl->assign('categoriesTree', $this->categoriesTree);
 }