Magento 如何从管理客户编辑视图中为数据库表添加自定义网格?

Magento 如何从管理客户编辑视图中为数据库表添加自定义网格?,magento,gridview,block,Magento,Gridview,Block,我在“客户编辑”选项卡中添加了自定义新标记。我想在单击“新建”选项卡时添加栅格视图。 我创建了一个自定义模块,用于向数据库表添加数据。我如何使用该控制器获取我的块 我正在使用以下文件。有人能帮我加载网格视图作为按钮点击操作吗。? require_once("Mage/Adminhtml/Block/Customer/Edit/Tabs.php"); class Proporta_Warrenty_Block_Adminhtml_Customer_Edit_Tabs extends Mage_Ad

我在“客户编辑”选项卡中添加了自定义新标记。我想在单击“新建”选项卡时添加栅格视图。 我创建了一个自定义模块,用于向数据库表添加数据。我如何使用该控制器获取我的块

我正在使用以下文件。有人能帮我加载网格视图作为按钮点击操作吗。?
require_once("Mage/Adminhtml/Block/Customer/Edit/Tabs.php");
class Proporta_Warrenty_Block_Adminhtml_Customer_Edit_Tabs extends Mage_Adminhtml_Block_Customer_Edit_Tabs {

    private $parent;



    public function _construct() {
        die('came to die');
    }

    protected function _prepareLayout() {


        ///get all existing tabs.
        $this->parent = parent::_prepareLayout();


        ///if the module is enabled, add new tab.
        if (Mage::helper('core')->isModuleEnabled('Proporta_Warrenty') ) {
            $this->addTab('warrenty', array(
                'label' => Mage::helper('customer')->__('Proporta Warrenty'),
               // 'content' => 'test sanjeeeee',
                'content' => $this->getLayout()->createBlock('warrenty/adminhtml_tab_grid')->toHtml() ,
            ));
        }

        return $this->parent;
    }
}

这是网格文件

<?php
class Proporta_Warrenty_Block_Adminhtml_Warrenty_Grid extends Mage_Adminhtml_Block_Widget_Grid
{
  public function __construct()
  {
    parent::__construct();
    $this->setSaveParametersInSession(true);

  }

  protected function _prepareCollection()
  {
    $session_customer_id = Mage::getSingleton('customer/session')->getCustomer()->getId();
    $collection = Mage::getModel('warrenty/warrenty')->getCollection($session_customer_id);
    $this->setCollection($collection);
    return parent::_prepareCollection();
  }

  protected function _prepareColumns()
  {
   $this->addColumn('entity_id', array(
        'header'    => Mage::helper('warrenty')->__('Entity Id'),
        'align'     =>'left',
        'index'     => 'increment_id',
    ));

    $this->addColumn('product_id', array(
        'header'    => Mage::helper('warrenty')->__('Product Name'),
        'align'     =>'left',

    ));  
    $this->addColumn('product_barcode', array(
        'header'    => Mage::helper('warrenty')->__('Product Barcode'),
        'align'     =>'left',

    )); 

        $this->addColumn('registered_at', array(
        'header'    => Mage::helper('warrenty')->__('Registered Date'),
        'align'     =>'left',
        'index'     => 'registered_at',
        'type'      => 'datetime'   ,
    ));

    $this->addExportType('*/*/exportCsv', Mage::helper('warrenty')->__('CSV'));
    $this->addExportType('*/*/exportXml', Mage::helper('warrenty')->__('XML'));

    return parent::_prepareColumns();
  }


}
(XML');
返回父项::_prepareColumns();
}
}
这是模板中的选项卡文件

<li >
        <a href="" 
           id="customer_info_tabs_orders" 
           name="warrenty" title="Warranty"
           class="tab-item-link ajax notloaded">
            <span>
                <span class="changed" title="<?php echo $this->__('The information in this tab has been changed.') ?>"></span>
                <span class="error" title="<?php echo $this->__('This tab contains invalid data. Please solve the problem before saving.') ?>">
                </span><?php echo 'Proporta Warrenty'; ?></span>
        </a>
        <div id="customer_info_tabs_warrenty_content" style="display:none;"></div>
    </li>
  • 这是配置xml

    <?xml version="1.0" encoding="UTF-8"?>
    <!--
    To change this template, choose Tools | Templates
    and open the template in the editor.
    -->
    <config>
        <stores>
            <admin>
                <design>
                    <theme>
                        <default>proporta</default>
                    </theme>
                </design>
            </admin>    
        </stores>
    
        <modules>
            <Proporta_Warrenty> 
                <version>0.1.0</version>
                <depends>
                    <!-- no dependencies --> 
                </depends>
            </Proporta_Warrenty> 
        </modules> 
    
        <global>
            <helpers>
                <warrenty>
                    <class>Proporta_Warrenty_Helper</class>
                </warrenty>
            </helpers>
    
            <template>
                <email>
                    <custom_order_tpl module="Proporta_Warrenty">
                        <label>Life time Warranty</label>
                        <file>lifeTimeWarranty.html</file>
                        <type>html</type>
                    </custom_order_tpl>
                </email>
            </template>
        </global>
    
        <frontend>
            <routers>
                <warrenty>
                    <use>standard</use>
                    <args>
                        <module>Proporta_Warrenty</module>
                        <frontName>warrenty</frontName>
                    </args>
                </warrenty>
            </routers>
            <events></events> 
            <translate>
                <modules>
                    <Proporta_Warrenty>
                        <files>
                            <default>Proporta_Warrenty.csv</default>
                        </files>
                    </Proporta_Warrenty>
                </modules>
            </translate> 
            <layout>
            </layout>
        </frontend>
    
        <adminhtml>
            <routers>
                <warrenty>
                    <use>standard</use>
                    <args>
                        <module>Proporta_Warrenty</module>
                        <frontName>warrenty</frontName>
                    </args>
                </warrenty>
            </routers>
        </adminhtml> 
    
    
    
    </config>
    
    
    比例
    0.1.0
    Propta_Warrenty_助手
    终身保修
    lifeTimeWarranty.html
    html
    标准
    沃伦蒂比例酒店
    沃伦蒂
    Propta_Warrenty.csv
    标准
    沃伦蒂比例酒店
    沃伦蒂
    

    有人能帮我添加块网格视图上面的选项卡操作吗?

    这段代码之后您得到了什么?表示您面临的问题。它没有在管理客户编辑下添加选项卡,并且在管理或日志文件中没有错误?您在网格中也有批量操作块方法吗?