| 在做的一个Magento网站,客户要求在后台订单列表里增加一列,用来显示用户的公司名称,在Magento1.7.0.2上测试通过,代码步骤如下: 1、打开app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php 2.将如下函数
protected function _prepareCollection()
{
$collection = Mage::getResourceModel($this->_getCollectionClass());
$this->setCollection($collection);
return parent::_prepareCollection();
}
替换为
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('company'));
$this->setCollection($collection);
return parent::_prepareCollection();
}
3.搜索函数:protected function _prepareColumns() 该函数是用来显示列表名称的,在适当的位置增加如下代码:
$this->addColumn('billing_name', array(
//'header' => Mage::helper('sales')->__('Bill to Name'),
'header' => Mage::helper('sales')->__('Company Name'),
'index' => 'billing_name',
));
(责任编辑:最模板) |

ecshop桃花坞成人用品网站
人气:2206
韩国夏日风格ECSHOP服装模
人气:1067
ecshop广告联盟CPS插件
人气:3598
韩国SZ服装模板|ecshop服装
人气:670
ecshop新仿中关村模板
人气:588
ecshop仿oppo整站模板2015版
人气:999