0

I created a custom module for seller management in magento 1.7.0.2. In the module, the grid for data display is showing fine but when I click the edit button, it redirects fine but shows a blank page. It should show a page similar to the one which comes up when we edit a product. How can I solve this ?

My custom module This is my custom module.

This is what I get when I click on the edit optionThis is the blank page.

Instead of the blank page, I want a page similar to the product edit page.

Config.xml

0.1.0 standard Mage_ManageSellers managesellers

<adminhtml>
    <layout>
        <updates>
            <mage_managesellers>
                <file>managesellers.xml</file>
            </mage_managesellers>
        </updates>
    </layout>
</adminhtml>

<global>
    <blocks>
        <managesellers>
            <class>Mage_ManageSellers_Block</class>
        </managesellers>


    </blocks>
    <helpers>
        <managesellers>
            <class>Mage_ManageSellers_Helper</class> 
        </managesellers>
    </helpers>


    <models>
     <managesellers>
        <class>Mage_ManageSellers_Model</class>
        <resourceModel>managesellers_mysql4</resourceModel>
     </managesellers>
     <managesellers_mysql4>
        <class>Mage_ManageSellers_Model_Mysql4</class>
        <entities>
           <managesellers>
              <table>managesellers</table>
           </managesellers>
        </entities>
     </managesellers_mysql4>
  </models>
  <resources>
     <managesellers_setup>
        <setup>
           <managesellers>Mage_ManageSellers</managesellers>
        </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>

IndexController.php

public function indexAction()
{
    $this->loadLayout();
    $this->_title($this->__('Manage Sellers'));
    $myblock = $this->getLayout()->createBlock('managesellers/adminhtml_managesellers');
    $this->_addContent($myblock);
    $this->renderLayout();
}

public function editAction()
{
    $Id = $this->getRequest()->getParam('managesellers_id');
    $model = Mage::getModel('managesellers/managesellers')->load($Id);

    if($model->getId() || $Id == 0) 
    {
        $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
        if (!empty($data)) 
        {
            $model->setData($data);
        }
        Mage::register('managesellers_data', $model);

        $this->loadLayout();
        $this->_setActiveMenu('managesellers/managesellers');

        $this->_addBreadcrumb(
            Mage::helper('adminhtml')->__('Seller Manager'),
            Mage::helper('adminhtml')->__('Seller Manager')
        );

        $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);

        $this->renderLayout();
    }
    else 
    {
        Mage::getSingleton('adminhtml/session')->addError(
            Mage::helper('managesellers')->__('Seller does not exist')
        );
        $this->_redirect('*/*/');
    }
}

public function newAction() 
{
    $this->_forward('edit');
}

Edit.php

public function __construct()
{
    parent::__construct();
    $this->_objectId = 'id';
    $this->_blockGroup = 'managesellers';
    $this->_controller = 'adminhtml_managesellers';
    $this->_updateButton('save', 'label', Mage::helper('managesellers')->__('Save Seller'));
    $this->_updateButton('delete', 'label', Mage::helper('managesellers')->__('Delete Seller'));
}
public function getHeaderText()
{
    if( Mage::registry('managesellers_data') && Mage::registry('managesellers_data')->getId() ) 
    {
        return Mage::helper('managesellers')->__("Edit Seller '%s'", $this->htmlEscape(Mage::registry('managesellers_data')->getTitle()));
    }
    else 
    {
        return Mage::helper('managesellers')->__('Add Seller');
    }
}

layout file

<adminhtml_managesellers_index>
<reference name="content">
    <block type="adminhtml/template" name="root" template="catalog/product/edit.phtml"/>
</reference name="content">
</adminhtml_managesellers_index>

Please help.

3
  • Could you add some code to your question? If the footer is shown, it might be that no content is loaded. If there is no footer, please check your error logs. In both cases: add code. Commented Feb 2, 2017 at 8:37
  • this means your edit.php file not exists in Block of your module or admin layout xml file is not defined properly.
    – BornCoder
    Commented Feb 2, 2017 at 9:08
  • Code added @ArjenMiedema Thanks in advance :) Commented Feb 2, 2017 at 9:53

1 Answer 1

0

Follow this link to create new/edit form in Admin of magento. This will surely fix your problem. please go step-by-step.

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.