@GarthHuff
Try below class if we have customer attribute like "customer_activated"
<?php
class [MyCompanyName]_[MyModuleName]_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid
{
protected function _preparePage()
{
$collection = $this->getCollection();
$customerActivated = Mage::getSingleton('customer/customer')->getResource()->getAttribute('customer_activated');
$collection->getSelect()
->joinLeft(
array('customerActivatedTb' => $customerActivated->getBackend()->getTable()),
'main_table.customer_id = customerActivatedTb.entity_id AND customerActivatedTb.attribute_id = '.$customerActivated->getId(). ' AND customerActivatedTb.entity_type_id = '.Mage::getSingleton('customer/customer')->getResource()->getTypeId(),
array('customer_activated' =>'customerActivatedTb.value')
);
return parent::_preparePage();
}
protected function _prepareColumns()
{
$options =array(
0 => Mage::helper('core')->__('No'),
1 => Mage::helper('core')->__('Yes')
);
$this->addColumn('customer_activated',
array(
'header'=> Mage::helper('sales')->__('Customer Activated'),
'width' => '70px',
'index' => 'customer_activated',
'type' => 'options',
'options' => $options,
'filter_condition_callback' => array($this, 'customerActivatedFilter'),
));
$this->addColumnsOrder('customer_activated', 'shipping_name');
return parent::_prepareColumns();
}
public function customerActivatedFilter($collection, $column){
$filterValue = $column->getFilter()->getValue();
if(!is_null($filterValue)){
$filterValue = trim($filterValue);
$filterValue = preg_replace('/[\s]+/', ' ', $filterValue);
$where = $collection->getConnection()->quoteInto("customerActivatedTb.value = ?", $filterValue);
$collection->getSelect()->where($where);
}
}
}
?>
I hope above code helps you!