How to make subcategories persistently visible in the Category Menu

How-To: How to make subcategories persistently visible in the Category Menu

Important note for developers and shop owners who use bespoke templates:

This functionality is only available for templates that have the generic template version id=2 or greater. Please see Template Version Control for more information on the generic template version.

1. Login to your Swifty platform > Website > Edit Website
2. Select the Home page in the Website Map tree and switch to the Edit Page tab
3. Locate the Main Menu page section and click on the pencil icon
4. In the Edit section window select all main categories which contain subcategories and click Done




5. Click on Page Sections to expand the list of all sections, find a HTML page section and drag it to the Home page and place it to any container
6. Open the HTML section in the edit mode and add the following javascript code:

<script type="text/javascript">
$(document).ready(function(){
    $(".categoriesMenu li ul").css("display", "none" );
    $(".mainMenu .category").css("display", "none");
    for(i=0;i<$(".mainMenu .category").length;i++){
        var url = $($(".mainMenu .category")[i]).find(".mainSubMenu").next().attr("href");
        subMenuContent = $($(".mainMenu .category")[i]).find(".mainSubMenu ul").html();
        if(subMenuContent !=null){
            $(".categoriesMenu li a[href$='"+ url +"']").parent().append($("<ul class='subCategory'>"+ subMenuContent + "</ul>"));

        }
    }
});
</script>

For the categories to be displayed in the Main Menu, please remove the following line from the script: $(".mainMenu .category").css("display", "none");

7. Click Done to save changes
8. Click on the first icon (triangle) for this section and select 'Add Page Section to All Pages' from the context menu 




9. Complete the process of adding the section and click Save Changes. Publish the site.

On the site:

 

Have more questions? Submit a request

0 Comments

Article is closed for comments.