You are here

function uc_attribute_priced_attributes in Ubercart 5

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

Get the price affecting attributes for a product

Parameters

$nid: The nid of a product.

Return value

Array of attribute ids that have price affecting options.

1 call to uc_attribute_priced_attributes()
_uc_attribute_alter_form in uc_attribute/uc_attribute.module
Helper function for uc_attribute_form_alter()

File

uc_attribute/uc_attribute.module, line 1594

Code

function uc_attribute_priced_attributes($nid) {
  $attributes = db_query("SELECT DISTINCT (pa.aid) FROM {uc_product_attributes} AS pa INNER JOIN {uc_attribute_options} AS ao ON ao.aid = pa.aid INNER JOIN {uc_product_options} AS po ON (po.oid = ao.oid AND po.nid = pa.nid) WHERE pa.nid = %d AND po.price <> 0 AND pa.display <> 0", $nid);
  $aids = array();
  while ($attribute = db_fetch_array($attributes)) {
    $aids[] = $attribute['aid'];
  }
  return $aids;
}