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

  • Home
  • SEARCH
  • 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 7677365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:24:22+00:00 2026-05-31T17:24:22+00:00

Simply put, I’m getting this error in the Product Admin of Magento after adding

  • 0

Simply put, I’m getting this error in the Product Admin of Magento after adding a new edit tab.

Fatal error: Call to a member function createBlock() on a non-object in
/var/www/app/code/local/RedoxStudios/ErpTab/Block/Adminhtml/Catalog/Product/Tab.php
on line 11

I’m having this in my code:

<?php
class RedoxStudios_ErpTab_Block_Adminhtml_Catalog_Product_Tab
extends Mage_Adminhtml_Block_Template
implements Mage_Adminhtml_Block_Widget_Tab_Interface {

    /*
     * Set the template for the block
     */
    public function __construct() {
        parent::__construct();
        $this->getLayout()->createBlock('Purchase/Product_Widget_StockDetails_Summary');
        $this->setProduct($this->getProduct());
        $this->setTemplate('Purchase/Product/StockDetails/Summary.phtml');
    }

    /**
    * Return current product instance
    *
    * @return Mage_Catalog_Model_Product
    */

    public function getProduct()
    {
        return Mage::registry('product');
    }
}

Previously I was able to just call the createBlock function. I’m I overlooking something that makes it that I cannot call this function?


Summary.phtml:

<div class="stock-details-summary">

<table border="0">
    <tr>
        <td class="a-right"><?php echo $this->__('Waiting for delivery'); ?> : </td>
        <td class="a-right"><?php echo ($this->getWaitingForDeliveryQty() ? $this->getWaitingForDeliveryQty() : 0); ?></td>
    </tr>
    <tr>
        <td class="a-right">
            <?php echo $this->__('Manual supply need'); ?> : 
            <?php if ($this->getManualSupplyNeedQty() > 0): ?>
                <i><?php echo $this->getProduct()->getmanual_supply_need_comments(); ?></i>
            <?php endif; ?>
        </td>
        <td class="a-right">
            <?php echo $this->getManualSupplyNeedQty(); ?>
        </td>
    </tr>
    <tr>
        <td class="a-right"><?php echo $this->__('Min qty to purchase'); ?> : </td>
        <td class="a-right"><font color="red"><?php echo $this->getTotalNeededQtyForValidOrdersMinusWaitingForDelivery(); ?></font></td>
    </tr>
    <tr>
        <td class="a-right"><?php echo $this->__('Max qty to purchase'); ?> : </td>
        <td class="a-right" width="60"><font color="red"><?php echo $this->getTotalNeededQtyMinusWaitingForDelivery(); ?></font></td>
    </tr>
    <tr>
        <td class="a-right"><?php echo $this->__('Status'); ?> : </td>
        <td class="a-right"><?php echo $this->getGeneralStatus(); ?></td>
    </tr>
</table>

</div>
  • 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-05-31T17:24:23+00:00Added an answer on May 31, 2026 at 5:24 pm

    You are not correctly getting the layout object (Mage_Core_Model_Layout). In action controllers and blocks it’s $this->getLayout()->createBlock(), everywhere else it’s Mage::app()->getLayout()->createBlock()

    EDIT: Sergy also pointed out that the layout object is not loaded, and this caused me to realize that you are using the php __construct(), rather than the typical Magento _construct(). Block instances do not have the layout object set on them until after they are instantiated (and their constructor has been called) in Mage_Core_Model_Layout::createBlock() – notice in that method how the block instance gets the layout set on it via its setLayout() method. This is the purpose behind the block method _prepareLayout() – it’s a constructor-like method which is fired after the block instance is created.

    Corrections to your code below:

    <?php
    class RedoxStudios_ErpTab_Block_Adminhtml_Catalog_Product_Tab
    extends Mage_Adminhtml_Block_Template
    implements Mage_Adminhtml_Block_Widget_Tab_Interface {
    
        /*
         * Set the template for the block
         */
        protected function _construct()
        {
            $this->setTemplate('Purchase/Product/StockDetails/Summary.phtml');
        }
    
        public function _prepareLayout()
        {
            $this->getLayout()->createBlock('Purchase/Product_Widget_StockDetails_Summary');
            $this->setProduct($this->getProduct());
        }
    
        // ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Simply put. Why did this make my code malfunction after awhile. //Color[][] colorArr =
Simply put, if the designers of a new language want it to gain adoption
Simply put this program is merging two arrays containing coordinates into one larger array,
I have a class hierarchy that can be simply put like this: struct Parent
I have a new project which simply put, is an attempt to formalize the
here is the array var copyText= [ 'this is the first line', 'Simply put,
I'm experiencing the problem described in this Android issue: http://code.google.com/p/android/issues/detail?id=4536 Simply put, after pressing
simply put I can't get any redirection to work after my 'insert_callback', here is
Simply put! there is this list say LST = [[12,1],[23,2],[16,3],[12,4],[14,5]] and i want to
I can't seem to get back on track with this one. I simply put

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.