Jump to content

Add id to topmenu li items


Recommended Posts

Hi 2 All,

 

 

I have a store in prestashop 1.6.0.11.In my top menu I have ul and thier respective li.Now I want to add an Id to each li item.for example if the main li is cosmatics,then its respective li's should have id cosmatics-1,cosmatics-2 etc.

How to do this,Kindly help me.

 

regards;

RXD USER

Link to comment
Share on other sites

Thanks Vekia.Great.............................................................................................................finally its done after working on it for 2 days.

 

Thanks again again ...........................................................................................................and again.Can't express my feelings.

 

 

regards;

Link to comment
Share on other sites

  • 2 months later...

you can do it with jquery

$(document).ready(function(){
$('#block_top_menu li').each(function(index){
  $(this).attr('class', 'menuItem_' + index);
});
});

then each menu item will have own unique class :-)

Hello, can you tell me where i have to put  these lines and in which file?

 

Thanks you

 

Ps : Sorry for my english i'm french ;-)

Link to comment
Share on other sites

I have this to the last of the folder superfish-modified

 

jQuery(function(){
    jQuery('ul.sf-menu').superfish();
    $('.sfHover').addClass('sfHoverForce'); // will only target current links, since it's fired upod page load
    function recursiveCheck(element)
    {
        if (!element.length)
            return;
        var the_ul = element.parent(); // unordered list parent
        if (the_ul.hasClass('sf-menu'))
            element.addClass('sfHoverForce'); //means it is another list item, add the class
        else recursiveCheck(the_ul.parent());
    }
    recursiveCheck($('.sfHoverForce'));
    
    $(document).ready(function()
    {
        $('#block_top_menu li').each(function(index)
        {
            $(this).attr('class', 'menuItem_' + index);
        });
    });
});

 

But the it does not work???

Link to comment
Share on other sites

Hi Valdeck,

 

 

You have add the jquery code in the blocktopmenu.js file. I have added path to file in the above post.

Hi rxdUser

 

I do not have that file.

 

I have in the blocktopmenu file :

  • blocktopmenu.php
  • blocktopmenu.tpl
  • config.xml
  • index.php
  • logo.gif
  • menutoplinks.class.php

In blocktopmenu -> js :

 

  • hoverIntent.js
  • index.php
  • superfish-modified.js

 

So where is the file which contains blocktopmenu.js????

 

Thanks so much for your help.

Link to comment
Share on other sites

Hi valdeck,

 

You need to go to your theme folder,then into js folder,then into modules folder and then into blocktopmenu folder,then click on js folder and finally you will see the following files,

 

1 : blocktopmenu.js

2: hoverIntent.js

3: superfish-modified.js

 

You have to implement the changes into block topmenu.js file

 

Please leave a message in case of any issue?

Link to comment
Share on other sites

Hi valdeck,

 

You need to go to your theme folder,then into js folder,then into modules folder and then into blocktopmenu folder,then click on js folder and finally you will see the following files,

 

1 : blocktopmenu.js

2: hoverIntent.js

3: superfish-modified.js

 

You have to implement the changes into block topmenu.js file

 

Please leave a message in case of any issue?

Hi rxdUser,

 

I have just superfish-modified.js in this file????

 

Is normale? Or i have a problem?

 

For information Version de PrestaShop: 1.5.6.2

 

And Version : 1.7 for the module

Edited by valdeck (see edit history)
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...