Jump to content

Topmenu in nav bar


Recommended Posts

Hello ,

I just want to put the Top-menu in the Nav-bar (on the left)

i hooked the module so it appears normaly (with normal fonctionalities)

but i still have 2 problems …

1 - the top-menu is 100% large and i need to reduce it to 1/3 or half of  the nav-bar

2 - as i de-hooked it from Display Top  the menu becomes a vertical list one…  wich is unsuable for me

see my test at http://aneto.net/boutique

Someone with an idea or a solution ??

sincerely

Link to comment
Share on other sites

In fact i would like top menu in nav bar, exactly like the cart in fact but at the left (i don't need any phone number at the top)

 

i have two problems…

1 - the top menu as you can see

2 - the size of top menu that i would like to reduce at 1/3 or 1/2 of the width

 

I don't know why but top menu module don't work like cart module …

the terrible vision of top menu comes as i de-hooked top menu from Display Top

 

Also i don't know why but 'top menu' shows the sub-categories in horizontal line when i would like them in vertical line (like sub-sub categories)

 

 

Am i clear ??

Thanks

Link to comment
Share on other sites

What do you mean by 'in that path ??'

 

The strange thing is that top menu looks good (except the width) if i leave the Display top module …

but in this case, 'top menu' appears in the nav-bar and at the top of the page…  (i can show you if you want)

 

Do i have to re-initialize the top menu module ??

Link to comment
Share on other sites

hello Vekia

 

Yes this file exist at the right place …

 

In addition, i just try on a clean install of presta-bootstrap  and the result is always the same…

i can hooked topmenu in the nav-bar…  but as i de-hooked it from 'topdisplay' (to keep it only in nav-bar) the menu doesn't appear normaly  but like it is on my test

 

it doesn't work like 'cart module' ??

Edited by pascuald (see edit history)
Link to comment
Share on other sites

I guess you made some changes to header.tpl

 

You can try like this.

 

Leave it hooked as it is now.

Make #block_top_menu width 65%, make .sf-menu li.sf-search input smaller width.

But be aware your sublevels will open just 65% then. You will have to tweak some other things too.

Link to comment
Share on other sites

It seems to be problem with themeconfigurator

I don't know why but something force to use theme2.css instead of proper css for proper modules (superfish-modified.css in case of top menu).

I dont know how themeconfigurator work but in Your case top menu use theme2.css located in

boutique/modules/themeconfigurator/css/theme2.css

instead 

superfish-modified.css

No style - no effect.

 

If I use proper style for elements from top menu it is working fine.

Edited by tmk (see edit history)
Link to comment
Share on other sites

Thank you very much  both of you

 

I don't remember i have modify 'header.tpl'  and it is true that i have choosen theme2.css (that i have modify in colors)  but …

 

It is exactly the same problem with a clean install  (without any other modif not in header.tpl nor themeconfigurator).

Things work fine for 'cartmodule' (whem you dehooked it from header, after install in navbar, it works perfectly), so i thought it could work the same for topmenu…  too bad :-(

 

I already try the reduction of topmenu width and visually it works but the whole menu is reduced and it is not what i would like to have on my nav-bar…  (i would like on the same line, the 3 tabs on the left, the search module and then connection and cart on the right)

 

i imagine that the solution is more complex and i am going to use another solution untill i find the right one.

 

Thanks again both of you  (and also Vekia)

Sincerely

Link to comment
Share on other sites

I checked it on clean install and You have right - the same behavior (manually hooked and dishooked in module/position in BO)

 

The question is why in this configuration (topmenu hooked in displaynav only) presta not use css for this module (superfish-modified.css)

 

I  think that moving style from superfish-modified.css to global.css make it force to work but it is not really solution of this bug :/

Edited by tmk (see edit history)
Link to comment
Share on other sites

Glad that you confirm the problem…  but i am definitively not good enough in programm to try to solv it by myself  :blink:

 

i am still working on my test and dioniz info help but the real solution is not there…

i don't understand why it is not as simple as for the cart module…

 

thanks again and if you have any solution, let me know

sincerely

Link to comment
Share on other sites

That's really strange cause it has this code in blocktopmenu.php

public function hookDisplayNav($params)
{
	return $this->hookDisplayTop($params);
}

As i understand it should use all parameters from displayTop

Link to comment
Share on other sites

Thanks again dioniz…  but it seems it has no simple solution for the moment…

 

To anyone who has an idea, i leave the test (with unhooked from DisplayToppage) at aneto.net/boutique

 

Note that TPL and CSS files are different in 'modules',  'theme/bootstrap/css/modules' and 'theme/bootstrap/modules' 's folders

 

sincerely

Edited by pascuald (see edit history)
Link to comment
Share on other sites

I spend three days on it and I find one can say a solution.

 

You need to edit blocktopmenu.php

and

in public function install()

add this line to call displayHeader





!$this->registerHook('displayHeader') ||

so the whole function look like:





	public function install()
	{
		if (!parent::install() ||
			!$this->registerHook('displayTop') ||
			!$this->registerHook('displayHeader') ||
			!Configuration::updateGlobalValue('MOD_BLOCKTOPMENU_ITEMS', 'CAT3,CAT26') ||
			!Configuration::updateGlobalValue('MOD_BLOCKTOPMENU_SEARCH', '1') ||
			!$this->registerHook('actionObjectCategoryUpdateAfter') ||
			!$this->registerHook('actionObjectCategoryDeleteAfter') ||
			!$this->registerHook('actionObjectCategoryAddAfter') ||
			!$this->registerHook('actionObjectCmsUpdateAfter') ||
			!$this->registerHook('actionObjectCmsDeleteAfter') ||
			!$this->registerHook('actionObjectCmsAddAfter') ||
			!$this->registerHook('actionObjectSupplierUpdateAfter') ||
			!$this->registerHook('actionObjectSupplierDeleteAfter') ||
			!$this->registerHook('actionObjectSupplierAddAfter') ||
			!$this->registerHook('actionObjectManufacturerUpdateAfter') ||
			!$this->registerHook('actionObjectManufacturerDeleteAfter') ||
			!$this->registerHook('actionObjectManufacturerAddAfter') ||
			!$this->registerHook('actionObjectProductUpdateAfter') ||
			!$this->registerHook('actionObjectProductDeleteAfter') ||
			!$this->registerHook('actionObjectProductAddAfter') ||
			!$this->registerHook('categoryUpdate') ||
			!$this->registerHook('actionShopDataDuplication') ||
			!$this->installDB())
			return false;
		return true;
	}

Then You need to change hookDisplayNav function to this:





	public function hookDisplayNav($params)
	{
		$this->user_groups =  ($this->context->customer->isLogged() ? $this->context->customer->getGroups() : array(Configuration::get('PS_UNIDENTIFIED_GROUP')));
		$this->page_name = Dispatcher::getInstance()->getController();
		if (!$this->isCached('blocktopmenu.tpl', $this->getCacheId()))
		{
			$this->makeMenu();
			$this->smarty->assign('MENU_SEARCH', Configuration::get('MOD_BLOCKTOPMENU_SEARCH'));
			$this->smarty->assign('MENU', $this->_menu);
			$this->smarty->assign('this_path', $this->_path);
		}

		$html = $this->display(__FILE__, 'blocktopmenu.tpl', $this->getCacheId());
		return $html;
	}

and add just below hookHeader function like this:





	public function hookHeader()
	{
		$this->context->controller->addJS($this->_path.'js/hoverIntent.js');
		$this->context->controller->addJS($this->_path.'js/superfish-modified.js');
		$this->context->controller->addJS($this->_path.'js/blocktopmenu.js');
		$this->context->controller->addCSS(($this->_path).'css/blocktopmenu.css', 'all');
		$this->context->controller->addCSS(($this->_path).'css/superfish-modified.css', 'all');
	}

Next step is to clear cache etc....

 

and now Your blocktopmenu need to bee hooked in BO to both

displayNav

and

displayHeader

 

Rest is proper order in displaynav hook with the rest of modules in this hook and few changes in css

 

Note!

If You reposition menu back to displayTop You must unhook this module from displayHeader because css and js files could be included twice. I don't know what could happen then.

 

 

If someone is interested why problem with topmenu in nav is present or in fact: 

- why some modules can or cannot bee hooked to specific area

- why module can bee hooked but css and js files are not loading despite addCSS and addJS present in function

just let me know 

I try to explain how I can and what I understand it.

Edited by tmk (see edit history)
Link to comment
Share on other sites

Hello  tmk,

 

Wahou !!!!!    first of all,  thank you for your time on this trouble…

I will test this week-end your solution but as i am in category 'before begginner'  i need some explanations…

 

1 - what do you mean with 'public function'  ?????

 

2 - "add this line to call displayHeader"  ,  ok but how and where do i add this line ??

 

3 - what is BO  in "Your blocktopmenu need to bee hooked in BO to both"

 

 

Again and again thank you veru much…  i'll tell you when it's done :-)))

Sincerely

Link to comment
Share on other sites

Hi :)

1. and 2. Every changes you make in file:

 

blocktopmenu.php

 

look at this file and compare the content with code I've wrote above

 

3. BO stands for Back Office (Your admin panel)

 

If you are not familiar with php simply backup your original blocktopmenu.php and replace with attached one.

This modified file is from presta 1.6.0.5 not updated module.

blocktopmenu.php

Edited by tmk (see edit history)
Link to comment
Share on other sites

hello dioniz ,

you mean 1.3.7 of Topmenubar ???

 

tomorrow, i'll try tmk's solution 

today i update v1.6.0.6  and an 'old' pbs came back 'my home '  :-)

blockcart in the menu-bar don't go on the right    ah ah ah !!! 

my test is now  at www.jeux2meaux.fr  (it's more simple to me)

 

i'll also look after v1.3.7

Link to comment
Share on other sites

Hello ,

 

Thanks to tmk, the modified file works perfectly , even with 1.6.0.6    you can see at www.jeux2meaux.fr

My pb now is to put everybody on one line with topmenu on left and cart on right… 

 

and i don't know why but it doesn't work for the moment (i ask some help on a new post for this)

 

Thanks again to both dioniz and tmk for their help…

Sincerely

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...