Fatal error: Call to undefined method Mage_Catalog_Model_Resource_Category_Flat_Collection::joinUrlRewrite()
This happens because the category model (catalog/category
) uses different resource models for different settings of Use Flat Catalog Category
and you are always using
try changing joinUrlRewrite to addUrlRewriteToResult
protected function _getChildrenCategoriesBase($category)
{
$collection = $category->getCollection();
$collection->addAttributeToSelect('url_key')
->addAttributeToSelect('name')
->addAttributeToSelect('all_children')
->addAttributeToSelect('is_anchor')
->addAttributeToSelect('category_code')
->setOrder('position', Varien_Db_Select::SQL_ASC)
->addUrlRewriteToResult();
return $collection;
}
public function getChildrenCategories($category)
{
$collection = $this->_getChildrenCategoriesBase($category);
$collection->addAttributeToFilter('is_active', 1)
->addIdFilter($category->getChildren())
->load();
return $collection;
}