fbpx

Astroid 2.4 Landed with Joomla 4 Compatibility Download Now

Welcome, Guest
Username: Password: Remember me

TOPIC: Main Menu - Multilanguage

Main Menu - Multilanguage 1 year 5 months ago #14207

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Posts: 4145
  • Thank you received: 607
  • Karma: 108
Great,

Remove my test code that's in there so it doesn't conflict.

Move the following link above the code you added and it will work.
$header_menu = $params->get('header_menu', 'mainmenu');

Thanks,
Chetan
Thank You,
If you like our support and products, tweet us at joomdev and let the world know about it.
The administrator has disabled public write access.
The following user(s) said Thank You: ozwest

Main Menu - Multilanguage 1 year 5 months ago #14209

  • ozwest
  • ozwest's Avatar
  • Offline
  • Premium Member
  • Posts: 89
  • Thank you received: 2
  • Karma: 1
And indeed IT DOES, you are a champion!

For all who want to copy the working code, here it is ... for horizontal.php - please change the menuname and menu itemids to your environment.

<?php
/**
* @package Astroid Framework
* @author JoomDev www.joomdev.com
* @copyright Copyright (C) 2009 - 2019 JoomDev.
* @license www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or Later
* DO NOT MODIFY THIS FILE DIRECTLY AS IT WILL BE OVERWRITTEN IN THE NEXT UPDATE
* You can easily override all files under /frontend/ folder.
* Just copy the file to ROOT/templates/YOURTEMPLATE/html/frontend/header/ folder to create and override
*/
// No direct access.
defined('_JEXEC') or die;
jimport('astroid.framework.menu');
extract($displayData);
$params = $template->params;
$mode = $params->get('header_horizontal_menu_mode', 'left');
$block_1_type = $params->get('header_block_1_type', 'blank');
$block_1_position = $params->get('header_block_1_position', '');
$block_1_custom = $params->get('header_block_1_custom', '');


$header_menu = $params->get('header_menu', 'mainmenu');
// Let's get the active ItemId.
$app = JFactory::getApplication();
$menu = $app->getMenu();
$active = $menu->getActive();
$itemId = $active->id;
//
$menus = array(
// Language #1
array(
'menuname' => 'menu-english',
'itemids' => array('101','688','463','410','392','451','452','467','454','499','386','497','562','583','584')
),
// Language #2
array(
'menuname' => 'menu-german',
'itemids' => array('383','711','462','400','393','411','413','461','453','498','385','496','563','581','582')
)
);
foreach($menus as $values) {
if(in_array($itemId,$values)){
$header_menu = $values;
}
}



$enable_offcanvas = $params->get('enable_offcanvas', FALSE);
$header_mobile_menu = $params->get('header_mobile_menu', '');
$offcanvas_animation = $params->get('offcanvas_animation', 'st-effect-1');
$offcanvas_togglevisibility = $params->get('offcanvas_togglevisibility', 'd-block');
$class = ;
$navClass = ;
$navWrapperClass = ;
?>
<!-- header starts -->
<header data-megamenu data-megamenu-class=".has-megamenu" data-megamenu-content-class=".megamenu-container" data-dropdown-arrow="<?php echo $template->params->get('dropdown_arrow', 0) ? 'true' : 'false'; ?>" data-header-offset="true" data-transition-speed="<?php echo $template->params->get('dropdown_animation_speed', 300); ?>" data-animation="<?php echo $template->params->get('dropdown_animation_type', 'fade'); ?>" data-easing="<?php echo $template->params->get('dropdown_animation_ease', 'linear'); ?>" data-trigger="<?php echo $template->params->get('dropdown_trigger', 'hover'); ?>" data-megamenu-submenu-class=".nav-submenu,.nav-submenu-static" id="astroid-header" class="<?php echo implode(' ', $class); ?>">
<div class="d-flex flex-row justify-content-between">
<?php if (!empty($header_mobile_menu)) { ?>
<div class="d-flex d-lg-none justify-content-start">
<div class="header-mobilemenu-trigger d-lg-none burger-menu-button align-self-center" data-offcanvas="#astroid-mobilemenu" data-effect="mobilemenu-slide">
<button class="button" type="button"><span class="box"><span class="inner"></span></span></button>
</div>
</div>
<?php } ?>
<div class="header-left-section d-flex justify-content-between">
<?php $template->loadLayout('logo'); ?>
<?php
if ($mode == 'left') {
// header nav starts
AstroidMenu::getMenu($header_menu, $navClass, null, 'left', 'horizontal', $navWrapperClass);
// header nav ends
}
?>
</div>
<?php
if ($mode == 'center') {
echo '<div class="header-center-section d-flex justify-content-center">';
// header nav starts
AstroidMenu::getMenu($header_menu, $navClass, null, 'left', 'horizontal', $navWrapperClass);
// header nav ends
echo '</div>';
}
?>
<?php if ($block_1_type != 'blank' || $mode == 'right' || $enable_offcanvas): ?>
<div class="header-right-section d-flex justify-content-end">
<?php
if ($mode == 'right') {
// header nav starts
AstroidMenu::getMenu($header_menu, $navClass, null, 'left', 'horizontal', $navWrapperClass);
// header nav ends
}
?>
<?php if ($enable_offcanvas) { ?>
<div class="header-offcanvas-trigger burger-menu-button align-self-center <?php echo $offcanvas_togglevisibility; ?>" data-offcanvas="#astroid-offcanvas" data-effect="<?php echo $offcanvas_animation; ?>">
<button type="button" class="button">
<span class="box">
<span class="inner"></span>
</span>
</button>
</div>
<?php } ?>
<?php if ($block_1_type != 'blank'): ?>
<div class="header-right-block d-none d-lg-block align-self-center px-2">
<?php
if ($block_1_type == 'position') {
echo '<div class="header-block-item">';
echo $template->renderModulePosition($block_1_position, 'xhtml');
echo '</div>';
}
if ($block_1_type == 'custom') {
echo '<div class="header-block-item">';
echo $block_1_custom;
echo '</div>';
}
?>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
</div>
</header>
<!-- header ends -->
The administrator has disabled public write access.

