Magento:为客户网格添加商店信用

时间:2013-08-06 12:05:33

标签: magento

我尝试在Magento管理面板中将客户余额(商店信用)列添加到客户网格。它工作正常,但是当我尝试通过enterinng'From:'和'To:'值来搜索客户余额时,它会抛出错误“PHP致命错误:在非对象上调用成员函数getBackend()...第816行的./app/code/core/Mage/Eav/Model/Entity/Abstract.php“”

我编辑了以下文件: 应用程序/代码/核心/法师/ Adminhtml /砌块/客户/ Grid.php

     protected function _prepareCollection()
  {
$collection = -----------
------------------------
 $collection->getSelect()->joinLeft( array('balance_table'=>'enterprise_customerbalance'),
              'e.entity_id = balance_table.customer_id', array('balance_table.*'));
           $collection->addAttributeToSelect('amount');           
        $this->setCollection($collection);
        return parent::_prepareCollection();
}
---------------------
---------------------
protected function _prepareColumns()
    {
----------------------
 $this->addColumn('amount', array(
            'header'    => Mage::helper('customer')->__('Store Credit'),
            'index'     => 'amount',
            'type'      => 'currency',
            'currency' => 'base_currency_code'           
        ));
----------------------
}
----------------------

任何帮助表示赞赏,

感谢。

1 个答案:

答案 0 :(得分:0)

您是否尝试添加'filter_index' => 'balance_table.amount',

    $this->addColumn('amount', array(
        'header'    => Mage::helper('customer')->__('Store Credit'),
        'align'     =>'right',
        'width'     => '20px',
        'index'     => 'amount',
        'filter_index' => 'balance_table. amount',
    ));