You are here

function amazon_versions_amazon_item_insert in Amazon Product Advertisement API 6

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

Implementation of hook_amazon_item_insert().

File

amazon_versions/amazon_versions.module, line 63

Code

function amazon_versions_amazon_item_insert($item) {
  if (empty($item['alternateversions'])) {
    return;
  }
  $delta = 0;
  foreach ($item['alternateversions'] as $version) {
    $version['item'] = $item['asin'];
    $version['delta'] = $delta;
    drupal_write_record('amazon_versions', $version);
    ++$delta;
  }
}