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:onGetCategoryProductSortingQuery event

Triggered by Shop_Category
Author LemonStand eCommerce Inc.

Event handler signature

public string event_onGetCategoryProductSortingQuery(string $sorting_column, Shop_Category $category)
$sorting_column string specifies the sorting column name.
$category Shop_Category specifies the category object
{return} string returns the sorting query string.
Allows you to add a custom sorting field support to the Shop_Category::list_products() method. The event handler should accept two parameters: the sorting column name and the product category object. It should return the sorting query. This event is often used with shop:onGetProductSortColumns to add a custom sorting query for a custom sort field:
public function subscribeEvents()
{
  Backend::$events->addEvent('shop:onGetProductSortColumns', $this, 'get_sorting_columns');
  Backend::$events->addEvent('shop:onGetCategoryProductSortingQuery', $this, 'get_sorting_query');
}

public function get_sorting_columns()
{
  return array('x_newfield');
}

public function get_sorting_query($column, $category)
{
  if ($column != 'x_newfield')
    return null;

  $sort_str = ' custom sorting clause ';

  return $sort_str;
}