You are here

function amazon_versions_amazon_item_load in Amazon Product Advertisement API 7

Same name and namespace in other branches
  1. 6 amazon_versions/amazon_versions.module \amazon_versions_amazon_item_load()
  2. 7.2 amazon_versions/amazon_versions.module \amazon_versions_amazon_item_load()

Implements hook_amazon_item_load().

File

amazon_versions/amazon_versions.module, line 34
amazon_versions.module Retrieves and stores a list of alternate ASIN numbers for each product.

Code

function amazon_versions_amazon_item_load($item) {
  $alternates = array();
  $item_ids = array();
  $result = db_query("SELECT asin, title, binding FROM {amazon_versions} WHERE item = :item ORDER BY delta ASC", array(
    ':item' => $item['asin'],
  ));
  foreach ($result as $version) {
    $alternates[] = $version;
    $item_ids[] = $version->asin;
  }
  $additions['alternateversions'] = $alternates;
  if (isset($additions)) {
    return $additions;
  }
}