You are here

uc_product_handler_field_buyitnow.inc in Ubercart 7.3

Same filename and directory in other branches
  1. 6.2 uc_product/views/uc_product_handler_field_buyitnow.inc

Views handler: Simpler "Add to cart" form as a field.

File

uc_product/views/uc_product_handler_field_buyitnow.inc
View source
<?php

/**
 * @file
 * Views handler: Simpler "Add to cart" form as a field.
 */

/**
 * Displays the simpler Add to cart form like the catalog.
 */
class uc_product_handler_field_buyitnow extends views_handler_field {

  /**
   * Overrides views_handler_field::query().
   */
  function query() {
    $this
      ->ensure_my_table();
    $this
      ->add_additional_fields();
  }

  /**
   * Overrides views_handler_field::render().
   */
  function render($values) {
    $product = node_load($values->{$this->aliases['nid']});
    if (uc_product_is_product($product)) {
      $form = drupal_get_form('uc_catalog_buy_it_now_form_' . $values->{$this->aliases['nid']}, $product);
      return drupal_render($form);
    }
  }

}

Classes

Namesort descending Description
uc_product_handler_field_buyitnow Displays the simpler Add to cart form like the catalog.