protected function exportData(Mage_Catalog_Model_Category $category, $file, $depth = 0)
 {
     $data = array('id' => $category->getId(), 'parent_id' => $category->getParentId(), 'attribute_set_id' => $category->getAttributeSetId(), 'urlPath' => $category->getUrlPath(), 'urlKey' => $category->getUrlKey(), 'path' => $category->getPath(), 'position' => $category->getPosition(), 'page_layout' => $category->getPageLayout(), 'description' => $category->getDescription(), 'display_mode' => $category->getDisplayMode(), 'is_active' => $category->getIsActive(), 'is_anchor' => $category->getIsAnchor(), 'include_in_menu' => $category->getIncludeInMenu(), 'custom_design' => $category->getCustomDesign(), 'level' => $category->getLevel(), 'name' => $category->getName(), 'metaTitle' => $category->getMetaTitle(), 'metaKeywords' => $category->getMetaKeywords(), 'metaDescription' => $category->getMetaDescription());
     echo str_repeat('  ', $depth);
     echo '* ' . $category->getName() . sprintf(' (%s products)', $category->getProductCount()) . PHP_EOL;
     fputcsv($file, $data);
     if ($category->hasChildren()) {
         $children = Mage::getModel('catalog/category')->getCategories($category->getId());
         foreach ($children as $child) {
             $child = Mage::getModel('catalog/category')->load($child->getId());
             $this->exportData($child, $file, $depth + 1);
         }
     }
 }
 /**
  * @param Mage_Catalog_Model_Category $category
  */
 protected function _checkSetUrlUpdate($category)
 {
     if ($category->getDisplayMode() === Firegento_FlexCms_Model_Source_DisplayMode::CMS_PAGE && $category->getFlexcmsCmsPage()) {
         $category->setUrl(Mage::helper('cms/page')->getPageUrl($category->getFlexcmsCmsPage()));
     }
     if ($category->getDisplayMode() === Firegento_FlexCms_Model_Source_DisplayMode::URL_EXTERNAL && $category->getFlexcmsUrlExternal()) {
         $category->setUrl($category->getFlexcmsUrlExternal());
     }
 }