You are here

function uc_attribute_uc_product_models in Ubercart 8.4

Same name and namespace in other branches
  1. 6.2 uc_attribute/uc_attribute.module \uc_attribute_uc_product_models()
  2. 7.3 uc_attribute/uc_attribute.module \uc_attribute_uc_product_models()

Implements hook_uc_product_models().

Parameters

int $nid: Node number for product type node.

Return value

array Array of SKUs (model numbers) for this $nid.

File

uc_attribute/uc_attribute.module, line 296
Ubercart Attribute module.

Code

function uc_attribute_uc_product_models($nid) {

  // Get all the SKUs for all the attributes on this node.
  $connection = \Drupal::database();
  $models = $connection
    ->query("SELECT DISTINCT model FROM {uc_product_adjustments} WHERE nid = :nid", [
    ':nid' => $nid,
  ])
    ->fetchCol();
  return $models;
}