Removing links from the Toplevel Categories in the left navigation !

Usually, the toplevel categories in the left navigation are empty since every product goes in the subcategories. Is there any way removing the links from the toplevel categories and just show the category name (without link) and subcategories ( with links )

I am talking about modifying this code:

Code:

        <ul id="ja-sidenav">
        <?php foreach ($this->getStoreCategories() as $_category): ?>
            <?php echo $this->drawItem($_category) ?>
        <?php endforeach ?>
        </ul>

Thanks

4 answers

Profile photo of Sherlock 0.00 $tone March 6, 2013
Public

Hi abrart,

If you want the top categories in the left to be unlink just try as following
Open the file of skin\frontend\default\jm_flannel\js\jm.script.js you would see this line of code

HTML Code:

 document.observe("dom:loaded", function() {

Replace it by this

HTML Code:

 document.observe("dom:loaded", function() {  
                 jQuery("#ja-sidenav li.level0").children("a").bind("click",function(e){
                     e.preventDefault();
                 });

i hope this helps !

#1
Profile photo of Altjon Kodra 20.00 $tone March 6, 2013
Public

Thanks for the answer, it works fine but it is not a complete solution.

What about top categories that don’t have subcategories!? It will be impossible to see the products in these categories ( with no children categories)

I think the solution should be based on "hasChildren"

So, if a category hasChildren, there will be no link in the top category.
If a category has NO children, there will be a normal link in the top category.

I hope I am clear

Is this possible?

Thanks

#2
Profile photo of Sherlock 0.00 $tone March 6, 2013
Public

Yes abrart, it’s possbile, just replace the above code

HTML Code:

   jQuery("#ja-sidenav li.level0").children("a").bind("click",function(e){
                     e.preventDefault();
                 });

by this

HTML Code:

 jQuery("li.level0:has(ul)").children("a").bind("click",function(e){
                 e.preventDefault();
            });

Hope it helps !

#3

This question is now closed

Written By

Comments