0

I made a custom module for seller management. It is working fine on local server but not on the live server. I am getting an error in loading my block.

Controller.php

protected function _initAction()
{
    $this->loadLayout()
            ->_setActiveMenu('managesellers/managesellers')
            ->_addBreadcrumb(Mage::helper('adminhtml')->__('Seller Manager'), Mage::helper('adminhtml')->__('Seller Manager'))
            ->_addContent($this->getLayout()->createBlock('managesellers/adminhtml_managesellers'));
    return $this;
}

public function indexAction()
{
    $this->_initAction()
            ->renderLayout();
}

I am getting an error in the addContent() method but only on the live server. It works fine on my localhost.

ERROR: Fatal error: Uncaught TypeError: Argument 1 passed to Mage_Adminhtml_Controller_Action::_addContent() must be an instance of Mage_Core_Block_Abstract, boolean given

Need your assistance to rectify this.

Edit: Added the code of config.xml and the block class.

Config.xml

<config>
<modules>
    <COC_ManageSellers>
        <version>0.1.0</version>    <!-- Version of module -->
    </COC_ManageSellers>
</modules>
<frontend>
    <routers>
        <admin>
            <use>standard</use>
            <args>
                <module>COC_ManageSellers</module>
                <frontName>managesellers</frontName>  <!-- This is the URL of the module. i.e www.clickoncare.com/index.php/managesellers -->
            </args>
        </admin>
    </routers>
</frontend>

<adminhtml>


    <menu>
        <managesellers module="managesellers">
            <title>Manage Sellers</title>
            <sort_order>120</sort_order>
            <action>managesellers</action>
        </managesellers>
    </menu>     
    <acl>
        <resources>
            <all>
                <title>Allow Everything</title>
            </all>
            <admin>
                <children>
                    <managesellers>
                        <title>Manage Seller</title>
                        <sort_order>10</sort_order>

                    </managesellers>
                </children>
            </admin>
        </resources>
    </acl>
</adminhtml>

<global>
    <blocks>
        <managesellers>
            <class>COC_ManageSellers_Block</class>
        </managesellers>


    </blocks>
    <helpers>
        <managesellers>
            <class>COC_ManageSellers_Helper</class> 
        </managesellers>
    </helpers>


    <models>
     <managesellers>
        <class>COC_ManageSellers_Model</class>
        <resourceModel>managesellers_mysql4</resourceModel>
     </managesellers>
     <managesellers_mysql4>
        <class>COC_ManageSellers_Model_Mysql4</class>
        <entities>
           <managesellers>
              <table>managesellers</table>
           </managesellers>
        </entities>
     </managesellers_mysql4>
  </models>
  <resources>
     <managesellers_setup>
        <setup>
           <managesellers>COC_ManageSellers</managesellers>
           <class>COC_ManageSellers_Model_Resource_Setup</class>
        </setup>
        <connection>
           <use>core_setup</use>
        </connection>
     </managesellers_setup>
     <managesellers_write>
        <connection>
           <use>core_write</use>
        </connection>
     </managesellers_write>
     <managesellers_read>
        <connection>
           <use>core_read</use>
        </connection>
     </managesellers_read>
  </resources>

</global>

Block Class

  public function __construct()
  {
     $this->_controller = 'adminhtml_managesellers';
     $this->_blockGroup = 'managesellers';
     $this->_headerText = Mage::helper('managesellers')->__('Seller Manager');
     parent::__construct();
  }

2 Answers 2

2

The issue is related to the module name which you have used. I have faced the same problem when the module was working on local and was not working on live site.

Please change your module name from ManageSellers to Managesellers with a small s and update your module classes as per.

I am not sure how live server does not work with ManageSellers as module name, may be related to PHP settings or something but not sure. But this worked for me and after that I never used Camelcasing in my module name or vendor name.

3
  • It worked!! Thank you very much for your help! Commented Feb 11, 2017 at 8:40
  • Glad to know that your module is working fine. Please mark the correct answer as accepted by clicking on tick mark beside answer. It will help others to get correct solution for problem. Commented Feb 11, 2017 at 9:22
  • Sure sir :) @JaiminSutariya Commented Feb 11, 2017 at 10:18
1

As per the error, $this->getLayout()->createBlock('managesellers/adminhtml_managesellers') provides false instead of a valid block.

Since it is a custom block (either you have created it or it may come from a third party extension), we cannot point towards the exact location of the block.

Block name would looks like [Namespace]_Managesellers_Block_Adminhtml_Managesellers where Namespace is unknown. You are likely to find this class in either app\code\local\ or in app\code\community.

You need to check that block class exists in your production server. Else share the config.xml and block file here which will help us to guide you correctly.

EDIT

So based on your edit, please make sure follow items:

  1. Your block class name is COC_ManageSellers_Block_Adminhtml_Managesellers.
  2. Your block class is defined at app/code/[local|community]/COC/ManageSellers/Block/Adminhtml/Managesellers.php
  3. Make sure all cache removed from your production server
  4. If compilation is on in your production, turn it off. Clear your cache and then try again.

Hope that helps.

3
  • Added the code of config.xml and the block file. I uploaded the all the files I had on my local server to the production server. So, the block class should exist in the production server also. Commented Feb 11, 2017 at 7:23
  • @RajatAgarwal please see my edit Commented Feb 11, 2017 at 7:30
  • All done sir. But still not working. Why is it so that it works on the local server and not on the production server? Commented Feb 11, 2017 at 7:33

Your Answer

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

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