You are here

function amazon_ean_to_asin in Amazon Product Advertisement API 6

Same name and namespace in other branches
  1. 7.2 amazon.module \amazon_ean_to_asin()
  2. 7 amazon.module \amazon_ean_to_asin()

Given an EAN (ISBN-13), try to get Amazon to give it to us.

Parameters

$ean: The EAN, ISBN-13 value

Return value

The asin, or NULL if unsuccessful.

See also

https://affiliate-program.amazon.com/gp/associates/help/t5/a16?ie=UTF8&p...

1 call to amazon_ean_to_asin()
amazon_convert_to_asin in ./amazon.module
Try to turn a non-asin into an ASIN where possible.

File

./amazon.module, line 673

Code

function amazon_ean_to_asin($ean) {
  $asin = NULL;
  $params = array(
    'ItemId' => $ean,
    'IdType' => 'EAN',
    'SearchIndex' => 'Books',
  );
  $results = amazon_http_request('ItemLookup', $params);
  if (!empty($results->Items->Item->ASIN)) {
    $asin = (string) $results->Items->Item->ASIN;
  }
  return $asin;
}