我的 Grid.php 文件中有以下代码:
function _prepareCollection () {
$collection = Mage::getResourceModel($this->_getCollectionClass());
$collection->getSelect()->joinLeft(
array('sfog' => 'sales_flat_order_grid'),
'main_table.entity_id = sfog.entity_id',
array('sfog.shipping_name','sfog.billing_name')
);
$collection->getSelect()->joinLeft(
array('sfo'=>'sales_flat_order'),
'sfo.entity_id=main_table.entity_id',
array(
'sfo.customer_email',
'sfo.weight',
'sfo.discount_description',
'sfo.increment_id',
'sfo.store_id',
'sfo.created_at',
'sfo.status',
'sfo.base_grand_total',
'sfo.grand_total'
)
);
我也想添加表 sales_order_item,但是如果我添加此表,我会收到此错误:
已存在具有相同 ID“119”的项目 (Mage_Sales_Model_Order)
无论如何围绕这个?