2012-10-02 47 views

回答

3

编写扩展自定义模块:

/app/code/core/Mage/Adminhtml/Block/Customer/Grid.php 

更多@How to get data for an entity (for example customer) from eav_attribute table to be shown in Customer Grid for admin(删除与sales_order_grid线)

复制 '_prepareColumns()' 方法,以您的自定义模块,并改变

$this->addColumn('email', array(
     'header' => Mage::helper('customer')->__('Email'), 
     'width'  => '150', 
     'index'  => 'email' 
     'renderer' = new MageIgniter_MaskEmail_Block_Adminhtml_Renderer_Data() // added this line 
    )); 

阅读全文@http://www.magentocommerce.com/boards/viewthread/192232/#t239222

创建类:

class MageIgniter_MaskEmail_Block_Adminhtml_Renderer_Data extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Action 
{ 
    public function render(Varien_Object $row) 
    { 
     return $this->_getValue($row); 
    } 

    public function _getValue(Varien_Object $row) 
    { 
     $val = $row->getData($this->getColumn()->getIndex()); // row value 

     $search_filter = base64_decode($this->getRequest()->getParam('filter')); 
     // print_r($search_filter) : email=rs%40cs.com&customer_since%5Blocale%5D=en_US 
     //read more @ http://inchoo.net/ecommerce/magento/what-is-base64-encoding-and-how-can-we-benefit-from-it/ 

     // check if $search_filter contain email and equal to the search email 
     parse_str($search_filter, $query) 
     if(isset($query['email'] && $val == $query['email']){ // or array_key_exist() 
      return $val; 
     } 
     else{ 
      return 'xxxxxxxx'; 
     } 

    } 
} 

这是基地起飞的Magento V1.7

+0

除了一些语法错误,你的代码的伟大工程。非常感谢你。 – TheGodWings

+0

我的代码未经测试...您能否发布语法错误,以便我可以更新上面的代码 –

相关问题