[英]Add custom customer address attribute in sales order grid collection in magento
Hi I want to show some custom customer address attribute in sales order grid. 嗨,我想在销售订单网格中显示一些自定义客户地址属性。
How to achieve that ? 如何实现呢?
below is my Collection. 以下是我的收藏。 I have successfully added table fields from another table but unable to add attributes from customer/address 我已成功从另一个表添加了表字段,但无法从客户/地址添加属性
protected function _prepareCollection()
{
$collection = Mage::getResourceModel('sales/order_grid_collection');
$collection->getSelect()->joinLeft(array('sfoa'=>'sales_flat_order_address'),
'main_table.entity_id = sfoa.parent_id AND sfoa.address_type="shipping"',array('sfoa.street', 'sfoa.city','sfoa.company','sfoa.customer_address_id'));
$collection->addFieldToFilter('customer_id', Mage::registry('current_customer')->getId())
->setIsCustomerMode(true);
Mage::log($collection);
$this->setCollection($collection);
return parent::_prepareCollection();
}
Thanks guys. 多谢你们。
Anurag Patbandha 阿努拉格·帕特班达(Anurag Patbandha)
According to your code ,you can only add fields of sales_flat_order_address
. 根据您的代码,您只能添加sales_flat_order_address
字段。 If you want to add customer address attribute to order grid then you need join
to customer/address
collection with it on default shipping or billing address
如果要将customer address attribute to order grid then you need join
添加customer address attribute to order grid then you need join
on default shipping or billing address
customer/address
集合
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.