Mage_Adminhtml_Model_System_Config_Source_Category Class Reference

List of all members.

Public Member Functions

 toOptionArray ($addEmpty=true)


Detailed Description

Definition at line 34 of file Category.php.


Member Function Documentation

toOptionArray ( addEmpty = true  ) 

Definition at line 36 of file Category.php.

00037     {
00038         $tree = Mage::getResourceModel('catalog/category_tree');
00039 
00040         $collection = Mage::getResourceModel('catalog/category_collection');
00041 
00042         $collection->addAttributeToSelect('name')
00043             ->addPathFilter('^1/[0-9]+$')
00044             ->load();
00045 
00046         $options = array();
00047 
00048         if ($addEmpty) {
00049             $options[] = array(
00050                 'label' => Mage::helper('adminhtml')->__('-- Please select a category --'),
00051                 'value' => ''
00052             );
00053         }
00054         foreach ($collection as $category) {
00055             $options[] = array(
00056                'label' => $category->getName(),
00057                'value' => $category->getId()
00058             );
00059         }
00060 
00061         return $options;
00062     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:23:14 2009 for Magento by  doxygen 1.5.8