[英]Magento - Custom attribute in customer address, not copied to sales_flat_order_address and sales_flat_quote_address on checkout
[英]Add custom customer address attribute in sales order grid collection in 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();
}
多謝你們。
阿努拉格·帕特班達(Anurag Patbandha)
根據您的代碼,您只能添加sales_flat_order_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.