diff --git a/controllers/front/SitemapController.php b/controllers/front/SitemapController.php index 8621c27af..8fb39deff 100644 --- a/controllers/front/SitemapController.php +++ b/controllers/front/SitemapController.php @@ -45,6 +45,7 @@ class SitemapControllerCore extends FrontController $categoriesTree = Category::getRootCategory()->recurseLiteCategTree(0); $this->addRoomTypes($categoriesTree); + $categoriesTree['children'] = $this->getHotelNodes($categoriesTree); $this->context->smarty->assign('categoriesTree', $categoriesTree); $this->context->smarty->assign('categoriescmsTree', CMSCategory::getRecurseCategory($this->context->language->id, 1, 1, 1)); $this->context->smarty->assign('voucherAllowed', (int)CartRule::isFeatureActive()); @@ -98,4 +99,18 @@ class SitemapControllerCore extends FrontController $this->addRoomTypes($child); } } + protected function getHotelNodes($node) + { + $hotels = array(); + if (isset($node['room_types'])) { + $node['children'] = array(); + $hotels[] = $node; + } else { + foreach ($node['children'] as $child) { + $hotels = array_merge($hotels, $this->getHotelNodes($child)); + } + } + + return $hotels; + } } diff --git a/modules/qlogsitemap/classes/QgsHelper.php b/modules/qlogsitemap/classes/QgsHelper.php index 8150f068c..3c131074b 100644 --- a/modules/qlogsitemap/classes/QgsHelper.php +++ b/modules/qlogsitemap/classes/QgsHelper.php @@ -75,6 +75,13 @@ class QgsHelper return $pages; } + public static function getMetaIdByPage($page) + { + return (int) Db::getInstance()->getValue( + 'SELECT `id_meta` FROM `'._DB_PREFIX_.'meta` WHERE `page` = \''.pSQL($page).'\'' + ); + } + protected static function getProductGroupJoin() { if (!Group::isFeatureActive() || !Configuration::get('PS_UNIDENTIFIED_GROUP')) { diff --git a/modules/qlogsitemap/qlogsitemap.php b/modules/qlogsitemap/qlogsitemap.php index 1d7af83df..2f93b9de7 100644 --- a/modules/qlogsitemap/qlogsitemap.php +++ b/modules/qlogsitemap/qlogsitemap.php @@ -42,22 +42,12 @@ class Qlogsitemap extends Module 'our-properties' => 'meta', ); - /** - * Front pages listed after the CMS pages (page name => URL type). - * - * @var array - */ protected $pagesAfter = array( 'contact' => 'contact', 'authentication' => 'login', 'sitemap' => 'sitemapPage', ); - /** - * Fixed priority of each URL type. - * - * @var array - */ protected $priorities = array( 'home' => 1.0, 'meta' => 0.8, @@ -71,22 +61,12 @@ class Qlogsitemap extends Module 'sitemapPage' => 0.2, ); - /** - * Cron expression of each automatic generation option (never disables the task). - * - * @var array - */ protected $cronOptions = array( 'weekly' => '0 0 * * 0', 'monthly' => '0 0 1 * *', 'yearly' => '0 0 1 1 *', ); - /** - * Writer state while a sitemap is generated. - * - * @var resource|null - */ protected $fileHandle = null; protected $fileUrlCount = 0; protected $fileIndex = 0; @@ -405,6 +385,7 @@ class Qlogsitemap extends Module } QgsHelper::deleteSitemapFiles(); + $this->sitemapPageMeta(); $disabledPages = QgsHelper::getDisabledPages(); foreach (Language::getLanguages(true, (int) $this->context->shop->id) as $lang) { @@ -434,6 +415,30 @@ class Qlogsitemap extends Module return $result; } + protected function sitemapPageMeta() + { + $idMeta = QgsHelper::getMetaIdByPage('sitemap'); + $objMeta = new Meta($idMeta ?: null); + if (!$idMeta) { + $objMeta->page = 'sitemap'; + $objMeta->configurable = 1; + } + + $missing = false; + foreach (Language::getLanguages(false) as $lang) { + $idLang = (int) $lang['id_lang']; + if ($idMeta && Meta::getMetaByPage('sitemap', $idLang)) { + continue; + } + $objMeta->title[$idLang] = $this->l('Sitemap'); + $objMeta->description[$idLang] = $this->l('Lost? Find what you are looking for'); + $objMeta->keywords[$idLang] = ''; + $objMeta->url_rewrite[$idLang] = 'sitemap'; + $missing = true; + } + + return $missing ? (bool) $objMeta->save() : true; + } protected function startSitemapSet($iso) { diff --git a/themes/hotel-reservation-theme/css/sitemap.css b/themes/hotel-reservation-theme/css/sitemap.css new file mode 100644 index 000000000..56a530856 --- /dev/null +++ b/themes/hotel-reservation-theme/css/sitemap.css @@ -0,0 +1,43 @@ +/****************************************************************** + Sitemap Page Styles +*******************************************************************/ +#sitemap .sitemap_block .page-subheading { + margin-bottom: 16px; } +#sitemap .sitemap_block li { + line-height: 16px; + padding-bottom: 11px; } + #sitemap .sitemap_block li a:before { + content: "\f105"; + display: inline-block; + font-family: "FontAwesome"; + padding-right: 10px; } + #sitemap .sitemap_block li a:hover { + font-weight: bold; } + +#listpage_content div.tree_top { + padding: 5px 0 0 27px; } + #listpage_content div.tree_top a:before { + content: "\f015"; + display: inline-block; + font-family: "FontAwesome"; + font-size: 20px; + color: #333; } + #listpage_content div.tree_top a:hover:before { + color: #515151; } + +ul.tree { + padding-left: 24px; } + ul.tree li { + margin: 0 0 0 21px; + padding: 5px 0 0 33px; + border-left: 1px solid #d6d4d4; + background: url(../img/sitemap-horizontal.png) no-repeat left 15px transparent; } + ul.tree li a:hover { + font-weight: bold; } + ul.tree > li { + margin: 0 0 0 11px; } + ul.tree li.last { + border: medium none; + background: url(../img/sitemap-last.png) no-repeat 0px -4px transparent; } + +/*# sourceMappingURL=sitemap.css.map */ diff --git a/themes/hotel-reservation-theme/img/sitemap-horizontal.png b/themes/hotel-reservation-theme/img/sitemap-horizontal.png new file mode 100644 index 000000000..231e716f0 Binary files /dev/null and b/themes/hotel-reservation-theme/img/sitemap-horizontal.png differ diff --git a/themes/hotel-reservation-theme/img/sitemap-last.png b/themes/hotel-reservation-theme/img/sitemap-last.png new file mode 100644 index 000000000..dbee609cd Binary files /dev/null and b/themes/hotel-reservation-theme/img/sitemap-last.png differ diff --git a/themes/hotel-reservation-theme/sass/sitemap.scss b/themes/hotel-reservation-theme/sass/sitemap.scss new file mode 100644 index 000000000..221be2202 --- /dev/null +++ b/themes/hotel-reservation-theme/sass/sitemap.scss @@ -0,0 +1,66 @@ +@import "compass"; +@import "theme_variables"; + +/****************************************************************** + Sitemap Page Styles +*******************************************************************/ +#sitemap { + .sitemap_block { + .page-subheading { + margin-bottom: 16px; + } + li { + line-height: 16px; + padding-bottom: 11px; + a { + &:before { + content: "\f105"; + display: inline-block; + font-family: $font-icon; + padding-right: 10px; + } + &:hover { + font-weight: bold; + } + } + } + } +} + +#listpage_content div.tree_top { + padding: 5px 0 0 27px; + a { + &:before { + content: "\f015"; + display: inline-block; + font-family: $font-icon; + font-size: 20px; + color: $base-text-color; + } + &:hover { + &:before { + color: $link-hover-color; + } + } + } +} + +ul.tree { + padding-left: 24px; + li { + margin: 0 0 0 21px; + padding: 5px 0 0 33px; + border-left: 1px solid $base-border-color; + background: url(../img/sitemap-horizontal.png) no-repeat left 15px transparent; + a:hover { + font-weight: bold; + } + } + > li { + margin: 0 0 0 11px; + } + li.last { + border: medium none; + background: url(../img/sitemap-last.png) no-repeat 0px -4px transparent; + } +} \ No newline at end of file diff --git a/themes/hotel-reservation-theme/sitemap.tpl b/themes/hotel-reservation-theme/sitemap.tpl index 862b93590..d404dd5d4 100644 --- a/themes/hotel-reservation-theme/sitemap.tpl +++ b/themes/hotel-reservation-theme/sitemap.tpl @@ -148,11 +148,6 @@