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 ?
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.