I have a page that is setup to display all product categories. How do I sort these alphabetically?

This is what the block looks like

{{block type="core/template" template="catalog/category/cat-thumbnails.phtml"}} {{block type="core/template" template="catalog/category/sidebar-fix.phtml"}}

I just want to alphabetize it.

  • How are you pulling the collection in your template .phtml files?
    – Goku
    Sep 7, 2016 at 23:30
  • @Goku I am unsure I have been working on Magento for 2 days. Where would I look for this? Sep 8, 2016 at 0:10

1 Answer 1


For that you need to create on block file in your custom module,for example here I create one block file and in that file, you set custom category collection.

class Namespace_Module_Model_Getcategory extends Mage_Core_Model_Abstract
    public function getCategory($page,$limit)
        $categories = Mage::getModel('catalog/category')
        ->addAttributeToFilter('is_active', array('in' => array(1)))
        ->addAttributeToFilter('parent_id', array('neq' => array(1)))

    return $categories;



now call phtml with this block name like,

{{block type="module/blockname" template="catalog/category/cat-thumbnails.phtml"}}

and get the custom collection in your phtml.

  • I am brand new to Magento. Do you know of a tutorial that takes a step back for this? How do I create a block file in the custom module? Sep 8, 2016 at 19:56
  • Hi, Please refer this link for how to create custom module of Block then after simple call this block. magento.stackexchange.com/questions/56396/…
    – Dhrumin
    Sep 12, 2016 at 8:46

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.