1

How do it get sub categories in A to Z order of a particular category in each block and label them alphabetically. Note that A, B, C, etc. are just label.

For example:

A

  • A sub category 1
  • A sub category 2
  • A sub category 3

B

  • B sub category 1
  • B sub category 2
  • B sub category 3

C

  • C sub category 1
  • C sub category 2
  • C sub category 3

1 Answer 1

0

if you are using your own menu extension you can use like below

$currentCategory = Mage::getModel('catalog/category')->load(3);
    $collection = $currentCategory->getCollection();
    $collection->addAttributeToSelect('url_key')
        ->addAttributeToSelect('name')
        ->addAttributeToSelect('all_children')
        ->addAttributeToSelect('is_anchor')
        ->addAttributeToFilter('is_active', 1)
        ->addIdFilter($currentCategory->getChildren())
        ->setOrder('name', Varien_Db_Select::SQL_ASC)
        ->load();

if you are using any custom block to render this use cache for this and Also make sure it would not take much load in your page.

hope this will work for your.

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.