This is the API docs for LemonStand V1, which has been discontinued. LemonStand is now a cloud based platform, available at lemonstand.com.

LemonStand API

shop:onExtendReportFilters event

Triggered by Shop_GenericReport
Author LemonStand eCommerce Inc.

Event handler signature

public void event_onExtendReportFilters(Shop_GenericReport $controller)
$controller Shop_GenericReport the back-end controller object.
Allows to add new filters to a report page. Event handlers should use the controller's filter_filters() method for adding new filters. Please read List filters article for details about back-end list filters. The following example defines a new filter on the Orders Report page.
public function subscribeEvents() 
{
  Backend::$events->addEvent('shop:onExtendReportFilters', $this, 'extend_filters');
}

function extend_filters($controller) 
{
  if( !($controller instanceof Shop_Orders_Report) )
    return;

  $controller->filter_filters['dealer'] = array(
    'name'=>'Dealer', 
    'class_name'=>'DealerFilter_Filter', 
    'prompt'=>'Please choose dealers statuses you want to include to the report. Orders with other dealers will be excluded.', 
    'added_list_title'=>'Added Dealers'
  );
}
The filter refers to the custom DealersFilter_Filter filter class, which can be defined as follows:
class DealerFilter_Filter extends Db_DataFilter 
{
  public $model_class_name = 'Users_User';
  public $list_columns = array('name');

  public function prepareListData() 
  {
    $className = $this->model_class_name;
    $obj = new $className();

    return $obj;
  }

  public function applyToModel($model, $keys, $context = null) 
  {
    $model->where('customer_calculated_join.created_user_id is not null and customer_calculated_join.created_user_id in (?)', array($keys));
  }

  public function asString($keys, $context = null) 
  {
    return 'and shop_customers.created_user_id is not null and shop_customers.created_user_id in '.$this->keysToStr($keys);
  }
}