Jump to content

[SOLVED] Menu bar intergration in version 1.4


Recommended Posts

Hey all,

My present store : Here (DUTCH LANGUAGE ONLY)

You can see i have a menu bar module in my present store. The mod is made by Julien Breux and called Menu v2.6.4.
I have tried to get this module to work in the 1.4 version of my store, but i can not seem to get it to work, my guess is that it is related to the fact that this module makes a ''tab'' where it can be modified.

Is there a way to make this module compatibel with the 1.4 version of Prestashop??

My future store: Removed (DUTCH LANGUAGE ONLY)

Link to comment
Share on other sites

  • 2 weeks later...

Hey, thank you for the response, and sorry that it took me a while to reply..

After installation of the module, my website refuses to load. Firefox shows a white page, and IE shows a http 500 message, either way, it will not load. If you were able to get it working i would love to hear how you did that.

My current test store is not the most recent (anymore) so i will update it later this week.

Link to comment
Share on other sites

In fact there is a problem between the code of the menu and Smarty 3. (before the 1.4, Prestashop was using Smarty 2, that's why the menu is ok with other versions)

If you want to correct that problem, go in the directory "jbx_menu" in your modules, and open the file "menu_tree.tpl".
Then, replace (begining line 23):

      
{foreach from=$item.childrens item=item name=menuTreeChildrens}
         {include file=$menu_tpl_tree}
     {/foreach}



by

{foreach from=$item.childrens item=childitem name=menuTreeChildrens}
     {$item.childrens = $childitem}
     {include file=$menu_tpl_tree}
{/foreach} 



After that it will normally work like a charm!

Link to comment
Share on other sites

  • 1 month later...
In fact there is a problem between the code of the menu and Smarty 3. (before the 1.4, Prestashop was using Smarty 2, that's why the menu is ok with other versions)

If you want to correct that problem, go in the directory "jbx_menu" in your modules, and open the file "menu_tree.tpl".
Then, replace (begining line 23):
      
{foreach from=$item.childrens item=item name=menuTreeChildrens}
         {include file=$menu_tpl_tree}
     {/foreach}



by

{foreach from=$item.childrens item=childitem name=menuTreeChildrens}
     {$item.childrens = $childitem}
     {include file=$menu_tpl_tree}
{/foreach} 



After that it will normally work like a charm!



This tweak not works if menu is linked Categories with subcategories!
Can you please have a look to this issue ?
Link to comment
Share on other sites

I found correct replacement for code

{foreach from=$item.childrens item=menuitem name=menuTreeChildrens}
{$item=$menuitem}
{include file=$menu_tpl_tree}
{/foreach}



now will display menu with subcategories

corect this code in modules/jbx_menu/menu_tree.tpl file !

Link to comment
Share on other sites

  • 4 weeks later...

I have the same problem.
I've already added a Horizontal Navigation Bar in the header.tpl file in previous v 1.4.0.6 with success.
Now I am trying to do exactly the same (Adding Horizontal Navigation Bar) into the header.tpl file in v 1.4.0.17 without success and nothing happens in FO.
I refresh the browser.
I work in Default theme.

In what file we should add the NavBar, and where is located this file in root directory?
Thank you for any help or information.

Link to comment
Share on other sites

  • 2 weeks later...

An update from me a few months further. My store is fully updated, so the latest version to date.

You can see in my store that the menu bar is working and doing its job. However, the funny thing is that this module is exactly the same as it was when i first installed it. In other words this is the module that i used update after update without ever having to change the code.

Since i know it’s most likely that the module will stop working if i make any changes, i have just decided not to touch it at all anymore. The problem with this is that i have decided since then, to alter the main category names a bit (you can see this by pressing the TV & Video tab; i changed the category name to Televisie en Video).

Link to comment
Share on other sites

A copy of my menu_tree.tpl, maybe it can do you guys any good..

>{if !$item.logged || ($item.logged && $menu.logged)}


   {if $menu.icons}
     {if file_exists($menu.icons_path|cat:$item.id_menu|cat:'.jpg')}

       {assign var='haveIcon' value='1'}
     {/if}
     {if file_exists($menu.icons_path|cat:$item.id_menu|cat:'.gif')}

       {assign var='haveIcon' value='1'}
     {/if}
     {if file_exists($menu.icons_path|cat:$item.id_menu|cat:'.png')}

       {assign var='haveIcon' value='1'}
     {/if}
   {/if}
    {if isset($haveIcon)}{/if}{$item.title|escape:htmlall:'UTF-8'}{if isset($haveIcon)}{/if}
   {if isset($item.numProducts) && $menu.categories_num && (!$menu.categories_zero && $item.numProducts > 0 || $menu.categories_zero)} ({$item.numProducts}){/if}

 {if $item.childrens|@count > 0}
</pre>
<ul>
     {foreach from=$item.childrens item=item name=menuTreeChildrens}
         {include file=$menu_tpl_tree}
     {/foreach}
</ul>
<br> {/if}<br><br>{/if

Link to comment
Share on other sites

  • 3 months later...

Dear All,

 

I am joining to your post because I have an issue with the same module.

In fact is not a issue. I have to modify one think I am working hard to see how to make it working.

 

may you can help me, this will be geat!!!

 

My firts requirement:

I have to have an horizontal menu which is displayed in a new HOOK.

 

Then I did the following

1) in my database, I create a new line on ps_hook table (name:topBar)

2) on /Class/FontController.php, at the line 475, I added this : 'HOOK_TOP_BAR' => Module::hookExec('topBar'), 3) on /themes/myTheme/header.tpl, I added {HOOK_TOP_BAR}

