将带有网格视图选项的新选项卡添加到admin中的客户编辑页面

时间:2013-09-30 12:26:01

标签: php magento magento-1.7

我希望自定义标签页显示在客户编辑页面上,当点击该标签页时,应该打开网格视图,其中包含排序和过滤功能。

目前,我可以在网格中显示数据,但是当我将'filter' => true,放入

$this->addColumn('create_date', array(
    'header' => Mage::helper('clubmembership')->__('Purchase Date'),
    'index' => 'create_date',
    'type' => 'datetime',
    'sortable'  => true,
    'filter'    => false
));

抛出异常:

exception 'Mage_Core_Exception' with message 'Invalid block type: 1' in F:\wamp\www\mhs\app\Mage.php:594
Stack trace:
#0 F:\wamp\www\mhs\app\code\core\Mage\Core\Model\Layout.php(495): Mage::throwException('Invalid block t...')
#1 F:\wamp\www\mhs\app\code\core\Mage\Core\Model\Layout.php(437): Mage_Core_Model_Layout->_getBlockInstance(true, Array)
#2 F:\wamp\www\mhs\app\code\core\Mage\Adminhtml\Block\Widget\Grid\Column.php(369): Mage_Core_Model_Layout->createBlock(true)
#3 F:\wamp\www\mhs\app\code\core\Mage\Adminhtml\Block\Widget\Grid\Column.php(51): Mage_Adminhtml_Block_Widget_Grid_Column->getFilter()
#4 F:\wamp\www\mhs\app\code\core\Mage\Adminhtml\Block\Widget\Grid.php(314): Mage_Adminhtml_Block_Widget_Grid_Column->setGrid(Object(AcrossData_ClubMembership_Block_Adminhtml_Customer_Edit_Tab_Clubmember))
#5 F:\wamp\www\mhs\app\code\local\AcrossData\ClubMembership\Block\Adminhtml\Customer\Edit\Tab\Clubmember.php(56): Mage_Adminhtml_Block_Widget_Grid->addColumn('create_date', Array)
#6 F:\wamp\www\mhs\app\code\core\Mage\Adminhtml\Block\Widget\Grid.php(624): AcrossData_ClubMembership_Block_Adminhtml_Customer_Edit_Tab_Clubmember->_prepareColumns()
#7 F:\wamp\www\mhs\app\code\core\Mage\Adminhtml\Block\Widget\Grid.php(632): Mage_Adminhtml_Block_Widget_Grid->_prepareGrid()
#8 F:\wamp\www\mhs\app\code\core\Mage\Core\Block\Abstract.php(862): Mage_Adminhtml_Block_Widget_Grid->_beforeToHtml()
#9 F:\wamp\www\mhs\app\code\core\Mage\Adminhtml\Block\Widget\Tabs.php(303): Mage_Core_Block_Abstract->toHtml()
#10 F:\wamp\www\mhs\app\design\adminhtml\default\default\template\widget\tabs.phtml(38): Mage_Adminhtml_Block_Widget_Tabs->getTabContent(Object(AcrossData_ClubMembership_Block_Adminhtml_Customer_Edit_Tab_Clubmember))
#11 F:\wamp\www\mhs\app\code\core\Mage\Core\Block\Template.php(241): include('F:\wamp\www\mhs...')
#12 F:\wamp\www\mhs\app\code\core\Mage\Core\Block\Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml\defau...')
#13 F:\wamp\www\mhs\app\code\core\Mage\Core\Block\Template.php(286): Mage_Core_Block_Template->renderView()
#14 F:\wamp\www\mhs\app\code\core\Mage\Adminhtml\Block\Template.php(81): Mage_Core_Block_Template->_toHtml()
#15 F:\wamp\www\mhs\app\code\core\Mage\Core\Block\Abstract.php(863): Mage_Adminhtml_Block_Template->_toHtml()
#16 F:\wamp\www\mhs\app\code\core\Mage\Core\Block\Text\List.php(43): Mage_Core_Block_Abstract->toHtml()
#17 F:\wamp\www\mhs\app\code\core\Mage\Core\Block\Abstract.php(863): Mage_Core_Block_Text_List->_toHtml()
#18 F:\wamp\www\mhs\app\code\core\Mage\Core\Block\Abstract.php(582): Mage_Core_Block_Abstract->toHtml()
#19 F:\wamp\www\mhs\app\code\core\Mage\Core\Block\Abstract.php(526): Mage_Core_Block_Abstract->_getChildHtml('left', true)
#20 F:\wamp\www\mhs\app\design\adminhtml\default\default\template\page.phtml(58): Mage_Core_Block_Abstract->getChildHtml('left')
#21 F:\wamp\www\mhs\app\code\core\Mage\Core\Block\Template.php(241): include('F:\wamp\www\mhs...')
#22 F:\wamp\www\mhs\app\code\core\Mage\Core\Block\Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml\defau...')
#23 F:\wamp\www\mhs\app\code\core\Mage\Core\Block\Template.php(286): Mage_Core_Block_Template->renderView()
#24 F:\wamp\www\mhs\app\code\core\Mage\Adminhtml\Block\Template.php(81): Mage_Core_Block_Template->_toHtml()
#25 F:\wamp\www\mhs\app\code\core\Mage\Core\Block\Abstract.php(863): Mage_Adminhtml_Block_Template->_toHtml()
#26 F:\wamp\www\mhs\app\code\core\Mage\Core\Model\Layout.php(555): Mage_Core_Block_Abstract->toHtml()
#27 F:\wamp\www\mhs\app\code\core\Mage\Core\Controller\Varien\Action.php(390): Mage_Core_Model_Layout->getOutput()
#28 F:\wamp\www\mhs\app\code\core\Mage\Adminhtml\controllers\CustomerController.php(151): Mage_Core_Controller_Varien_Action->renderLayout()
#29 F:\wamp\www\mhs\app\code\core\Mage\Core\Controller\Varien\Action.php(419): Mage_Adminhtml_CustomerController->editAction()
#30 F:\wamp\www\mhs\app\code\core\Mage\Core\Controller\Varien\Router\Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('edit')
#31 F:\wamp\www\mhs\app\code\core\Mage\Core\Controller\Varien\Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#32 F:\wamp\www\mhs\app\code\core\Mage\Core\Model\App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#33 F:\wamp\www\mhs\app\Mage.php(683): Mage_Core_Model_App->run(Array)
#34 F:\wamp\www\mhs\index.php(87): Mage::run('', 'store')
#35 {main}

Adminhtml布局xml文件如下:

<layout version="0.1.0">
<adminhtml_customer_edit>
    <reference name="customer_edit">            
        <block type="acrossdata_clubmembership/adminhtml_customer_edit_clubmember" name="customer_edit.clubmember" />
    </reference> 
    <reference name="customer_edit_tabs">
        <action method="addTab">
            <name>customer_clubmember</name>
            <block>acrossdata_clubmembership/adminhtml_customer_edit_tab_clubmember</block>
        </action>           
    </reference>        
</adminhtml_customer_edit>

需要帮助......如果需要任何其他细节,请告诉我。

或者可以分享任何帮助网址。

1 个答案:

答案 0 :(得分:0)

filter必须是有效的阻止类型(例如adminhtml/widget_grid_column_filter_text),或false不能过滤。但是如果您在type中设置了filter并且什么也不做,Magento可以自动检测默认情况下应该使用哪种过滤器类型(如果可能,请参阅Mage_Adminhtml_Block_Widget_Grid_Column::_getFilterByType()获取完整列表)。因为这是您的情况,您可以删除filter定义。