You are here

function template_preprocess_amazon_views_view_row_item in Amazon Product Advertisement API 7.2

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

Template helper for theme_amazon_views_view_row_item

File

./amazon.module, line 1062

Code

function template_preprocess_amazon_views_view_row_item(&$vars) {
  $options = $vars['options'];
  $vars['amazon_item'] = '';

  // make sure var is defined.
  $asin = $vars['row']->asin;
  $locale = $vars['row']->locale;
  $items = amazon_item_lookup($asin, $locale);
  if (empty($items[$asin])) {
    return;
  }
  else {
    $item = $items[$asin];
    $item['view'] = $vars['view'];
    $vars['amazon_item'] = $item;
    if ($options['display_format'] == 'inline') {
      $vars['content'] = theme('amazon_item_inline', array(
        'item' => $item,
        'style' => $options['display_format'],
      ));
    }
    else {
      $vars['content'] = theme('amazon_item', array(
        'item' => $item,
        'style' => $options['display_format'],
      ));
    }
  }
}