Credit Card UK - Advertising - Loan - Myspace Layout Stealer - Credit Card

PDA

View Full Version : Add categories autom. via Ghostscripter


funmax
Jan 16th 2006, 6:28 am
Hello,

I Use the Ghostscripter AWS (newest Version).

How is it possible to get all the sub categories of a category automatically.
:confused:

Martin

JesterMagic
Jan 16th 2006, 10:33 am
At the start I had the same problem and I made a script that imported the results from browsenodes.com. It worked ok but I still had to import each node seperately.

But then I heard of dyn_cats, I can't take credit for this one, Gtech showed me the way.

It still is underconstruction so it is not available in the admin section but if you onpen the config file look for

$config['dyn_cats'] = 1;

and set it to 1 like above. Now you just have to set the top level catgories and it will automatically branch out from there. Warning, there is a lot of bugs associated with this feature. Plus it slows the site down a bit because it has to query amazon twice (once for the nodes and then again for the search results). I asked the ghostscripter crew about this and they were hopeing to fix the bugs for the next release and add a few of my suggestions (like auto fill the node tables from amazon once, and then you could add and subtract any additional nodes you want). Of course this was a while ago (3 or 4 months) and ghostscripter is very unreliable when it comes to release dates. I've since updated the script to suit my needs but have made it impossible now to use any updates directly from ghostscripter. I will have to piece it together myself. I've added my own features so I probably wouldn't go back to using there script unaltered.

funmax
Jan 16th 2006, 12:23 pm
... i will try it out

Martin

funmax
Jan 16th 2006, 12:42 pm
... nice functionality - but works not well and it is really slooooooow. Do you know the format for the "category import" in the admin panel ?

funmax
Jan 16th 2006, 1:04 pm
do you know some settings or code-changes to get more performance browsing the Amazon categories ?

JesterMagic
Jan 16th 2006, 2:40 pm
do you know some settings or code-changes to get more performance browsing the Amazon categories ?

Not right off, I'll check in on it

I looked at the code for their category import and all it does is execute and sql statements in the text file you point too. Not very helpful.

As I stated before I had added my own importing tool (for version 4.x adm interface) that allows you to import text files from browsenodes. I checked the code and it does import multiple nodes (at different levels) at once but the problem was the 30 sec time out time so you have to keep the import files small. It basically loops through each record (name, parent node id, node id) in the text file

Arts & Crafts|599872|602314
Antiques & Collectibles|602314|637710
Crafts|602314|769100

Looks for its corresponding ghostscripters parent id and inserts the record into the database (along with updated path info).

I have to go but i'll post the code a little later (I have to find it). It may need seem tweaking for version 5 interface.

funmax
Jan 17th 2006, 9:24 am
... maybe also some tipps how i could get this script run correctly :-)

Browsing the categories either i will get the error:

XML parser error: Invalid document end

... or it takes abou 2-3 Minutes !!! till the products are listed :mad:

Have you some examples for your configuration and changes on the source-code ?

JesterMagic
Jan 18th 2006, 8:27 am
I have added the script as an attachment. I went through it quickly and updated some things so I hope it runs under ver. 5. I did not test this under 5 so use at your own risk!!! I would run this script first using a test site to make sure all will go smoothly. If I have time I will test this and reupload it.


Put the file cat_add_file.php in your adm directory of Amazon Shop
Login to your admin of amazon shop then you will have to manually goto the file: http://www.YourDomainHere.com/adm/cat_add_file.php.

Make sure your text file is in this format: Title|Parent|Node

Point to your file (It has to be on your server) and select what mode the nodes are for (all nodes in the file must be the same mode, meaning ie. they have to be all categories for books, etc..)

Then click the button and it should upload. Try it with smaller files first to see if all goes well.


As far as browse nodes are concerned I will have to look into it (I am short of time right now) and see what changes I did (I worked on this a few months ago). Dyna_Cats is slower but not 2-3 minutes slower. I would say it takes twice as long as using the site without browse nodes turn on (2 or 3 secs).

Try deleting all categories from your site and then add just one category like DVDs. Then turn on dyn_cats and test your site.

funmax
Jan 19th 2006, 8:37 am
Hello JesterMagic,

