diff --git a/modules/blocknavigationmenu/controllers/admin/AdminCustomNavigationLinkSettingController.php b/modules/blocknavigationmenu/controllers/admin/AdminCustomNavigationLinkSettingController.php
index f1c7ba3d0..1942aae85 100644
--- a/modules/blocknavigationmenu/controllers/admin/AdminCustomNavigationLinkSettingController.php
+++ b/modules/blocknavigationmenu/controllers/admin/AdminCustomNavigationLinkSettingController.php
@@ -186,7 +186,8 @@ class AdminCustomNavigationLinkSettingController extends ModuleAdminController
if (empty($this->errors)
&& !$objCMS->active
) {
- $this->warnings[] = $this->l('The selected CMS page is currently disabled. Please enable it first in order to activate this navigation link.');
+ $cmsEditLink = $this->context->link->getAdminLink('AdminCmsContent').'&updatecms&id_cms='.(int) $objCMS->id;
+ $this->warnings[] = $this->l('Please enable linked').' '.$this->l('CMS page').' '.$this->l('to enable this navigation link.');
}
}
}
@@ -223,13 +224,7 @@ class AdminCustomNavigationLinkSettingController extends ModuleAdminController
}
}
- Media::addJsDef(
- array(
- 'categoryWiseCmsPages' => json_encode($categoryWiseCmsPages)
- )
- );
-
- $smartyVars['cmsPages'] = $cmsPages;
+ $smartyVars['categoryWiseCmsPages'] = $categoryWiseCmsPages;
$smartyVars['categories'] = $cmsCategories;
$this->context->smarty->assign($smartyVars);
$this->fields_form = array(
@@ -403,7 +398,7 @@ class AdminCustomNavigationLinkSettingController extends ModuleAdminController
if (isset($pos[2]) && (int) $pos[2] === $idNavigationLink) {
if ($objFeatureBlock = new WkCustomNavigationLink((int) $pos[2])) {
if (isset($position)
- && $objFeatureBlock->updatePosition($way, $position, $idNavigationLink)
+ && $objFeatureBlock->updatePosition($way, $position)
) {
echo 'ok position '.(int) $position.' for custom navigation link '.(int) $pos[1].'\r\n';
} else {
@@ -422,13 +417,13 @@ class AdminCustomNavigationLinkSettingController extends ModuleAdminController
public function processStatus()
{
if (Validate::isLoadedObject($this->loadObject())
- && !$this->object->is_custom_link //Check for CMS related navigation link
+ && $this->object->id_cms
+ && Validate::isLoadedObject($objCMS = new CMS($this->object->id_cms))
) {
- $objCMS = new CMS($this->object->id_cms);
if (!$objCMS->active
&& !$this->object->active
) {
- $this->errors[] = $this->l('Please activate the relate CMS page to activate this link');
+ $this->errors[] = $this->l('Please activate the linked CMS page to enable this navigation link.');
}
}
diff --git a/modules/blocknavigationmenu/views/js/admin/wk_navigation_link.js b/modules/blocknavigationmenu/views/js/admin/wk_navigation_link.js
index e6da30dfc..0cbb83a86 100644
--- a/modules/blocknavigationmenu/views/js/admin/wk_navigation_link.js
+++ b/modules/blocknavigationmenu/views/js/admin/wk_navigation_link.js
@@ -18,17 +18,29 @@
*/
$(document).ready(function() {
- setCategoryWiseCmsPages();
+ displayCategoryWiseCmsPages();
$("input[name='is_cms_block_link").on('change', function () {
- toggleElements(this, "#cms_block_content", "#non_cms_block_content");
+ if (parseInt($(this).val())) {
+ $("#cms_block_content").removeClass('hidden');
+ $("#non_cms_block_content").addClass('hidden');
+ } else {
+ $("#cms_block_content").addClass('hidden');
+ $("#non_cms_block_content").removeClass('hidden');
+ }
});
$("input[name='is_custom_redirect_link").on('change', function () {
- toggleElements(this, ".custom_redirect_link_div", ".custom_redirect_page_div");
+ if (parseInt($(this).val())) {
+ $(".custom_redirect_link_div").removeClass('hidden');
+ $(".custom_redirect_page_div").addClass('hidden');
+ } else {
+ $(".custom_redirect_link_div").addClass('hidden');
+ $(".custom_redirect_page_div").removeClass('hidden');
+ }
});
$(document).on('change', '#id_cms_category', function(){
- setCategoryWiseCmsPages();
+ displayCategoryWiseCmsPages();
});
});
@@ -40,37 +52,12 @@ function showNavigationLinkLangField(lang_iso_code, id_lang)
$('#navigation_link_name_'+id_lang).show();
}
-function toggleElements(element, selectorFirst, selectorSecond)
+function displayCategoryWiseCmsPages()
{
- if (parseInt($(element).val())) {
- $(selectorFirst).removeClass('hidden');
- $(selectorSecond).addClass('hidden');
- } else {
- $(selectorFirst).addClass('hidden');
- $(selectorSecond).removeClass('hidden');
- }
-}
-
-function setCategoryWiseCmsPages()
-{
- var selectedPage = parseInt($('input[name="id_cms"]:checked').val());
var selectedCategory = parseInt($('#id_cms_category').val());
- var cmsPages = JSON.parse(categoryWiseCmsPages);
- if (!isNaN(selectedCategory)) {
- cmsPages = cmsPages[selectedCategory];
- var html = '';
- $.each(cmsPages, function(i, v) {
- html += '
';
- html += ' | ';
- html += ''+v['id_cms']+' | ';
- html += ' | '
- html += '
';
- });
- $('table.cms_pages tbody').html(html);
- }
+ $(document).find('.cms_pages').each(function(){
+ $(this).hide();
+ });
- if (!isNaN(selectedPage)) {
- $('input[name="id_cms"][value="'+selectedPage+'"]').attr('checked', 'checked');
- }
-
-}
\ No newline at end of file
+ $('#cms_pages_'+selectedCategory).show();
+}
diff --git a/modules/blocknavigationmenu/views/templates/admin/custom_navigation_link_setting/helpers/form/form.tpl b/modules/blocknavigationmenu/views/templates/admin/custom_navigation_link_setting/helpers/form/form.tpl
index eedc9d62a..68fdea195 100644
--- a/modules/blocknavigationmenu/views/templates/admin/custom_navigation_link_setting/helpers/form/form.tpl
+++ b/modules/blocknavigationmenu/views/templates/admin/custom_navigation_link_setting/helpers/form/form.tpl
@@ -71,7 +71,7 @@
{*Display CMS Pages*}
- {if isset($cmsPages)}
+ {if isset($categoryWiseCmsPages)}
{/if}