function amazon_item_lookup in Amazon Product Advertisement API 6
Same name and namespace in other branches
- 7.2 amazon.module \amazon_item_lookup()
- 7 amazon.module \amazon_item_lookup()
Look up an item using database or web. The default is to look in the database for existing data, and then to do the web search if that fails. $force_lookup==TRUE forces going to Amazon's API.
Parameters
$item_ids: An array of ASIN strings or a single ASIN as a string.
$force_lookup: If TRUE, skip the database lookup and just go to the Amazon API lookup.
Return value
array Array of "cleaned" XML item descriptions, keyed on ASIN.
9 calls to amazon_item_lookup()
- asin_token_values in asin/
asin.module - Implementation of hook_token_values()
- template_preprocess_amazon_views_view_row_item in ./
amazon.module - Template helper for theme_amazon_views_view_row_item
- theme_asin_formatter_default in asin/
asin.module - Theme function for 'default' asin field formatter, appropriate for general use and product listings.
- theme_asin_formatter_details in asin/
asin.module - Theme function for 'full' asin field formatter, appropriate for product highlighting and display.
- theme_asin_formatter_inline in asin/
asin.module - Theme function for 'inline' asin field formatter, appropriate for quick title lists, etc.
File
- ./
amazon.module, line 300
Code
function amazon_item_lookup($item_ids = array(), $force_lookup = FALSE) {
if (empty($item_ids)) {
return array();
}
if (is_string($item_ids)) {
$item_ids = array(
$item_ids,
);
}
$items = array();
if (!$force_lookup) {
$items = amazon_item_lookup_from_db($item_ids);
}
$items_to_fetch = array();
foreach ($item_ids as $item_id) {
if (!isset($items[$item_id])) {
$items_to_fetch[] = $item_id;
}
}
$items_from_web = amazon_item_lookup_from_web($items_to_fetch);
$full_set = $items + $items_from_web;
return $full_set;
}