我试图通过添加列来显示数据
来自定义Magento销售/订单/网格CUSTOMER_ID 帐单地址 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>
我在我的网格中显示了新列,但是有空,所以我知道我做错了什么,我认为它非常简单。如果有人能告诉我如何使用这种方法加入正确的表格,我将不胜感激。
答案 0 :(得分: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);