You are here

function uc_product_load in Ubercart 7.3

Same name and namespace in other branches
  1. 5 uc_product/uc_product.module \uc_product_load()
  2. 6.2 uc_product/uc_product.module \uc_product_load()

Implements hook_load().

1 call to uc_product_load()
uc_product_kit_load in uc_product_kit/uc_product_kit.module
Implements hook_load().
1 string reference to 'uc_product_load'
uc_product_uc_product_alter in uc_product/uc_product.module
Implements hook_uc_product_alter().

File

uc_product/uc_product.module, line 572
The product module for Ubercart.

Code

function uc_product_load($nodes) {
  $vids = array();
  foreach ($nodes as $node) {
    $vids[$node->nid] = $node->vid;
  }
  $result = db_query('SELECT nid, model, list_price, cost, sell_price, weight, weight_units, length, width, height, length_units, pkg_qty, default_qty, ordering, shippable FROM {uc_products} WHERE vid IN (:vids)', array(
    ':vids' => $vids,
  ));
  foreach ($result as $node) {
    foreach ($node as $field => $value) {
      $nodes[$node->nid]->{$field} = $value;
    }
    $nodes[$node->nid]->price = $nodes[$node->nid]->sell_price;
  }
}