Needs work
Project:
Amazon Product Advertisement API
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
4 Jan 2011 at 03:51 UTC
Updated:
21 Aug 2015 at 23:28 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
rfayAre you using tokens in D7 Amazon? I've never figured out how to use them, so have considered removing the support. However, since there is an open issue that would let you select which field tokens come from in D7 it might end up being useful.
Please explain how you're using tokens, and maybe we can find a path forward with them.
Edit: See #691078: Field tokens
Comment #2
jdleonardI'm not actually using them, but I was looking over the code and noticed the discrepancy.
Comment #3
rfayPatches are welcome! And a useful use for tokens with Amazon is *way* welcome.
Comment #4
panchoI'm gonna take a look at this.the next days.
Comment #5
rfayWith tokens, we need correct behavior *and* instructions on the documentation page about how one might use them. I think the field tokens patch is getting closer, and it may require that. #691078: Field tokens.
Comment #6
panchoToken support currently doesn't work at all, cause the API has completely changed in D7.
Making it work is unfortunately non-trivial.
Supporting amazon_field (aka asin.module) with tokens requires #691078: Field tokens to be committed at least to contrib token module, so in any case we'd still have the dependency on that. Don't know about amazon_filter, however the problem seems to be that 1:n relations can't be currently mapped, so it's reasonable to put this on hold, too.
While making token support work for amazon_store is indeed possible, it comes for free with using the Entity API, which is anyway planned. So first of all, it makes sense to remove the non-working token code from 7.x-1, then we proceed to #1047642: Use Entity API in amazon_media, and then we come back here.
Removed non-working token support on commit: http://drupal.org/cvs?commit=500940
Comment #7
Taxoman commentedSubscribing
Comment #8
michelle@Pancho: It's been 1.5 years... Is this still in the works or did it get dropped?
Comment #9
smitty commentedAs far as I can see the token module provides already a token-support for every asin-field which is added to a document type. And the best is: This seems to work!
BUT: This token uses one of the amazon asin-formatters, which all return html-code. And because in the metadata-module a strip_tags is used in the end, the return value seems to be empty there.
So all we need is one or more additional formatters (one of them defined as default_token_formatter as described in http://drupal.org/node/1252608) which delivers the asin as plain text, the title of the asin field or the url of the amazon cover (e.g. for the og:image metatag) and then we can choose which value we want to use as described in http://drupal.org/node/1299662.
Because I am not experienced with all the formatter stuff, I made a (really) quick and dirty solution for my project and inserted two tokens which deliver the plain text of the asin and the image url for one field_asin I put into my documenttyp. The code is not optimised at all and may not be correct in terms of the token module; but for me it works.
Perhaps someone having the same problems finds this helpful:
Improvements welcome!
Comment #10
marcoka commentedi use the token support and it is a LOT useful. like using it for captions
<span class="single-image-caption">[amazon B0013BXFLG inline]</span>or to link a whole image to the amazon url just by providing ASIN
[amazon B0013BXFLG detailpageurl]only problem is that the tokens are with spaces. a lot of filters and wysiwyg will add a instead of spaces:
[amazon B0013BXFLG detailpageurl] becomes [amazon%20B0013BXFLG%20detailpageurl]Comment #11
willvincent commentede-anima, that's the amazon_filter, not tokens.
Tokens are for accessing specific amazon data fields.
Comment #12
willvincent commentedThis patch adds a new formatter type for the asin field for ASIN as plain text. This is also set to be the default token value.
I'll be working through adding other tokens as well, but this will work as the default field token that's already handled by token module.
So, if for example, you had a content type with a field with the machine name: field_amazon_item, the token [node:field_amazon_item] will output just the plain text asin value stored in that field.
This change has been commit to the 7.x-1.x branch
Comment #13
willvincent commentedComment #14
kihap commentedHello, willvincent & pancho. Any luck getting additional tokens working for D7?