簡體   English   中英

在magento的銷售訂單網格集合中添加自定義客戶地址屬性

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM