After a bunch of time and work i cant find a solution for myself to get what i need.
What i need is some more fields - datas when i enter a valid isbn number.
I've tried alot and all fields are displayed but the connection to amazon api semas not to work cause all fields i have added dont give any output, means no results. Perhaps i am missing something.
The system is running with latest xampp and a drupal installation of the latest stable version and the last amazon module version and all other needed module - extensions.
Ok what i have done.
one sample of adding the "TotalNew" field - supported from the amazon api:
1. Altered the database to add field "totalnew" , type "int(10). Attribute "unsigned". Null "Yes". Standard"NULL".
2. Edited amazon.install at function amazon schema() and added
'totalnew' => array('type' => 'int', 'unsigned' => TRUE),
3. Edited amazon.module at function item_clean_xml and added
$item['totalnew'] = (string)$xml->TotalNew;
(perhaps the ResponseGroup should be added there like)
$item['totalnew'] = (string)$xml->OfferSummary->Offer[0]->OfferListing->TotalNew;
4. Edited amazon.module at function amazon token list and added
$tokens['amazon_item']['totalnew'] = t("The product's Total New Char");
5. Edited amazon.module at funczion amazon token values and added
$values['totalnew'] = check_plain($item['totalnew']);
6. Edited amazon_filter\amazon_filter.module and added
totalnew, after salesrank
7. Edited amazon\includes\amazon.views.inc and added
_amazon_make_simple_number_field($data, 'amazon_item', 'totalnew', 'Total New', 'The current total new ranking of the product on Amazon.com.');
ok thats it, am i missing something?
the result is the field "Total New" is there without any errors but display is empty.
a little help would be great.
PS. and thats not the only field i have tried to add,... all with no output :-(
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | amazon_item_data.jpg | 353.67 KB | carpenoctem414 |
| #2 | amazon_item_table.jpg | 480.36 KB | carpenoctem414 |
| #2 | amazon_item_xml.jpg | 247.95 KB | carpenoctem414 |
Comments
Comment #1
rfayAdding new fields to views is pretty easy, assuming that the data is in the XML returned.
1. Did the data you want come in the XML from Amazon?
2. Look in the database. Did the field get populated in amazon_item table?
3. Make sure you've cleaned the Amazon Item table, because if you're working from something already cached, it won't be there!
Just some ideas.
Comment #2
carpenoctem414 commentedHello,
the data i want comes in xml from amazon, i assume.
when i make an http request at developer.amazon i get the xml output with "totalnew" datas , see screenshot amazon_item_xml.
the field "totalnew" is also shown in the database, see screenshot of amazon_item_table.
What do you mean with "...cleaned Amazon Item tabel". Deleting all entries, bevor trying out the new field?
Fact the field is shown in the amazon_example_view but for all products with "0" filled? And i really dont know why, and how to get those datas.
Comment #3
rfayIf you're seeing the data in the table, then you don't need to empty the amazon_item table.
I recommend that you upload a patch. I may or may not be able to help you finish this.
Assuming that you have successfully gotten the data into the database, then this *should be* a matter of copying the existing fields.
Comment #4
carpenoctem414 commentedHey, i dont see the data in the table, for every call i make i get "NULL" back in the filed "totalnew" like all other fields i have tried to add.
See please screenshot.
Ok if you recommend a batch i will write one, but all i have done,changed i have descripted above with codesnippets.
Thanks for your time and help
Comment #5
rfayYes, if the data isn't getting into the table, then you have to make that happen first.
In that case, if you haven't emptied the amazon_item table, then you could just be living with cached data in there, and that will cause you pain. I think you can just truncate amazon_item and then visit some of the nodes that have data and you'll refresh it. Then see if the data is in the database.
Comment #6
carpenoctem414 commentedok thank you but that wasn the clou, have emtptied amazon_item table and visited some nodes with data, refreshed them. But i cant get the needed datas also by creating new nodes with new calls and new ASIN's. The problem should be the call then perhaps.
i will tomorrow write a batch how i try to add fields.
Thanks in advance.
Comment #7
carpenoctem414 commentedi am not able/allowed to run the diff command here--so i am not able to create a patch file , damn
arent there any solutions to add one more field to amazon module without using patches?
only need the neccessary file chances
problem win vista with no administrator access
just one sample of adding new field will help me out.
Comment #8
rfayThe reason to create a patch is so you can share it for people to comment on and help you. It's not a way for you to fix it.
You can also pastebin what you've been doing, but that's kind of awkward.
But the reality is you're going to have to debug it yourself, because it's a project you're undertaking.
Comment #9
carpenoctem414 commentedi will share it--no problem
i know the community thoughts--worked a lot with e107 cms and have had the german community site for a long time
if i would able to write a patch prompt i would do it
and it isnt only a request for me, i think, a "how to" add new fields to amazon_module, would be great also for other users
remember--it is easy to add new fields, as you told, but the fields dont give anything back with the call to amazon api--thats my problem.
Comment #10
carpenoctem414 commentedOk i have got it :-) with one little problem.
here is the call for ISBN 3897214857 at admin/settings/amazon/test
Added , TotalNew,TotalUsed,LowestUsedPrice and LowestNewPrice
All needed data's are outputted and displayed here.
But when i make the same call at ..node/add/amazon-example
I also get nearly all datas displayed without the "TotalUsed" -Value- there it shows "0" as result, and i dont know why.
If i solve the problem i will share it here for sure.
a little help would be great.