I updated yesterday to 1.9 CE and now my category pages I get this fatal error:

Fatal error: Call to undefined method Mage_Catalog_Model_Resource_Category_Flat_Collection::joinUrlRewrite() in /home/senorehe/public_html/app/code/local/Mage/Catalog/Block/Navigation.php on line 155

This is the section it is referring to

public function getCurrentChildCategories()
        $layer = Mage::getSingleton('catalog/layer');
        $category   = $layer->getCurrentCategory();
        /* @var $category Mage_Catalog_Model_Category */
        $collection = Mage::getModel('catalog/category')->getCollection();
        /* @var $collection Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Collection */
            ->addAttributeToFilter('is_active', 1)
            ->setOrder('position', 'ASC')
line 155        ->joinUrlRewrite()

        $productCollection = Mage::getResourceModel('catalog/product_collection');
        return $collection;

I have tried reindexing the URL, flushing my mage_core_url_rewrite then reindexing. But nothing had worked so far.

Can anybody help me with this?

  • Just a prompt idea: did you reindex all your data after the update? – Anna Völkl Jun 3 '14 at 10:36
  • yea and everything was working fine until about an hour ago – Adam Allen Jun 3 '14 at 10:37
  • Ensure you have no duplicate url_keys, you can use this query to check. SELECT url_key, COUNT(url_key) AS NumOccurrences FROM catalog_product_flat_1 GROUP BY url_key HAVING ( COUNT(url_key) > 1 ); And make sure you read the upgrade docs – Mike O'Loughlin Jun 3 '14 at 11:08

I have changed ->joinUrlRewrite() into ->addUrlRewriteToResult(). This has worked for me.

  • Any idea why that worked? I see the difference between the two function. Is the category flat still working as intended? – Anthony Cicchelli Jan 15 '18 at 0:12

I fixed the problem, for some reason when I disabled the flat catalog product and flat catalog category. The problem went away. I don't understand the fix but it worked.

  • If your store has many products, it's a good practice to keep flat category enabled. – Ricardo Martins Mar 27 '15 at 14:03
  • I see the said a lot of places but why is that? – Adam Allen Mar 27 '15 at 14:18
  • In my case it looks like to be a reindexing problem while we have many API requests. We are trying to figure out. – Ricardo Martins Mar 27 '15 at 17:56

It's a strange answer, but try checking your cpu load. I had a problem like this when cleanned the entire cache of a store.

It took some hours to get back to normal with no changes in config or code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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