Integrity constraint violation: 1052 Column in where clause is ambiguous”

5
38
views
Advertisement

For example in our custom module we have to add order_id in grid, if we search by order id in grid than such type of error occurs.

SQLSTATE[23000]: Integrity constraint violation: 1052 Column ‘Order_id’
in where clause is ambiguous

to resolve such error we can add ‘filter_index’=>’main_table.order_id’ in $this->addColumn() function


$this->addColumn('order_id', array(
'header' => Mage::helper('couponcode')->__('Order Id'),
'align' =>'left',
'index' => 'order_id',
'filter_index'=>'main_table.order_id', // This parameter helps to resolve above error
));

Thanks,
Mayank Zalavadia 🙂