2014-10-08 80 views
0

嗨我想在销售订单网格中显示一些自定义客户地址属性。在magento的销售订单网格集合中添加自定义客户地址属性

如何实现这一目标?

下面是我的收藏。我已成功添加表格字段从另一个表,但无法添加客户/地址属性

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(); 
} 

谢谢你们。

回答

0

阿努拉格Patbandha

根据你的代码,你只能添加的sales_flat_order_address领域。 如果你想添加customer address attribute to order grid then you need joincustomer/address集合它on default shipping or billing address

相关问题