php - Magento 客户网格 - 掩码电子邮件地址

标签 php javascript magento-1.4 magento

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

我该怎么做?

Magento 版本:1.4.1.1

提前谢谢您。

最佳答案

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

/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

关于php - Magento 客户网格 - 掩码电子邮件地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12691482/

相关文章:

javascript - True 和 False 循环数组

magento-1.4 - Magento 扩展仅适用于 multishop 中的单个商店

Magento - 菜单显示类别和类别中的产品

php - 显示和编辑多行(MySQL 和 PHP)

php - 如何删除带有 "filter"键的memcached数据?

php - 从 mysql 检索后图像不显示

javascript - 为 Angular Directive(指令)添加幻灯片动画

php - 属性值作为类名给出错误

javascript - 使用 Sweet Alert(又名 Swal)提交表单

magento - 如何将产品属性过滤器添加到 Magento 高级导出配置文件?