You are here

function amazon_search_simple_search in Amazon Product Advertisement API 7.2

Same name and namespace in other branches
  1. 6 amazon_search/amazon_search.module \amazon_search_simple_search()
  2. 7 amazon_search/amazon_search.module \amazon_search_simple_search()

Perform the search.

Parameters

$keywords: Keywords to be provided to Amazon.

$parameters: Optional extra parameters to be passed to the Amazon API.

Return value

Array of Amazon items.

1 call to amazon_search_simple_search()
amazon_search_search_execute in amazon_search/amazon_search.module
Implements hook_search_execute(). Implements remote Amazon searching.

File

amazon_search/amazon_search.module, line 66
Sets up hook_search for Amazon items.

Code

function amazon_search_simple_search($keywords = '', $parameters = array(), $locale = NULL) {
  $parameters += array(
    'ResponseGroup' => 'Large',
    'SearchIndex' => 'All',
  );
  $parameters['Keywords'] = $keywords;
  drupal_alter('amazon_search_parameters', $parameters);
  $items = array();
  $results = amazon_http_request('ItemSearch', $parameters, $locale);
  foreach ($results->Items->Item as $xml) {
    $item = amazon_item_clean_xml($xml);
    $items[$item['asin']] = $item;
  }
  return $items;
}