You are here

function commerce_price_table_sort_by_qty in Commerce Price Table 7

Sort the price fields by quantity.

2 string references to 'commerce_price_table_sort_by_qty'
commerce_price_table_get_amount_qty in ./commerce_price_table.module
Get the price for the min qty possible in a product.
commerce_price_table_ief_field_formatter_view in commerce_price_table_ief/commerce_price_table_ief.module
Implements hook_field_formatter_view().

File

./commerce_price_table.module, line 518

Code

function commerce_price_table_sort_by_qty($a, $b) {
  $a_qty = is_array($a) && isset($a['min_qty']) ? $a['min_qty'] : 0;
  $b_qty = is_array($b) && isset($b['min_qty']) ? $b['min_qty'] : 0;
  if ($a_qty == $b_qty) {
    return 0;
  }
  return $a_qty < $b_qty ? -1 : 1;
}