0

我正在尝试通过添加列来显示数据来自定义 Magento 销售/订单/网格

Customer_Id Billing_Address Shipping_Address

我在之前的帖子之后创建了一个模块

我现在正在尝试加入这些表,但无法弄清楚如何使用 XML 来做到这一点。

<gridcontrol>
    <grids>
        <sales_order_grid>
            <!-- remove order id -->
            <shipping_address>
                <add>
                    <header>Shipping Address</header>
                    <!-- join shipping address from sales/order table -->
                    <join table="sales_flat_order_address" condition="sales_flat_order_address.entity_id={{table}}.street" field="street"/>
                </add>
                <after>status</after>
            </shipping_address>
            <billing_address>
                <add>
                    <header>Billing Address</header>
                    <!-- join shipping address from sales/order table -->
                    <join table="sales_flat_order_address" condition="sales_flat_order_address.entity_id={{table}}.street" field="street"/>
                </add>
                <after>status</after>
            </billing_address>
            <customer_id>
                <add>
                    <header>Customer Id</header>
                    <!-- join shipping address from sales/order table -->
                    <join table="sales_flat_order" condition="main_table.cutomer_id={{table}}.customer_id" field="customer_id"/>
                </add>
                <after>status</after>
            </customer_id>            
        </sales_order_grid>
    </grids>
</gridcontrol>

我的网格中显示了新的列,但是有空的,所以我知道我做错了,我认为这很简单。如果有人能告诉我如何使用这种方法加入正确的表格,我将不胜感激。

4

1 回答 1

0

你为什么不尝试做,_prepareCollection()

$collection->getSelect()->columns(array('filename' => new Zend_Db_Expr ("(SELECT 
filename FROM table_name WHERE customer_id =e.entity_id)")));
        $this->setCollection($collection);
于 2013-09-25T10:24:53.270 回答