You are here

function basic_cart_handler_field_price::render in Basic cart 7.2

Same name and namespace in other branches
  1. 7.3 views/basic_cart_handler_field_price.inc \basic_cart_handler_field_price::render()

Overrides views_handler_field::render().

Overrides views_handler_field_numeric::render

File

views/basic_cart_handler_field_price.inc, line 61
Views handler: Product price field.

Class

basic_cart_handler_field_price
Returns a formatted price value to display in the View.

Code

function render($values) {
  if (basic_cart_is_product($values->{$this->aliases['type']})) {
    if ($this->options['format'] == 'numeric') {
      return parent::render($values);
    }
    if ($this->options['format'] == 'bc_price') {
      $value = $this
        ->get_value($values);
      if (is_null($value) || $value == 0 && $this->options['empty_zero']) {
        return '';
      }

      // Set the price format.
      $value = basic_cart_price_format($value);
      return theme('basic_cart_price', array(
        'price' => $value,
      ));
    }
  }
}