我已经在管理销售订单网格中添加了一个新列(电话
通过编辑app/code/local/Mage/Adminhtml/Block/Sales/Order/Grid.php文件
编辑/添加的代码为:
protected function _prepareCollection()
{
$collection = Mage::getResourceModel($this->_getCollectionClass());
$collection->getSelect()->join('sales_flat_order_address', 'main_table.entity_id = sales_flat_order_address.parent_id',array('telephone'))->where("sales_flat_order_address.address_type = 'billing'");
$this->setCollection($collection);
return parent::_prepareCollection();
}
protected function _prepareColumns()
{
$this->addColumn('telephone', array(
'header' => Mage::helper('sales')->__('telephone'),
'index' => 'telephone',
'filter_index' => 'sales_flat_order_address.telephone',
));
}现在它看起来像这样

现在的问题是,有些电话号码是阿拉伯语的(印度号码),另一些是英语的(阿拉伯号码)。
过滤依赖于你要搜索的数字
因此,我需要将印度数字转换为阿拉伯数字,以便筛选器可以在所有行上工作
我如何在Grid.php文件中做到这一点?
发布于 2015-09-09 20:46:08
如果你指的是Wikipedia calls eastern arabic / indic numerals,那么一个简单的替换操作就可以完成。
$western_arabic = array('0','1','2','3','4','5','6','7','8','9');
$eastern_arabic = array('٠','١','٢','٣','٤','٥','٦','٧','٨','٩');
$str = str_replace($western_arabic, $eastern_arabic, $str);https://stackoverflow.com/questions/32479713
复制相似问题