我正在开发自定义管理模块。这是我的控制器 -
<?php
class Adept_Sellers_Adminhtml_SellersController extends Mage_Adminhtml_Controller_action
{
protected function _initAction() {
error_reporting(E_ALL);
ini_set("display_errors","1");
$this->loadLayout()
->_setActiveMenu('sellers/items')
->_addBreadcrumb(Mage::helper('adminhtml')->__('Sellers Manager'), Mage::helper('adminhtml')->__('Sellers Manager'));
return $this;
}
public function indexAction() {
$this->_initAction()
->renderLayout();
}
public function viewsellerAction() {
error_reporting(E_ALL);
ini_set("display_errors","1");
$this->loadLayout();
$this->_addContent($this->getLayout()->createBlock('adept/adminhtml_sellers_edit'))
->_addLeft($this->getLayout()->createBlock('adept/adminhtml_sellers_edit_tabs'));
$this->renderLayout();
}
阻止文件是 -
Adept/Sellers/Block/Adminhtml/Sellers.php
和
<?php
class Adept_Sellers_Block_Adminhtml_Sellers extends Mage_Adminhtml_Block_Widget_Grid_Container
{
public function __construct()
{
$this->_removeButton('add');
$this->_controller = 'adminhtml_sellers';
$this->_blockGroup = 'sellers';
$this->_headerText = Mage::helper('sellers')->__('Seller Request');
parent::__construct();
$this->_removeButton("add");
}
}
行家/供应商/砌块/ Adminhtml /供应商/ Edit.php
代码 -
<?php
class Adept_Sellers_Block_Adminhtml_Sellers_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
{
public function __construct()
{
parent::__construct();
$this->_objectId = 'id';
$this->_blockGroup = 'sellers';
$this->_controller = 'adminhtml_sellers';
$this->_updateButton('save', 'label', Mage::helper('sellers')->__('Send For Approval'));
}
public function getHeaderText()
{
if( Mage::registry('sellers_data') && Mage::registry('sellers_data')->getId() ) {
return Mage::helper('sellers')->__("Edit Requests'%s'", $this->htmlEscape(Mage::registry('sellers_data')->getTitle()));
} else {
return Mage::helper('sellers')->__('New Order');
}
}
}
行家/供应商/砌块/ Adminhtml /供应商/编辑/ form.php的
代码 -
<?php
class Adept_Sellers_Block_Adminhtml_Sellers_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
{
protected function _prepareForm()
{
$form = new Varien_Data_Form(array(
'id' => 'edit_form',
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
'method' => 'post',
'enctype' => 'multipart/form-data'
)
);
$form->setUseContainer(true);
$this->setForm($form);
return parent::_prepareForm();
}
}
行家/供应商/砌块/ Adminhtml /供应商/编辑/ Tabs.php
代码是 -
<?php
class Adepts_Sellers_Adminhtml_Sellers_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
{
public function __construct()
{
parent::__construct();
$this->setId('sellers_tabs');
$this->setDestElementId('edit_form');
$this->setTitle(Mage::helper('sellers')->__('Sellers Information'));
}
protected function _beforeToHtml()
{
$this->addTab('form_section', array(
'label' => Mage::helper('sellers')->__('Order Information'),
'title' => Mage::helper('sellers')->__('Order Information'),
'content' => $this->getLayout()->createBlock('sellers/adminhtml_sellers_edit_tab_form')->toHtml(),
'content' => $this->getLayout()->createBlock('sellers/adminhtml_sellers_edit_tab_form')->toHtml(),
));
return parent::_beforeToHtml();
}
}
行家/供应商/砌块/ Adminhtml /供应商/编辑/标签/ form.php的
代码是 -
<?php
class Adept_Sellers_Block_Adminhtml_Sellers_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
{
protected function _prepareForm()
{
$form = new Varien_Data_Form();
$this->setForm($form);
$fieldset = $form->addFieldset('seller_form', array('legend'=>Mage::helper('sellers')->__('Seller information')));
$fieldset->addField('firstname', 'label', array(
'label' => Mage::helper('sellers')->__('First Name'),
'name' => 'firstname',
));
$fieldset->addField('lastname', 'label', array(
'label' => Mage::helper('sellers')->__('Last Name'),
'name' => 'lastname',
));
$fieldset->addField('email', 'label', array(
'label' => Mage::helper('sellers')->__('Email'),
'name' => 'email',
));
if ($customer = Mage::registry('current_customer')) {
$form->setValues($customer->getData());
}
return parent::_prepareForm();
}
}
当我尝试从网格进行编辑时,它会使用空白页面(仅包含页眉和页脚)调用控制器viewsellerAction()
。它没有显示任何错误。我不明白错误是什么,或者我错过了什么?
任何帮助表示感谢。
答案 0 :(得分:1)
您可以通过'adept / adminhtml_sellers_edit'
来调用您的区块您的块类是Adept_Sellers_Block_Adminhtml_Sellers类
Adept是您的公司......卖家是您的模块
通过以下方式拨打电话:'sellers / adminhtml_sellers_edit'
如果卖家是您的模块进入配置模块的关键,这是有用的