? .DS_Store ? amazon-tokens-572064.patch Index: amazon.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/amazon/amazon.module,v retrieving revision 1.27.2.32 diff -u -p -r1.27.2.32 amazon.module --- amazon.module 7 Nov 2010 21:15:02 -0000 1.27.2.32 +++ amazon.module 28 Jan 2011 02:30:42 -0000 @@ -849,6 +849,65 @@ function amazon_token_values($type, $obj } /** + * Implementation of hook_token_list + * make tokens available for fields + */ +function asin_token_list($type = 'all') { + if($type == 'field' || $type == 'all') { + $tokens = array(); + $tokens['asin']['asin'] = t('Product ID'); + $tokens['asin']['title'] = t('Title retrieved from Amazon.com'); + $values['asin']['isbn'] = t('The 10-digit ISBN (International Standard Book Number)'); + $values['asin']['ean'] = t('The EAN or 13-digit ISBN'); + $tokens['asin']['detailpageurl'] = t('The detail page URL for the item'); + $tokens['asin']['salesrank'] = t("The product's sales rank"); + $tokens['asin']['brand'] = t("The product's brand"); + $tokens['asin']['publisher'] = t("The product's publisher"); + $tokens['asin']['manufacturer'] = t("The product's manufacturer"); + $tokens['asin']['studio'] = t("The product's studio"); + $tokens['asin']['label'] = t("The product's label"); + $tokens['asin']['binding'] = t("The product's binding type"); + $tokens['asin']['releasedate'] = t("The product's release date"); + $tokens['asin']['listprice'] = t("The product's list price"); + $tokens['asin']['producttype'] = t("The product's Amazon product type"); + $values['asin']['lowestprice'] = t('The lowest price currently offered by any merchant at Amazon'); + $values['asin']['amazonprice'] = t('Current price offered by Amazon'); + return $tokens; + + } +} + +/** + * Implementation of hook_token_values + * make tokens available for fields + */ +function asin_token_values($type, $object = NULL, $options = array()) { + if ($type == 'field') { + $item = $object[0]; + $asin = amazon_convert_to_asin($item['asin']); + $amazonArr = amazon_item_lookup($asin); + $item = $amazonArr[$asin]; + $values['title'] = check_plain($item['title']); + $values['asin'] = check_plain($item['asin']); + $values['ean'] = check_plain($item['ean']); + $values['detailpageurl'] = check_url($item['detailpageurl']); + $values['salesrank'] = check_plain($item['salesrank']); + $values['brand'] = check_plain($item['brand']); + $values['publisher'] = check_plain($item['publisher']); + $values['manufacturer'] = check_plain($item['manufacturer']); + $values['studio'] = check_plain($item['studio']); + $values['label'] = check_plain($item['label']); + $values['binding'] = check_plain($item['binding']); + $values['releasedate'] = check_plain($item['releasedate']); + $values['listprice'] = check_plain($item['listpriceformattedprice']); + $values['producttype'] = check_plain($item['producttype']); + $values['lowestprice'] = check_plain($item['lowestpriceformattedprice']); + $values['amazonprice'] = check_plain($item['amazonpriceformattedprice']); + return $values; + } +} + +/** * Implementation of hook_views_api. */ function amazon_views_api() {