You are here

function amazon_media_amazon_item_insert in Amazon Product Advertisement API 6

Same name and namespace in other branches
  1. 7.2 amazon_media/amazon_media.module \amazon_media_amazon_item_insert()
  2. 7 amazon_media/amazon_media.module \amazon_media_amazon_item_insert()

File

amazon_media/amazon_media.module, line 94

Code

function amazon_media_amazon_item_insert($item) {
  switch ($item['producttypename']) {
    case 'ABIS_BOOK':
    case 'BOOKS_1973_AND_LATER':
      drupal_write_record('amazon_book', $item);
      break;
    case 'VIDEO_DVD':
    case 'ABIS_DVD':
      drupal_write_record('amazon_dvd', $item);
      break;
    case 'ABIS_MUSIC':

      // Often the artist is an array.
      if (!empty($item['artist']) && is_array($item['artist'])) {
        $item['artist'] = join(",", $item['artist']);
      }
      drupal_write_record('amazon_music', $item);
      break;
    case 'CONSOLE_VIDEO_GAMES':
    case 'VIDEO_GAMES':
    case 'SOFTWARE':
      drupal_write_record('amazon_software', $item);
      break;
  }
}