| 有时候后台的grid 表我们想要查看到当前订单选择了什么样的运送方式。 例如:之前添加过上门自提的方式,那么当有很多订单的时候就需要过滤掉上门自提的订单,先处理那些需要发快递的。 解决办法: (最好重写相应模块,不要修改 core文件。下面就不再提醒这个了。) 1. 修改 grid.php 中的 _getCollectionClass函数,将 
 return 'sales/order_grid_collection'; 修改为 return 'sales/order_collection'; 但是仅仅这么做显然是不合理的,因为你会发现 shipping name 等都为空了。 当然你可以修改$collection join sales_flat_order_grid (我没测试过)。 2.大多数网上 搜到的资料是 为$collection 添加 join 例如: 
 
protected function _prepareCollection(){
	$collection = Mage::getResourceModel($this->_getCollectionClass());
	$collection->getSelect()->join('sales_flat_order', 'main_table.entity_id = sales_flat_order.entity_id',array('shipping_description'));
	$this->setCollection($collection);
	return parent::_prepareCollection();
}然后在 grid.php 的 _prepareColumns() 函数中addColumn() 
$this->addColumnAfter('shipping_description', array(
            'header' => Mage::helper('sales')->__('Shipping Method'),
            'index' => 'shipping_description',
            'width' => '100px',
            'filter_index' => 'sales_flat_order.shipping_description',
        ),'method');但是仅仅这么做 你会发现许多过滤(搜索)功能都不好使了,例如 搜索某个订单号。 
 其实解决办法很简单就是把在你重写的 grid.php 中将所有的 要取出来的值都重写一遍并且要带上参数 filter_index 例如:increment_id 
 
 $this->addColumn('real_order_id', array(
            'header'=> Mage::helper('sales')->__('Order #'),
            'width' => '80px',
            'type'  => 'text',
            'index' => 'increment_id',
            'filter_index'=>'main_table.increment_id',
        ));(责任编辑:最模板) | 



 ecshop健康用品商城带分销
							人气:2580
							ecshop健康用品商城带分销
							人气:2580
						 ecshop新仿中关村模板
							人气:588
							ecshop新仿中关村模板
							人气:588
						 免费ecshop仿米奇网化妆品
							人气:4400
							免费ecshop仿米奇网化妆品
							人气:4400
						 网络公司整站全静态生成
							人气:635
							网络公司整站全静态生成
							人气:635
						 ecshop综合模板|综合商城程
							人气:634
							ecshop综合模板|综合商城程
							人气:634
						 shopex拍鞋模板
							人气:1327
							shopex拍鞋模板
							人气:1327