You are here

function amazon_similar_amazon_item_load in Amazon Product Advertisement API 7

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

Implements hook_amazon_item_load().

File

amazon_similar/amazon_similar.module, line 32
amazon_similar.module Retrieves and stores a list of similar ASIN numbers for each product.

Code

function amazon_similar_amazon_item_load($item) {
  $alternates = array();
  $item_ids = array();
  $result = db_query("SELECT asin, title FROM {amazon_similar} WHERE item = :item ORDER BY delta ASC", array(
    ':item' => $item['asin'],
  ));
  while ($version = $result
    ->fetchAssoc()) {
    $alternates[] = $version;
    $item_ids[] = $version['asin'];
  }
  $additions['similarproducts'] = $alternates;
  if (isset($additions)) {
    return $additions;
  }
}