0
我正在使用自定義管理模塊。這裏是我的控制器 -magento管理塊未被創建
<?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()
空白頁面(只有頁眉和頁腳)。它沒有顯示任何錯誤。我不明白什麼是錯誤還是我錯過了什麼?
任何幫助表示讚賞。
喔..什麼愚蠢的錯誤是。謝謝您的幫助。 – SandyK 2015-01-21 09:18:12
激活您的magento index.php文件的錯誤報告。並激活日誌...最好查看錯誤;) – Imaginaerum 2015-01-21 09:20:25