Main Menu - Multilanguage 1 year 5 months ago #14210

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Posts: 4145
  • Thank you received: 607
  • Karma: 108
Great. Let us know if anything else?
Thank You,
If you like our support and products, tweet us at joomdev and let the world know about it.
The administrator has disabled public write access.
The following user(s) said Thank You: ozwest

Main Menu - Multilanguage 1 year 5 months ago #14266

  • ozwest
  • ozwest's Avatar
  • Offline
  • Premium Member
  • Posts: 89
  • Thank you received: 2
  • Karma: 1
I just realised that since the "hack" the mobile menu will not show anymore.

https://alliswellinallofcreation.com

Any ideas on this? Thank you
The administrator has disabled public write access.

Main Menu - Multilanguage 1 year 5 months ago #14286

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Posts: 4145
  • Thank you received: 607
  • Karma: 108
Let me test it for mobile.
Thank You,
If you like our support and products, tweet us at joomdev and let the world know about it.
The administrator has disabled public write access.

Main Menu - Multilanguage 1 year 5 months ago #14289

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Posts: 4145
  • Thank you received: 607
  • Karma: 108
Hello,

I have verified that this modification doesn't have any impact on the mobile menu. Check and make sure you have configured the mobile menu correctly.

Thanks,
Chetan
Thank You,
If you like our support and products, tweet us at joomdev and let the world know about it.
The administrator has disabled public write access.

Main Menu - Multilanguage 1 year 5 months ago #14337

  • ozwest
  • ozwest's Avatar
  • Offline
  • Premium Member
  • Posts: 89
  • Thank you received: 2
  • Karma: 1
Hello Chetan

You were right, there was no module assigned to the MOBILE setting - most likely because I changed the name of the module and forgot to reassign.

So the ENGLISH menu is showing in the mobile version however if I click on the German flag in one of the articles the GERMAN MOBILE menu is not showing. Also I realised that the languages flags are not showing since the top section is omitted in the mobile version.

Thank you
The administrator has disabled public write access.

Main Menu - Multilanguage 1 year 5 months ago #14339

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Posts: 4145
  • Thank you received: 607
  • Karma: 108
Hello,

For mobile menu to work, you have to make the same modification in mobilemenu.php with a slight variable change. I have made the changes here and you can update itemid's and menu names.

gist.github.com/chetanmadaan/34be10435ed3ffd90ab6bbe68666c4c0

Thanks,
Chetan
Thank You,
If you like our support and products, tweet us at joomdev and let the world know about it.
The administrator has disabled public write access.

Main Menu - Multilanguage 1 year 5 months ago #14361

  • ozwest
  • ozwest's Avatar
  • Offline
  • Premium Member
  • Posts: 89
  • Thank you received: 2
  • Karma: 1
Hello Chetan

I made the changes and voila it works beautifully. Thank you very much.

What would you do the the modules I have in the top section such as "language switcher" and "user account" in the mobile version?
The administrator has disabled public write access.

Main Menu - Multilanguage 1 year 5 months ago #14363

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Posts: 4145
  • Thank you received: 607
  • Karma: 108
Well, they are just modules and you can assign them based on the menu item already. So, create a copy of the module and assign one to the set of menu items you want and assign other to the other set of menu items.

Thanks,
Chetan
Thank You,
If you like our support and products, tweet us at joomdev and let the world know about it.
The administrator has disabled public write access.
Moderators: chandandeep
Time to create page: 0.403 seconds
Cron Job Starts