I have got all categories sorted as in admin in localhost but in web server its coming without sorted. I tried same code and order in both localhost and web server.
That is really a pain.Please help me!
Here is my code:
$categories = Mage::helper('catalog/category');
$collection = $categories->getStoreCategories(false,true,false);
foreach($collection as $_category)
{
//Do something
echo $_category->getName();
}
In helper:
/**
* Retrieve current store categories
*
* @param boolean|string $sorted
* @param boolean $asCollection
* @return Varien_Data_Tree_Node_Collection|Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Collection|array
*/
public function getStoreCategories($sorted=false, $asCollection=false, $toLoad=true)
And your first parameter equals to false, means collection won't be sorted.
$collection = $categories->getStoreCategories(false,true,false);