2

我要求呼叫中心代理根据电子邮件地址搜索客户。但我不想在客户网格中显示电子邮件地址,除非他们搜索电子邮件。

我怎样才能做到这一点??

Magento 版本:1.4.1.1

先感谢您。

4

1 回答 1

3

编写一个扩展的自定义模块:

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

阅读更多@如何从 eav_attribute 表中获取实体(例如客户)的数据,以便在管理员的客户网格中显示 (删除与 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 的基础

于 2012-10-02T17:33:04.733 回答