thanks a lot for your information and the script, but it don't work in the 5.x version. I work on some changes on it, so it should run in my version later on. I will attach it to this thread, if it is ready...

But some things i can't understand:
Why is it not possible to get the wright category-structure from amazon?

for example: if i look at the nodes at
amazon.com/gp/aws/sdk/main.html/002-1848563-7943200?s=AWSEcommerceService&v=2005-03-23&p=ApiReference/USBrowseNodesArticle

no apparel-node is shown, but it was pre-configured in ghostscripter and it worked!

If i choose a node here: SportingGoods/Apparel: 3375311 and configure an new category in my amazon shop, no results are shown.

The same thing here: gwaanin.com/browsenodelookup/index.php
If i select a node and add a new category in my amazon shop, some categories are o.k. other are without results ?

Could someone explain me the way to build up the same amazon-structure as used in the original sites ?

JesterMagic
Jan 20th 2006, 11:47 am
Funmax,

I updated the script myself since I may switch back to this from dyna_nodes in the next version that is released by ghostscripter. I updated the Category Import page (sql_insert.php) to now import the text files from browsenodes. I also made it a fair bit faster so those ugly max exectin time errors do not show up to often. I tested this script with version 5.0.4 and 5.0.5 and it seems to work fine but you should test it yourself. The actual page contains more notes on settings, warnings, ect..

Just replace the file sql_insert.php with my new one and goto Category Import under the Amazon Categories menu in the Admin section.

I must say I am a little frustrated with Amazon Shop in general. I notice now that the search result prices do not match the actual price of the item when you click on it (seems to happen about half the time). I did some research and I may fix it but it is a fair bit of work. The GhostScripter demo script is not doing this so they have fixed it but they have not released it yet since there are other bugs still in the demo.

Give me some feedback on how it works.

Thanks

funmax
Jan 22nd 2006, 7:11 am
Hello JesterMagic,

your script didn't work as i suggested, but i have changed it a little bit - so i could now add my categories like the aws-structure shown at www.gwaanin.com/browsenodelookup !

It was much more faster then typing in category by category :-))

If somebody should need it, i attached my version to this thread...

JesterMagic
Jan 22nd 2006, 5:00 pm
That's weird. It worked fine for me on version 5.0.5 Is that the version you are using? I did multiple tests with different node files etc. The good thing it does is it allows you to import the entire nodes stucture so you only have to do one file per category (like DVD).

What part of the script failed? Did the script just error out or did not import the records at all or did it import them incorrectly?

I did not know about the site www.gwaanin.com/browsenodelookup. Do you know of any more aws related sites?

Maybe I will combine our scripts into one so people will have a choice on how to import there nodes (if there is enough interest).

Hello JesterMagic,

your script didn't work as i suggested, but i have changed it a little bit - so i could now add my categories like the aws-structure shown at www.gwaanin.com/browsenodelookup !

It was much more faster then typing in category by category :-))

If somebody should need it, i attached my version to this thread...

funmax
Jan 23rd 2006, 12:34 am
The import was OK, but the category_path was not build correctly.

Furthermore i wanted to use the "gwaanin.com" because it seems to be an actual node structure...

If you could (and have the time) put the two versions together, so other people could choose the source and kind of import, i think it would be an interesting feature!

Should i make any other changes on my 5.0.5 version i will post them here - i think we should communicate the changes we make on the script, because there are much more bugs in it as i thought.... i don't think it should be called a "stable" version :-))

JesterMagic
Jan 23rd 2006, 12:13 pm
Could you upload me a sample import file that produced bad paths so I can fix the script.

Thanks

funmax
Jan 25th 2006, 1:37 am
.. just upload a file in the format as suggested: Title|Parent|Node

The upload works, but if you have a look at your database, in the cetegory_path is not the information that should be.

For example:
New node: 12
Parent: 23
category_path: 0|141|12

...should be: 0|23|12

JesterMagic
Jan 25th 2006, 2:37 pm
Ahh stupid mistake, The path creation should be fixed now (if statement was in the wrond spot). I tested using the magazine and dvd categories. I also found and fixed another bug that wouldn't allow a category title with a ' in it (silly beginners mistake). The actual category add form in the admin also contains this mistake as well.