I've been able to add columns to the sales order grid table in admin, but when I try to use the column to search I get an error Strict Notice: call_user_func() expects parameter 1 to be a valid callback, non-static method filterSkus() should not be called statically
Here's the observer function
public function filterSkus($collection, $column)
{
if (!$value = $column->getFilter()->getValue()) {
return $this;
}
$collection->getSelect()->having(
"group_concat(`m_sales_flat_order_item`.sku SEPARATOR ', ') like ?", "%$value%");
return $this;
}
Here's the data helper calling it
public function getSkusColumnParams()
{
return array(
'header' => 'SKUs',
'index' => 'skus',
'type' => 'text',
'filter_condition_callback' => array('DR_Salesgridder_Model_Observer', 'filterSkus'),
);
}
The stack error is coming from call_user_func
in Mage/Adminhtml/Block/Widget/Grid.php
protected function _addColumnFilterToCollection($column)
{
if ($this->getCollection()) {
$field = ( $column->getFilterIndex() ) ? $column->getFilterIndex() : $column->getIndex();
if ($column->getFilterConditionCallback()) {
call_user_func($column->getFilterConditionCallback(), $this->getCollection(), $column);
}
I made the filterSkus
function static, but it gives me the error undefined variable: this
. Beyond removing the strict reporting, is there another way?