4) On the file /Modules/jbx_menu/AdminModuleMenu.php, I modfiy that line 689

     $this->_html .= $this->_displayInputRadio('Hook to Use ?', 'hook', Configuration::get('MENU_HOOK'), 'Choose the best method to attach your menu to your theme.', array('Top'=>'top','Menu'=>'menu'));

with

     $this->_html .= $this->_displayInputRadio('Hook to Use ?', 'hook', Configuration::get('MENU_HOOK'), 'Choose the best method to attach your menu to your theme.', array('Top'=>'top','TopBar'=>'topBar','Menu'=>'menu'));

5) On the file /Modules/jbx_menu/jbx_menu.php, at the line 55, I add this : !$this->registerHook('topBar') || and I reinstalled the module.

6) Finaly, On the file /Modules/jbx_menu/jbc_menu.php, after the function hooktop($parameters), I added this

public function hooktopBar($parameters)
{
	global $smarty;

	if (file_exists(_PS_THEME_DIR_.'modules/jbx_menu/menu_tree.tpl')) {
		$smarty->assign('menu_tpl_tree', _PS_THEME_DIR_ . 'modules/jbx_menu/menu_tree.tpl');
	}
	else {
		$smarty->assign('menu_tpl_tree', _PS_MODULE_DIR_ . 'jbx_menu/menu_tree.tpl');
	}

	$menu = $this->display(__FILE__, 'menu.tpl');


	if (Configuration::get('MENU_HOOK') == 'topBar') {
		echo 'qqqqqqqqq';
		return $menu;
	}
	else {
		$smarty->assign('HOOK_MENU', $menu);	
	}	
}

(here is my problem)

 

7) Finally, I add a {debug} in the file /Modules/jbx_menu/menu_tree.php.

 

When I refresh my page, the debug windows is showed.

 

Then, I go to the BackEnd and then Module->Menu and I change the radio box from "Top" to "TopBar"

Then the function hooktopBar($parameters) is called instead of hooktop($parameters).

 

The debug windows is not displayed.And here starts my probleme.

 

I think, in the function hooktopBar($parameters), the varaible $menu is empty.

And I also think that the file /Modules/jbx_menu/menu_tree.php is ignored, because the debug windows is displayed when I am in "top" mode instead of "TopBar" mode.

 

I have no idea how to solved my problem because, first I am not an expert with Prestashop, but I would really appreciate if you can take a time for my issue and see how I can make working this part of hooktopBar($parameters) function

if (file_exists(_PS_THEME_DIR_.'modules/jbx_menu/menu_tree.tpl')) {
		$smarty->assign('menu_tpl_tree', _PS_THEME_DIR_ . 'modules/jbx_menu/menu_tree.tpl');
	}
	else {
		$smarty->assign('menu_tpl_tree', _PS_MODULE_DIR_ . 'jbx_menu/menu_tree.tpl');
	}

	$menu = $this->display(__FILE__, 'menu.tpl');

 

My Second requierement is to have the subcategories displayed on left_column while with are "visiting" its parent category.

 

 

Thank for all of your help!!!!

Cheers

Link to comment
Share on other sites

I have tried to get this module to work in the 1.4 version of my store, but i can not seem to get it to work, my guess is that it is related to the fact that this module makes a ''tab'' where it can be modified.

 

Have you tried version 2.7? It works fine with my shop

Link to comment
Share on other sites

  • 2 weeks later...

I found correct replacement for code<br/>

<br/>{foreach from=$item.childrens item=menuitem name=menuTreeChildrens}<br/>{$item=$menuitem}<br/>{include file=$menu_tpl_tree}<br/>{/foreach}<br/>

<br/><br/>now will display menu with subcategories<br/><br/>corect this code in modules/jbx_menu/menu_tree.tpl file !

 

 

Thanks Man! This Work Perfect!

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...