You are here

discounted_price_handler.inc in Ubercart Discounts (Alternative) 7.2

Same filename and directory in other branches
  1. 6.2 product_price_alterer_field/includes/discounted_price_handler.inc

Views handler integration for product_price_alterer_field module.

File

product_price_alterer_field/includes/discounted_price_handler.inc
View source
<?php

/**
 * @file
 * Views handler integration for product_price_alterer_field module.
 */

/**
 * Renders a discounted price field.
 *
 * @ingroup views_field_handlers
 */
class discounted_price_handler extends views_handler_field {
  function query() {
    $this
      ->ensure_my_table();
    $this
      ->add_additional_fields();
  }
  function render($values) {
    $node = node_load($values->{$this->aliases['nid']});
    $discounted_price = uc_discounts_get_discounted_price_for_product($node);
    if (is_null($discounted_price)) {
      return NULL;
    }
    $output = theme('product_discounted_price', $node, uc_currency_format($discounted_price));
    add_product_price_altering_css($node);
    add_product_price_altering_javascript($node);
    return check_plain($output);
  }

}

Classes

Namesort descending Description
discounted_price_handler Renders a discounted price field.