Closed (fixed)
Project:
Amazon Product Advertisement API
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
5 Jul 2011 at 09:03 UTC
Updated:
22 Aug 2011 at 00:12 UTC
Jump to comment: Most recent file
Comments
Comment #1
rfayI'm unable to recreate this. Have you run update.php? Can you recreate this using the view provided with the Amazon Example feature and adding "all participants" to it? This also could be related to a specific ASIN you're using - perhaps you can figure that out.
Perhaps you could attach an export of the view you're using (or a feature (see Features module), if it's not based on the example view + content type)
Attached is a screenshot of a working view.
Comment #2
gmak commentedSomething is strange. I'm also getting the following error when I try to use the Feature Example that comes with the module:
Notice: Undefined index: detailpageurl in views_handler_field->get_value() (line 337...This error repeats 4 times.
On the 'All Participants' issue, I have a attached a feature dump of the view.
Hope we can figure this out.
Comment #3
rfayComment #4
rfaySorry, you'll have to include the content type in the feature; I can't use this as it is.
If you could also provide at least a few of the ASINs that you're using, that would be useful, since it may be related to the ASIN you're using.
If you want to provide me a database, you can attach the database dump or send it to me or send me a dropbox link - randy at randyfay.com
Comment #5
gmak commentedSorry. That was the first time I'd ever tried to create a feature.
Attached is the field, content-type, and view.
Here are some of ASIN's I'm using:
0415571936
0631181776
0747597480
The issue happens with all of these.
Thanks
Comment #6
rfaySorry, your view doesn't have any fields and doesn't have the relationship that would be required.
Could you please start with the Amazon Example view and demonstrate this problem using that? Documentation on how to create a view and the necessary relationships is at http://drupal.org/node/595464
I've attached a screenshot of what your view looks like.
Comment #7
gmak commentedThere must be something wrong with the way I setup the feature, because my view definitely has fields (see attached).
I'll try with the example as well.
Comment #8
gmak commentedWorking with the Example View:
1. I add a piece of content using the Amazon Example content type.
2. I visit /amazon_example_view and get:
Notice: Undefined index: detailpageurl in views_handler_field->get_value() (line 337 of /home/ospi/public_html/sites/all/modules/views/handlers/views_handler_field.inc)., but the view displays OK.3. I edit the amazon example view, adding the All Participants field and get the same SQL error at the start of this issue.
Comment #9
rfayHmm. Well, that's what I did originally, and it worked fine. I just did it again, making sure I had at least one of your examples. See the attached.
Are you using a recent version of views? Have you run update.php? Can you recreate this problem on a fresh install?
Comment #10
gmak commentedAmazon - 7.x-1.x-dev
Views - 7.x-3.x-dev
According to both Drupal installation (7.4) and Drush, there are no database updates pending.
Comment #11
gmak commentedOK, a bit more.
I've done a clean install of D7.4. I have not enabled any of the core modules other than those that are activated on initial installation. In addition, I have installed:
Amazon 7.x-1.x-dev
Views 7.x-3.x-dev
CTools 7.x-1.0-beta1
Features 7.x-1.0-beta3
Strongarm 7.x-2.0-beta2
Views 7.x-3.x-dev
1. Add Amazon Example content (using ASIN 0631181776)
2. Upon submitting the content creation form, I get
Notice: Undefined index: detailpageurl in views_handler_field->get_value() (line 337 of /home/ospi/public_html/testbed/sites/all/modules/views/handlers/views_handler_field.inc).3. Visiting /amazon_example_view, shows the content.
4. Edit the view, adding the All Participants field, throws the error:
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '))' at line 1: SELECT aip.participant AS participant, aip.asin AS asin FROM {amazon_item_participant} aip WHERE (asin IN ()) ; Array ( ) in views_handler_field_amazon_participant->pre_render() (line 61 of /home/ospi/public_html/testbed/sites/all/modules/amazon/includes/views_handler_field_amazon_participant.inc)Comment #12
rfayWell, send me the database of the clean install you did. See #4.
Comment #13
gmak commentedHere you go.
Comment #14
rfayInstalled your database. Added a field to the view. Worked fine. Result is attached.
What version of mysql are you using, and on what platform?
BTW, the detailpageurl thing is something we've spent a lot of time on but haven't successfully nailed. Not related.
Comment #15
rfayWhen you select "All participants", it then gives the option of not showing all participants. At each point I've been just keeping the default "all participants". Is that the same as what you're doing?
Comment #16
gmak commentedMysql Server Version 5.1.49-3
Mysql Client Version 5.1.49
PHP Version 5.3.3-7+squeeze3
OS Debian 6
Comment #17
gmak commentedI've not been changing any of the default settings for the All Participants field.
Comment #18
rfayAha! My sandbox hadn't had a views update for awhile. With the views update, I get the error! Yay.
Comment #19
rfayThis is the code that fails:
The reason it fails is that
returns array(0).
So something has shifted again in how Views does these things. I'll ask dereine for the magic incantation.
Comment #20
rfaySee #1145770-12: Helper function for getting raw and rendered field data
Comment #21
gmak commentedWhat a relief! I was getting to that point where I was beginning to think that I'd got some really obscure, undiagnosable, (and almost certainly silly) configuration issue.
Please let me know when there is a fix.
And, thanks for such rapid assistance!
Comment #22
timb commentedI ran into this today also. Glad to see that someone is already on it.
Comment #23
rfayConversation with merlinofchaos:
Unfortunately, I tried the two quick fixes with no luck.
Comment #25
gmak commentedAny news on this one?
Comment #26
rfayI haven't gotten back to it, but #23 has the blueprint. Patches are welcome.
Comment #27
cwithout commentedI started a patch for this today. So far, I've eliminated the SQL error and am getting the names of the participants appearing in Views. I still have yet to test the tokens things that merlin described.
No more time to work on it today, but I just wanted to post the status so somebody else doesn't waste their time duplicating the work in the mean time. Should be ready tomorrow (unless something comes up that keeps me from it). If the token thing doesn't work, I'll probably post the patch without it, since it doesn't seem to be something necessary but additional functionality that the other field handlers in this module may not have either.
Comment #28
rfayGreat! You can assign it to yourself in that case... Thanks for your effort!
Comment #29
cwithout commentedHere's the patch to fix the error and show All Participants in views. I think merlin was speaking in general about reducing the code in pre_render, because there's not a lot there. At least not any more than for user roles. I added a conditional check but there was nothing I could see that could be removed.
This also includes the self tokens. I set it to have name and type as self tokens. Technically, I think that could be considered adding a feature, but it's a fairly small change, so I included it with the bug fix. If I need to split it into seperate patches, I can do that.
I didn't find a lot of info on self tokens, but it appears you can use them in the "rewrite results" for the field itself. You cant' use them as tokens in other fields.
Comment #30
rfayWow, it applies, it works on a casual test! Thanks for the great work.
I would appreciate if you'd take the tokens out and add a new feature request that does all the views fields; It doesn't seem to make sense to do it just here right now - I'm sure open to having them everywhere. And, of course, we have an issue open about adding token support back in.
Comment #31
rfayAnd @dereine says it looks fine! So wow, congratulations, and thanks.
Comment #32
cwithout commentedNo problem, but after further looking over views handlers, I don't think the change for the self tokens would be applicable to any of this module's fields but this one. The only fields that use it in Views are the ones that extend views_handler_field_prerender_list.
Also, it appears Views employs its own token system that's unrelated to the other Token issue, which doesn't affect the views field handler. All the fields currently have functional Views tokens. They don't need any changes.
Do you still want me to open a separate issue for it, since it would only apply to this field?
Comment #33
rfay@cristinawithout, if you think this is an appropriate feature addition, and that it only goes with this field, I'm OK with it. Thanks!
Comment #34
cwithout commentedCool. I did a double check and confirmed the only views handlers using self tokens are those extending views_handler_field_prerender_list. So it doesn't apply to the rest of the fields.
For use reference, an example for self tokens would be if you want to not just display the name of the participant, but the participant type (author, actor, etc).
For ASIN B004QOB8QG the output for "[participants_all-name]: [participants_all-type]" would look like:
Or setting the rewrite to "[participants_all-name] ([participants_all-type])" would look like:
Comment #35
rfayI am just waiting for one of the users who was bothered by this to test and RTBC it :-)
Comment #36
rfayCommitted: b9ce422
Would appreciate if you could document the self-tokens by adding a little note to the documentation page
You are very welcome here. Thanks so much for taking this one on.
If you use Amazon module and would be interested in becoming a comaintainer, please let me know. It's pretty easy to arrange :-)
Comment #37
gmak commentedI can confirm that All Participants is now working. Thanks.