[英]Magento 1.9.2 admin add street column in Customers by number of orders report
我想按订单数在admin-> report-> Customers中添加街道列。(Magento 1.9.2)
我尝试在'app \\ code \\ core \\ Mage \\ Reports \\ Model \\ Resource \\ Customer \\ Orders \\ Collection.php'中添加联接查询
protected function _joinFields($from = '', $to = '')
{
$this->joinCustomerName()
->groupByCustomer()
->addOrdersCount()
->addAttributeToFilter('main_table.created_at', array('from' => $from, 'to' => $to, 'datetime' => true))
->join(array('p' => 'sales/order_address'), 'main_table.entity_id = p.parent_id', array(
'street'
));
return $this;
}
并在'app \\ code \\ core \\ Mage \\ Adminhtml \\ Block \\ Report \\ Customer \\ Orders \\ Grid.php'中
$this->addColumn('street', array(
'header' => $this->__('street'),
'sortable' => false,
'index' => 'street'
));
我正在获取主表数据,而不是我已加入的字段。
我已经尝试过了,任何其他方法总是很受欢迎。 提前致谢。
在“ app \\ code \\ core \\ Mage \\ Adminhtml \\ Block \\ Report \\ Customer \\ Orders \\ Grid.php”中,您必须包括renderer标签,该标签将从相应模块中获取数据。
$this->addColumn('street', array(
'header' => $this->__('street'),
'sortable' => false,
'index' => 'street',
'renderer' => 'namespace_module/adminhtml_module_renderer_streetname',
));
您必须在渲染器路径中包括一个将返回街道名称的方法。 而已
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.