You are here

function _amazon_load_child_data in Amazon Product Advertisement API 6

Same name and namespace in other branches
  1. 7.2 amazon.module \_amazon_load_child_data()
  2. 7 amazon.module \_amazon_load_child_data()

Load participant, image, editorial_review data into database.

Parameters

$item: Amazon data structure.

1 call to _amazon_load_child_data()
amazon_item_lookup_from_db in ./amazon.module
Look up ASINs in database and return arrays of information keyed by ASIN.

File

./amazon.module, line 419

Code

function _amazon_load_child_data(&$item) {
  $result = db_query("SELECT type, participant FROM {amazon_item_participant} WHERE asin = '%s'", $item['asin']);
  while ($participant = db_fetch_array($result)) {
    unset($participant['asin']);
    $item[$participant['type']][] = $participant['participant'];
    $item['participants'][] = $participant['participant'];
  }
  $result = db_query("SELECT * FROM {amazon_item_image} WHERE asin = '%s'", $item['asin']);
  while ($image = db_fetch_array($result)) {
    unset($image['asin']);
    $item['imagesets'][$image['size']] = $image;
  }
  $result = db_query("SELECT * FROM {amazon_item_editorial_review} WHERE asin = '%s'", $item['asin']);
  while ($review = db_fetch_array($result)) {
    unset($review['asin']);
    $item['editorialreviews'][] = $review;
  }
}