Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8239535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T20:10:46+00:00 2026-06-07T20:10:46+00:00

I’ve been working on getting a new form in the adminhtml for my Magento

  • 0

I’ve been working on getting a new form in the adminhtml for my Magento module. I’m running into a serious issue with actually loading blocks, however. I can load a test block (using a phtml layout) using this code I found in a different stack overflow question (I implement this in the adminhtml controller):

    $block = $this->getLayout()->createBlock('coupsmart_coupon/adminhtml_forms');
    error_log('The block:' . var_export($block, true));
    if($block)
    {
        $block->setTemplate('test/test.phtml');
        error_log(var_export($block->getTemplate(), true));
        error_log('The HTML:');
        error_log(var_export($block->toHtml(),true));   
    }

Using a test block, I get back the correct html (found in my adminhtml/default/default/template folder).

However, when I instantiate a grid_container block, it it doesn’t run the if($block){} portion, because the block is false. But in my block class for the grid_container, I have a __constructor() method where I log an output, so it is running the constructor, which means my class instantiation (and naming) is correct.

What can cause a constructor to run on a block but have it still return false, for an Mage_Adminhtml_Block_Widget_Grid_Container class?

If any more code is needed (controller, grid_container block, grid block, config, etc.) is needed, let me know, and I’ll post it up. I just didn’t want to overwhelm with a code overflow that may dilute the question.

EDIT: Grid Container

class Coupsmart_Coupon_Block_Adminhtml_Forms extends
Mage_Adminhtml_Block_Widget_Grid_Container
{       
    public function __construct()
    {
        error_log('adminhtml forms (parent) construct');
        $this->_controller = 'adminhtml_forms';
        $this->_blockGroup = 'coupsmart_coupon';
        $this->_headerText = Mage::helper('forms')->__('Coupon Manager');
        $this->_addButtonLabel = Mage::helper('forms')->__('Edit Coupon');
        parent::__construct();
    }
}

The error log in the container above shows up when I instantiate the block.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T20:10:49+00:00Added an answer on June 7, 2026 at 8:10 pm

    The returned block can be false if an exception is thrown while it’s instantiated. In your code, this may certainly come from this part : Mage::helper('forms').
    In the config.xml file of your module, have you defined the helpers like this ? :

    <global>
        <helpers>
            <forms><class>Coupsmart_Coupon_Helper</class></forms>
        </helpers>
    </global>
    

    Else, replace forms by the other code you used in the calls to Mage::helper('forms') (from what it seems, this should probably rather looks like this : Mage::helper('coupsmart_coupon'))

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from
I have a jquery bug and I've been looking for hours now, I can't
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.