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 :-(

Comments

rfay’s picture

Title: adding fields problem with related output » Adding "Total New" and other fields to views
Category: support » feature

Adding 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.

carpenoctem414’s picture

StatusFileSize
new247.95 KB
new480.36 KB

Hello,

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.

rfay’s picture

If 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.

carpenoctem414’s picture

StatusFileSize
new353.67 KB

Hey, 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

rfay’s picture

Yes, 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.

carpenoctem414’s picture

ok 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.

carpenoctem414’s picture

i 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.

rfay’s picture

The 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.

carpenoctem414’s picture

i 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.

carpenoctem414’s picture

Ok 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

Array
(
    [asin] => 3897214857
    [isbn] => 3897214857
    [ean] => 9783897214859
    [salesrank] => 28922
    [totalnew] => 64
    [totalused] => 6
    [detailpageurl] => http://www.amazon.de/Praxiswissen-Drupal-6-oreillys-basics/dp/3897214857%3FSubscriptionId%3DAKIAJA3HMA4JSGKJW7FQ%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D3897214857
    [listpriceamount] => 2490
    [listpricecurrencycode] => EUR
    [listpriceformattedprice] => EUR 24,90
    [lowestusedpriceamount] => 1699
    [lowestusedpricecurrencycode] => EUR
    [lowestusedpriceformattedprice] => EUR 16,99
    [lowestnewpriceamount] => 1990
    [lowestnewpricecurrencycode] => EUR
    [lowestnewpriceformattedprice] => EUR 19,90
    [binding] => Broschiert
    [edition] => 1
    [label] => O'Reilly Verlag
    [manufacturer] => O'Reilly Verlag
    [numberofpages] => 240
    [productgroup] => Book
    [producttypename] => ABIS_BOOK
    [publicationdate] => 2008-10-30
    [publisher] => O'Reilly Verlag
    [studio] => O'Reilly Verlag
    [title] => Praxiswissen Drupal 6. oreillys basics
......

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.