Magento 客户网格 - 屏蔽电子邮件地址

Magento Customer Grid - Mask Email address(Magento 客户网格 - 屏蔽电子邮件地址)
本文介绍了Magento 客户网格 - 屏蔽电子邮件地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

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

I have a requirement for call centre agents to search for a customer based on email address. But I don't want to show the email address in the customer grid unless they search for a email.

我该怎么做??

Magento 版本:1.4.1.1

Magento Version: 1.4.1.1

提前致谢.

推荐答案

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

Write a custom module that extend:

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

阅读更多@如何从 eav_attribute 表中获取实体(例如客户)的数据以显示在客户网格中以供管理员使用(删除带有 sales_order_grid 的行)

Read more @ How to get data for an entity (for example customer) from eav_attribute table to be shown in Customer Grid for admin (remove line with sales_order_grid)

将 '_prepareColumns()' 方法复制到您的自定义模块并进行更改

Copy '_prepareColumns()' method to your custom module and change

    $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

This is base off Magento v1.7

这篇关于Magento 客户网格 - 屏蔽电子邮件地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

In PHP how can you clear a WSDL cache?(在 PHP 中如何清除 WSDL 缓存?)
failed to open stream: HTTP wrapper does not support writeable connections(无法打开流:HTTP 包装器不支持可写连接)
Stop caching for PHP 5.5.3 in MAMP(在 MAMP 中停止缓存 PHP 5.5.3)
Caching HTTP responses when they are dynamically created by PHP(缓存由 PHP 动态创建的 HTTP 响应)
Memcached vs APC which one should I choose?(Memcached 与 APC 我应该选择哪一个?)
What is causing quot;Unable to allocate memory for poolquot; in PHP?(是什么导致“无法为池分配内存?在 PHP 中?)