简体   繁体   English

在magento的销售订单网格集合中添加自定义客户地址属性

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

相关问题 Magento-客户地址中的自定义属性,在结帐时未复制到sales_flat_order_address和sales_flat_quote_address - Magento - Custom attribute in customer address, not copied to sales_flat_order_address and sales_flat_quote_address on checkout 如何在Magento的销售/订单网格中添加自定义列? - How to add Custom Column in sales/order grid in Magento? Magento Adminhtml网格,使用由客户过滤的sales / order_item集合 - Magento Adminhtml Grid using sales/order_item collection filtered by customer Magento-将自定义属性添加到订单并将此属性添加到集合过滤器 - Magento - Add custom attribute to order and add this attribute to collection filter Magento-将列添加到销售订单网格不起作用 - Magento - Add Columns to Sales Order Grid Not Working Magento自定义客户属性以显示在网格中 - Magento custom customer attribute to show in grid Magento-重新编写管理员销售订单网格以从数据库字段添加自定义列 - Magento - re write admin sales order grid to add custom column from DB field Magento 2订单集+客户收藏 - Magento 2 Order Collection + Customer Collection 如何在具有市场多供应商扩展的magento中的销售订单网格中自定义列 - How custom column in sales order grid in magento with marketplace multivendor extension Magento sales_order_create网格-可以添加if语句吗? - Magento sales_order_create grid - possible to add an if statement?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM