1

I have a problem with my category sitemap.

Like you can see here : http://bizpro.ch/catalog/seo_sitemap/category/ the category list doesn't respect the menu position.

Do you have any idea?

2
  • Are you using a module for your sitemap generation? In that case you'll need to fix that in the modules source Commented Nov 10, 2015 at 12:38
  • No,I d'ont use any module.
    – banu
    Commented Nov 10, 2015 at 12:39

1 Answer 1

1

You can overwrite the Mage_Catalog_Block_Seo_Sitemap_Category class from your own module (more on that here: http://inchoo.net/magento/overriding-magento-blocks-models-helpers-and-controllers/)

And set the order yourself

class [Namespace]_[Module]_Block_Catalog_Seo_Sitemap_Category extends Mage_Catalog_Block_Seo_Sitemap_Category
{
    protected function _prepareLayout()
    {
        parent::_prepareLayout();
        $helper = Mage::helper('catalog/category');

        // here I've edited the first argument to be `position` instead of default `name`
        $collection = $helper->getStoreCategories('position', true, false);
        $this->setCollection($collection);
        return $this;
    }
}
16
  • Thanks for your answer. I tried this solution but nothing changed.
    – banu
    Commented Nov 10, 2015 at 14:36
  • @banu are you sure your rewrite class is used? (just to be sure) Commented Nov 10, 2015 at 14:37
  • I think that it's ok but to be sur I modified directly Mage/Catalog/Seo/Sitemap/Category.php but nothing changed.(I have a backup of course)
    – banu
    Commented Nov 10, 2015 at 20:36
  • @banu I'll test this tomorrow and report back Commented Nov 10, 2015 at 21:08
  • @banu can you print the collection query? Should be var_dump((string)$collection->getSelect()); Commented Nov 11, 2015 at 10:45

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.