You are here

function hook_uc_product_models in Ubercart 7.3

Same name and namespace in other branches
  1. 8.4 uc_product/uc_product.api.php \hook_uc_product_models()
  2. 6.2 docs/hooks.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

uc_product/uc_product.api.php, line 171
Hooks provided by the Product module.

Code

function hook_uc_product_models($nid) {

  // Get all the SKUs for all the attributes on this node.
  $models = db_query("SELECT DISTINCT model FROM {uc_product_adjustments} WHERE nid = :nid", array(
    ':nid' => $nid,
  ))
    ->fetchCol();
  return $models;
}