0

I am trying to learn Magento Admin Modue Development. In this regard I am following this tutorial. Here I got the below line.

 $statuses = Mage::getSingleton('web/status')->getOptionArray();

Now my question is Mage::getSingleton('web/status') referring which class??

Should I have getOptionArray()method in that class??

  • echo get_class(Mage::getSingleton('web/status')); paste this in app\code\core\Mage\Cms\controllers\IndexController.php under indexAction() near line 48-50 you will receive a class name then you have to create a getOptionArray() method in this class. – Ashish Madankar M2 Professiona May 9 '16 at 5:35
  • if you followed the above tutorial and use the same namespace then your class name should be Company_Web_Model_Status which is going to be located at app\code\local\Company\Web\Model\Status.php – Ashish Madankar M2 Professiona May 9 '16 at 5:42
1

It depends on modules configuration. Each modules has a etc/config.xml file which defines where to locate Blocks, Helpers and Models. In your example you are looking for a Model.

For example:

<?xml version="1.0"?>
<config>
    ...
    <global>
        <models>
            <mymoduleid>
                <class>My_Module_Model</class>
            </mymoduleid>
        </models>
        ...
    </global>
    ...
</config>

This config file will tell Magento to locate all the class of type mymoduleid in My_Module_Model.

For example: if you call Mage::getSingleton('mymoduleid/foo'), Magento will translate it into: My_Module_Model_Foo. It is done in the following way: My_Module_Model + _ + camelcase of "foo".

To answer your question you have to locate the module defining the identifier web and locate the models section in config.xml file.

Otherwise, if you are in hurry, just place an echo get_class(Mage::getSingleton('web/status')) somewhere to see what is the class name.

Hope it helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.