We have a strange error. When an extension is installed (adds href-lang to head) then menu header is empty (no menu aruments).

Extension on: renderCategoriesMenuHtml returns ""

Extension off: renderCategoriesMenuHtml returns "menu item1; menu item 2 etc"

My conclusion is that $this object might be changed/lost. How can we debug this?

** Function called in top.phtml to generate menubar

<?php $_menu = $this->renderCategoriesMenuHtml(0,'level-top') ?>

** File/function in core catalog/block/navigation

public function renderCategoriesMenuHtml($level = 0, $outermostItemClass = '', $childrenWrapClass = '')
    $activeCategories = array();
    foreach ($this->getStoreCategories() as $child) {
        if ($child->getIsActive()) {
            $activeCategories[] = $child;
    $activeCategoriesCount = count($activeCategories);
    $hasActiveCategoriesCount = ($activeCategoriesCount > 0);

    if (!$hasActiveCategoriesCount) {
        return 'Goes wrong here when extension is activated';

Part of extension block rewrite: construct ok? extend ok?

class Module_HrefLang_Block_Head extends Mage_Core_Block_Template {

    protected function _construct() {

    public function getAlternateUrls() {
        return $this->helper('alternatelang')->getAlternateUrls();

  • Without knowing what the other module is / seeing what it does, it will be difficult to offer advice. Completely random guess would be that the module rewrites Mage_Catalog_Block_Navigation and makes one of the functions incompatible with your version of Magento. Commented Mar 5, 2015 at 11:57
  • I added an example of extended class - but will dive deeper thanks
    – snh_nl
    Commented Mar 5, 2015 at 12:10

1 Answer 1


This question really needs to have the module code, or a link to it, for anyone to answer correctly.

However, I imagine the designers of the extension tested it either with 'flat catalog category' on or with it set to off. Therefore, disable the cache and go to system->config->catalog, find the setting for 'use flat catalog category' and see what is in there.

Ideally you do want to be using the flat catalog category, however, I can see why this has not worked out well with the hreflang tag code you have added. The code in the module needs to load the other views of a given category, and, for reasons I forget, it is not easy to do setStore and load another category 'object' from flat catalog category. I got mine to work eventually with the flat catalog but I had to get deep into Magento internals to get the result I wanted (i.e. with per store seo urls).

For now, disable flat catalog and see if it works. Also try to reindex and make sure that the tables aren't filled with nulls for the flat catalog indexes.

  • Great! This really really helped. Been working on this for hours. Disabled flat catalog and it works!
    – snh_nl
    Commented Mar 5, 2015 at 12:20
  • Glad that helped. If yo have a small shop you can live with flat catalog category off. Commented Mar 5, 2015 at 12:50
  • I eventually took a different approach to the hreflang tags and looked up things in the url_rewrite table, loading from there since the flat catalog category store switching was not so simple. Commented Mar 5, 2015 at 12:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.