function amazon_similar_amazon_item_load in Amazon Product Advertisement API 6
Same name and namespace in other branches
- 7.2 amazon_similar/amazon_similar.module \amazon_similar_amazon_item_load()
- 7 amazon_similar/amazon_similar.module \amazon_similar_amazon_item_load()
Implementation of hook_amazon_item_load().
File
- amazon_similar/
amazon_similar.module, line 33
Code
function amazon_similar_amazon_item_load($item) {
$alternates = array();
$item_ids = array();
$result = db_query("SELECT asin, title FROM {amazon_similar} WHERE item = '%s' ORDER BY delta ASC", $item['asin']);
while ($version = db_fetch_array($result)) {
$alternates[] = $version;
$item_ids[] = $version['asin'];
}
if (module_exists('amazon_import')) {
$node_ids = amazon_import_get_product_nodes($item_ids);
foreach ($alternates as $key => $version) {
if (!empty($node_ids[$version['asin']])) {
$alternates[$key]['nid'] = $node_ids[$version['asin']];
}
}
}
$additions['similarproducts'] = $alternates;
if (isset($additions)) {
return $additions;
}
}