$select->joinLeft(
array('order_table' => $collection->getTable('sales/order')),
'order_table.entity_id=main_table.entity_id',
array('admin_user_id' => 'admin_user_id')
);
in a custom magento module that is causing the error
Integrity constraint violation: 1052 Column 'created_at' in where clause is ambiguous
commenting out this code allows magento to run correctly, the code is located in an observer
public function salesOrderGridCollectionLoadBefore($observer)
{
$collection = $observer->getOrderGridCollection();
$select = $collection->getSelect();
$select->joinLeft(
array('order_table' => $collection->getTable('sales/order')),
'order_table.entity_id=main_table.entity_id',
array('admin_user_id' => 'admin_user_id')
);
}
Could anybody advise a fix, this is not my code or my module, and I don't fully understand everything it is doing.
I am guessing it adds a field to a table and populates it then allows you to search using it using the order page.
Thanks in advance. -T
Take a look at
'sfo_created_at' =>'sfo.created_at'
which will rename thesales_flat_order.created_at
tosales_flat_order.sfo_created_at
(you could also just remove that field from the select)