You are here

function hook_uc_product_models in Ubercart 6.2

Same name and namespace in other branches
  1. 8.4 uc_product/uc_product.api.php \hook_uc_product_models()
  2. 7.3 uc_product/uc_product.api.php \hook_uc_product_models()

Notifies core of any SKUs your module adds to a given node.

NOTE: DO NOT map the array keys, as the possibility for numeric SKUs exists, and this will conflict with the behavior of module_invoke_all(), specifically array_merge_recursive().

Code lifted from uc_attribute.module.

1 function implements hook_uc_product_models()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

uc_attribute_uc_product_models in uc_attribute/uc_attribute.module
Implements hook_uc_product_models().
1 invocation of hook_uc_product_models()
uc_product_get_models in uc_product/uc_product.module
Gets all models of a product (node).

File

docs/hooks.php, line 1729
These are the hooks that are invoked by the Ubercart core.

Code

function hook_uc_product_models($nid) {
  $models = array();

  // Get all the SKUs for all the attributes on this node.
  $adjustments = db_query("SELECT DISTINCT model FROM {uc_product_adjustments} WHERE nid = %d", $nid);
  while ($adjustment = db_result($adjustments)) {
    $models[] = $adjustment;
  }
  return $models;
}