【问题标题】:Add custom customer address attribute in sales order grid collection in magento在 magento 的销售订单网格集合中添加自定义客户地址属性
【发布时间】:2014-12-03 07:43:41
【问题描述】:

您好,我想在销售订单网格中显示一些自定义客户地址属性。

如何实现?

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

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

谢谢大家。

【问题讨论】:

    标签: php magento magento-1.7


    【解决方案1】:

    阿努拉格·帕特班达

    根据您的代码,您只能添加sales_flat_order_address 的字段。 如果您想将customer address attribute to order grid then you need join 添加到customer/address 集合中on default shipping or billing address

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-11-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多