You are here

function uc_product_load_variant in Ubercart 7.3

Same name and namespace in other branches
  1. 8.4 uc_product/uc_product.module \uc_product_load_variant()

Loads a specific altered variant of a product node.

The (possibly cached) base product remains unaltered.

Parameters

$nid: The nid of the product to load.

$data: Optional data to add to the product before invoking the alter hooks.

Return value

A variant of the product, altered based on the provided data, or FALSE if the node is not found.

10 calls to uc_product_load_variant()
UcCartItemController::attachLoad in uc_cart/uc_cart.controller.inc
Overrides EntityAPIController::attachLoad().
uc_order_add_product_form in uc_order/uc_order.order_pane.inc
Sets the quantity and attributes of a product added to the order.
uc_order_edit_products_add in uc_order/uc_order.order_pane.inc
Form submit callback: add a product to an order.
uc_product_add_to_cart_form in uc_product/uc_product.module
Form to add the $node product to the cart.
uc_product_add_to_cart_form_validate in uc_product/uc_product.module
Form validation handler for uc_product_add_to_cart_form().

... See full list

File

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

Code

function uc_product_load_variant($nid, $data = FALSE) {
  if ($node = node_load($nid)) {
    return _uc_product_get_variant($node, $data);
  }
  else {
    return FALSE;
  }
}