Fix: Disabled Top Menu items messing up the layout and other issues

Last modified by buddhi on Thu, June 24, 2010 17:04
Source|Old Revisions  

This is an old revision of the document!


  • When we disable a menu item from admin interface even though it doesn’t show up in the menu, it can take one character’s space and mess up the consistent space between menu items.
  • Even though the menu items is not visible whole tree will be accessible from source and can bring up information that we want to hide from the outside world.
  1. Locate the top.phtml
    app\design\frontend\your_interface_name\default\template\catalog\navigation
  1. change the code
  1.         <ul id="nav">
  2.         <?php foreach ($this->getStoreCategories() as $_category): ?>
  3.                 <?php echo $this->drawItem($_category) ?>
  4.         <?php endforeach ?>
  5.         </ul>

to

  1.         <ul id="nav">
  2.         <?php foreach ($this->getStoreCategories() as $_category): ?>
  3.             <?php if($this->htmlEscape($_category->getName())): ?>
  4.                 <?php echo $this->drawItem($_category) ?>
  5.             <?php endif; ?>
  6.         <?php endforeach ?>
  7.         </ul>
  1. Fixed.
    1. <?php if($this->htmlEscape($_category->getName())): ?>

    This checks the category name. If the category is disabled it seems the function returns nothing.

There may be better fixes for this. Lack of documentation on functions, we have to use quick and dirty fixes like these.




 

Magento 2 GitHub Repository

Magento Job Board - Some sort of tag line goes here

Latest Posts| View all Jobs