function hook_uc_product_models in Ubercart 8.4
Same name and namespace in other branches
- 6.2 docs/hooks.php \hook_uc_product_models()
- 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 \Drupal::moduleHandler()->invokeAll(), specifically array_merge_recursive().
Code lifted from uc_attribute.module.
Parameters
int $nid: The product id.
Return value
array Array of product SKUs for this product id.
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 133 - 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", [
':nid' => $nid,
])
->fetchCol();
return $models;
}