function uc_stock_skus in Ubercart 5
Gets the SKUs associated with a particular product.
@return: An array containing all the SKUs that are associated with the product or FALSE if the node ID isn't an Ubercart product.
Parameters
$nid: The node id of the ubercart product
1 call to uc_stock_skus()
- uc_stock_edit_form in uc_stock/
uc_stock.module
File
- uc_stock/
uc_stock.module, line 373
Code
function uc_stock_skus($nid) {
$node = node_load($nid);
if (is_null($node->model)) {
return FALSE;
}
$skus = array(
$node->model,
);
if (module_exists('uc_attribute')) {
$models = db_query("SELECT model FROM {uc_product_adjustments} WHERE nid = %d", $node->nid);
while ($model = db_fetch_object($models)) {
if (!in_array($model->model, $skus)) {
$skus[] = $model->model;
}
}
}
return $skus;
}