2015-01-21 66 views
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()空白页面(只有页眉和页脚)。它没有显示任何错误。我不明白什么是错误还是我错过了什么?

任何帮助表示赞赏。

回答

1

您可以通过“拿手/ adminhtml_sellers_edit”

你的块级是打电话给你块类Adept_Sellers_Block_Adminhtml_Sellers

善于你们公司......卖家是你的模块

呼叫块由:“卖方/ adminhtml_sellers_edit”

它的工作,如果卖家是你的模块的钥匙插入你的配置模块

+0

喔..什么愚蠢的错误是。谢谢您的帮助。 – SandyK 2015-01-21 09:18:12

+0

激活您的magento index.php文件的错误报告。并激活日志...最好查看错误;) – Imaginaerum 2015-01-21 09:20:25