You are here

function uc_product_get_attributes in Ubercart 7.3

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

Loads all attributes associated with a product node.

Parameters

int $nid: The product node id.

Return value

array The attributes.

8 calls to uc_product_get_attributes()
UbercartCartLinksTestCase::createValidCartLinks in uc_cart_links/tests/uc_cart_links.test
Creates Cart Links pointing to the given product(s).
uc_attribute_node_load in uc_attribute/uc_attribute.module
Implements hook_node_load().
uc_attribute_node_update_index in uc_attribute/uc_attribute.module
Implements hook_node_update_index().
uc_catalog_buy_it_now_form_validate in uc_product/uc_product.module
Redirects to the product page if attributes need to be selected.
uc_object_attributes_form in uc_attribute/uc_attribute.admin.inc
Form to associate attributes with products or classes.

... See full list

File

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

Code

function uc_product_get_attributes($nid) {
  $attributes = array();
  $result = db_query("SELECT upa.aid FROM {uc_product_attributes} upa LEFT JOIN {uc_attributes} ua ON upa.aid = ua.aid WHERE upa.nid = :nid ORDER BY upa.ordering, ua.name", array(
    ':nid' => $nid,
  ));
  foreach ($result as $attribute) {
    $attributes[$attribute->aid] = uc_attribute_load($attribute->aid, $nid, 'product');
  }
  return $attributes;
}