問題描述
我要求呼叫中心代理根據電子郵件地址搜索客戶.但我不想在客戶網格中顯示電子郵件地址,除非他們搜索電子郵件.
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 客戶網格 - 屏蔽電子郵件地址的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!