You are here

function theme_uc_product_price in Ubercart 5

Same name and namespace in other branches
  1. 8.4 uc_product/uc_product.theme.inc \theme_uc_product_price()
  2. 6.2 uc_product/uc_product.module \theme_uc_product_price()
  3. 7.3 uc_product/uc_product.theme.inc \theme_uc_product_price()

Format a product's price.

Parameters

$price: The amount to print.

$class: Determines the label and the CSS class of the <div>.

3 theme calls to theme_uc_product_price()
uc_product_kit_view in uc_product_kit/uc_product_kit.module
Implementation of hook_view().
uc_product_table in uc_product/uc_product.module
Display product fields in a TAPIr table.
uc_product_view in uc_product/uc_product.module
Implementation of hook_view().

File

uc_product/uc_product.module, line 2384
The product module for Ubercart.

Code

function theme_uc_product_price($price, $class, $teaser = 0, $page = 0) {
  $output = '<div class="' . $class . '">';
  switch ($class) {
    case 'list_price':
      $output .= t('List Price: !price', array(
        '!price' => uc_currency_format($price),
      ));
      break;
    case 'cost':
      $output .= t('Cost: !price', array(
        '!price' => uc_currency_format($price),
      ));
      break;
    case 'sell_price':
    default:
      $output .= t('Price: !price', array(
        '!price' => uc_currency_format($price),
      ));
      break;
  }
  $output .= '</div>';
  return $output;
}