Page 1 of 1
Adding more categories to the Amazon Plugin
Posted: Tue Mar 14, 2006 5:47 pm
by cellounge
In the amazon plugin you can only search under 16 different catagories. How would you add the other 16 categories that are in Amazon's directories. For instance, I have a cell phone blog at
http://www.celllounge.com/cellphones I would like to use the amazon plugin there, but the cellphone category is not available.
Thanks in advance for your response.
Re: Adding more categories to the Amazon Plugin
Posted: Tue Mar 14, 2006 6:04 pm
by garvinhicking
For future questions like these, please use the "Plugins" forum. This "Development" forum is only meant for actual code contributions or actual code questions.
But on to your question:
I figure you're using the serendipity_event_amazonchooser plugin? That file contains this code:
Code: Select all
$mode= array(
'baby',
'books',
'classical',
'dvd',
'electronics',
'garden',
'kitchen',
'magazines',
'music',
'pc-hardware',
'photo',
'software',
'toys',
'universal',
'vhs',
'videogames'
);
So there you could easily enhance the $mode array. If you tell me the list of all names, I can also patch them to the plugin and committ it.
Best regards,
Garvin
Posted: Tue Mar 14, 2006 8:20 pm
by cellounge
Code: Select all
$mode= array(
'baby',
'books',
'cell phone',
'classical',
'dvd',
'electronics',
'garden',
'kitchen',
'magazines',
'music',
'pc-hardware',
'photo',
'software',
'toys',
'universal',
'vhs',
'videogames'
);
$mode_names = array (
'baby' => 'Baby',
'books' => 'Books',
'classical' => 'Classical Music',
'cell phone' => 'Cell Phones',
'dvd' => 'DVD',
'electronics' => 'Electronics',
'garden' => 'Outdoor Living',
'kitchen' => 'Kitchen & Housewares',
'magazines' => 'Magazines',
'music' => 'Popular Music',
'pc-hardware' => 'Computers',
'photo' => 'Camera & Photo',
'software' => 'Software',
'toys' => 'Toys & Games',
'universal' => 'Tools & Hardware',
'vhs' => 'Video',
'videogames' => 'Computer & Video Games'
);
When I put cell phones in this array I get kids bops results or wierd things not related to cell phones Did I code the array wrong?
List of all new categories that are needed?
Posted: Tue Mar 14, 2006 8:31 pm
by cellounge
1. Audio + Video
2. Cell Phones
3. Office Products
4. Musical instruments
5. Home + Garden
6. Automotive
7. Bed + Bath
8. Furniture and Decor
9. Gourmet Food
10. Pet Supplies
11. Apperall and accessories
12. Shoes
13. Jewelry and Watches
14. Beauty
15. Health and persoanl Care
16. Sports + Outdoors
Much appreciated, and by the way Serendipity is the best blogging software I have ever tried. It beats pmachine hands down!
Re: List of all new categories that are needed?
Posted: Wed Mar 15, 2006 12:28 pm
by garvinhicking
Hi!
Sadly it just seems that Amazon does not have a WebServer category name associated with it.
I am very sure that spaces are not allowed in category names. You might want to try "cell_phones" or "cellphones".
I browsed thorugh the Amazon site but could not find a definition in their API on how to map which category. Maybe you can find it.
If you google for "pc-hardware garden classical baby vhs amazon" you can see many code listings of similar snippets, but NONE of them contain cellphones...at least none of which i found.
Lastly, you could try to contact Amazon to ask them?
Best regards,
Garvin
Posted: Wed Mar 15, 2006 4:57 pm
by mgroeninger
Amazon's documentation is getting pretty dated, but the category list
here seems to be close to accurate. I don't have time to make any changes to the plugin right now, but I might be able to next week sometime...
Note that not all the servers support the full list of indexes, and I love the line about
All search index names are case-sensitive.
since none of indexes are currently captialized and appear to still be working... (though, actually, I haven't used this plugin in a few months, so I might be wrong.)
Thanks a bunch!
Posted: Wed Mar 15, 2006 6:40 pm
by cellounge
Just wanted to say thanks a bunch for your help. I will give this a try and see what happens. I just wonder if wireless accessories in that list is what I need. By the way all of categories are in lower case and they all work. You can see for yourself at
http://www.cellounge.com/community/
Posted: Wed Mar 15, 2006 6:56 pm
by mgroeninger
Wow, sorry, I was rushing there... That link wasn't the direct link I wanted I guess...
Try this one:
http://www.amazon.com/gp/aws/sdk/main.h ... ndexValues
Or you can just try something like:
Code: Select all
$mode= array(
'baby',
'books',
'classical',
'dvd',
'electronics',
'garden',
'kitchen',
'magazines',
'music',
'pc-hardware',
'photo',
'software',
'toys',
'universal',
'vhs',
'videogames',
'Wireless',
'WirelessAccessories'
);
$mode_names = array (
'baby' => 'Baby',
'books' => 'Books',
'classical' => 'Classical Music',
'cell phone' => 'Cell Phones',
'dvd' => 'DVD',
'electronics' => 'Electronics',
'garden' => 'Outdoor Living',
'kitchen' => 'Kitchen & Housewares',
'magazines' => 'Magazines',
'music' => 'Popular Music',
'pc-hardware' => 'Computers',
'photo' => 'Camera & Photo',
'software' => 'Software',
'toys' => 'Toys & Games',
'universal' => 'Tools & Hardware',
'vhs' => 'Video',
'videogames' => 'Computer & Video Games',
'Wireless' => 'Wireless Phones',
'WirelessAccessories' => 'Wireless Accessories'
);
At least, I think that should work...
And I'm glad to hear the plugin is working for you!
Edit: Looks like you found the list on your own... Glad you did!
The list does not exactly work on the cell phones.
Posted: Wed Mar 15, 2006 7:42 pm
by cellounge
I tried apparel from that list and it does work. However when doing the wireless or the wireless accesorries it does not.
But I did finally get it to work. This is what I did to make it work. I went to Amazon.com, and then went to the cell phone section. From there I viewed the source code, and scrolled down to the search box section. It had code that looked like this.
Code: Select all
<select name="index">
<option value="blended">Amazon.com</option>
<option value=wireless-phones selected>Cell Phones
<option value=wireless-plans>Service Plans
<option value=wireless-accessories>Accessories
</select>
You will notice that it says "wireless-phones selected" for Cell phones. Well at first I just copied and pasted it as it is. But it still did not work. So I took out the part that says "selected". So now I am left with "wireless-phones"
This did work, so hooray for me. I will go through and get the rest of them working and then I will send you a copy of the amazon chooser file if you want me to.
Posted: Wed Mar 15, 2006 7:49 pm
by mgroeninger
Good to know! Thanks for reporting your findings (and I am glad you got it to work for you)!
Hopefully I will have sometime this weekend or so to sit down and go through the Amazon dropdown and try to get the list updated...