0

I am trying to add my own module to the admin in version 1.x but I'm getting the blank page when I try to open the module

This is what I have managed to achieve so far;

  1. My module appears as a menu item within the admin
  2. When I click the link the controller/action fires but when I try to add the content and create the block I get a blank page.

My controller is as follows:

Foobar/Storelocator/controllers/Adminhtml/Store/IndexController.php

public function editAction() {  

    echo "We got here...";
    ....

    $this->_addContent($this->getLayout()->createBlock('storelocator/adminhtml_store_edit')

    ....

}

I have the following block setup:

Foobar/Storelocator/Block/Adminhtml/Store/Edit.php

class Foobar_Storelocator_Block_Adminhtml_Store_Edit extends Mage_Adminhtml_Block_Widget_Form_Container 
{

   public function __construct() {

        echo "____________";exit;

   }

}

  }

My config.xml:

<config>

....

<admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <storelocator before="Mage_Adminhtml">Foobar_Storelocator_Adminhtml</storelocator>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>

    <adminhtml>
        <layout>
            <updates>
                <storelocator>
                    <file>storelocator.xml</file>
                </storelocator>
            </updates>
        </layout>
    </adminhtml>

</config>

It seems that the construct of the block isn't reached. I've spent a day checking my class names and folder structure over and over and the server logs have not revealed anything.

Any suggestions or help would be greatly appreciated.

5
  • 1
    can you add the config.xml of your module also to the question?
    – Marius
    Aug 9, 2017 at 10:42
  • @Marius as requested I've updated the question with my admin config.xml nodes
    – Alan A
    Aug 9, 2017 at 11:07
  • 1
    how does the <blocks> tag look in your config.xml ?
    – Marius
    Aug 9, 2017 at 11:13
  • I was missing my block declation so of course my blocks were lost! I added them to the config.xml and I now at least do not see the blank page!
    – Alan A
    Aug 9, 2017 at 11:25
  • I thinks you can you use this website to create own extension in magento. inchoo.net/magento/…
    – Jinesh
    Aug 9, 2017 at 13:01

1 Answer 1

0

So the reason I was experiencing the issue was I was missing a <blocks> declaration in my config.xml. This is pretty obvious when you think about it but as a newbie who didn't set up a block in my previous module, I was missing some knowledge. Thanks to Marius who pointed me in the right direction.

Hopefully, this might save someone else suffering in pain with this issue!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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