You are here

function commerce_price_table_display_quantity_headers in Commerce Price Table 7

Helper function that takes care of the quantity displayed in the headers of the price table.

2 calls to commerce_price_table_display_quantity_headers()
commerce_price_table_field_formatter_view in ./commerce_price_table.module
Implements hook_field_formatter_view().
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 584

Code

function commerce_price_table_display_quantity_headers($item) {

  // Set the quantity text to unlimited if it's -1.
  $max_qty = $item['max_qty'] == -1 ? t('Unlimited') : $item['max_qty'];

  // If max and min qtys are the same, only show one.
  if ($item['min_qty'] == $max_qty) {
    $quantity_text = $item['min_qty'];
  }
  else {
    $quantity_text = $item['min_qty'] . ' - ' . $max_qty;
  }
  return $quantity_text;
}