You are here

basic_cart_handler_field_addtocart.inc in Basic cart 7.2

Same filename and directory in other branches
  1. 7.3 views/basic_cart_handler_field_addtocart.inc

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

File

views/basic_cart_handler_field_addtocart.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 basic_cart_handler_field_addtocart 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) {
    if (basic_cart_is_product($values->{$this->aliases['type']})) {
      return basic_cart_add_to_cart_link($values->{$this->aliases['nid']});
    }
  }

}

Classes

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