Allows to alter the list of products on the Shop/Products page in the Administration Area.
The event handler accepts the back-end controller object and should return a configured
Shop_Product object.
The following example modifies the product list in such a way that only enabled products are displayed.
public function subscribeEvents()
{
Backend::$events->addEvent('shop:onPrepareProductListData', $this, 'prepare_products_data');
}
public function prepare_products_data($controller)
{
$product = Shop_Product::create()->apply_visibility(); // Hide disabled products
$controller->filterApplyToModel($product, 'product_list'); // Apply list filters
return $product->where('grouped is null'); // Hide grouped products
}
Note that the Product list page has filters, and the controller's filterApplyToModel() method should be called in
order to apply them to the product model. Also, the list should not display grouped products.