PDA

View Full Version : Dan's AWS Script



mobilebadboy
04-13-2004, 10:05 AM
I've got 2 questions. I've been using this script in pretty much it's raw form for a while, but now I'm trying to use it for something new. 2 things I'd like to do that I can't figure out is:

1) How to get Features for products. I've tried altering the Authors foreach code, the ratings code and even the code Dan posted in Incka's thread about the authors. None have worked. I've added mention of it in the loop through <Details>.

2) How can I format the Product Description to a little more readable format? Right now it just pulls it and spits it out in a chunk with no paragraph breaks or anything. Can I get this a little more legible?

Thanks. :)

I actually have some other questions, but I think if I can get the Features figured out, I can get the other stuff I want taken care of.

GCT13
04-13-2004, 10:41 AM
Hi mobilebadboy,


Question 1) - you're on the right track with Features trying to duplicate the Authors functionality. First you need to figure out the XML tag name for each individual feature (I think it's "Feature"), and then create the appropriate variable within the big IF statement where all the tag names/variables are set. Hint - copy and paste the author line and adjust as neccessary.

To display the Features, yeah use the author's foreach loop and adjust the variable names.

Note the thread I had with incka won't work for you, because incka is using a different script.


Question 2) - for the product description, you basically get what you get from Amazon. Sometimes the description does include html markup to make the text more readable.


Hope that helps, give me a shout if you get it working or have further questions,

Dan

mobilebadboy
04-13-2004, 10:48 AM
Waha! It was Feature, I was using Features. Teaches me for trying to do simple things with very, very little sleep. Now I'm hoping the same thing will closely work with Accessories and whatnot. :)

Thanks for the script(s) by the way. I'm too lazy and too busy to figure this stuff out, and Mr Rats script just has too much in it to deal with (although it's thorough, I'll give him that). This is right in the middle and perfect for me. :p

mobilebadboy
04-13-2004, 11:21 AM
Alright. I always wondered why I couldn't justify align the product description. Viewing the source, Amazon does indeed output <p> tags they just don't add line breaks. A simple str_replace gives me my line breaks and justified paragraphs. Oh I'm happy. :D

mobilebadboy
05-07-2004, 11:20 PM
Is there a way to limit the results to 5 instead of the default 10 per page? I tried changing a few things, but it seems the default code is going to display 10 results no matter what.

Chris
05-08-2004, 06:25 AM
Sure. I do it on some homepages (top 5 items).

mobilebadboy
05-08-2004, 06:34 AM
Yeah, that's what I'm wanting to do for all the categories on a new site I'm working on, I just haven't figured out how to accomplish it.

By the way, I'm not sure if you're still working on it or not, but there's alot of errors and incorrect results on your new garden supply site. Thought I'd point it out either way if you were done with it and didn't know. :o

Chris
05-08-2004, 08:12 AM
What do you mean?

mobilebadboy
05-08-2004, 08:33 AM
One problem I noticed was if you click the page links at the bottom here:

http://www.discountgardensupply.net/market/Sales/2/

But it doesn't seem to do it on every page. That's the only one I actually noticed it on.

And I can't remember on which page I was, but when I clicked the flowers and shrubs link in the menu, I ended up getting results for grills and such. it had /market/flowers.php (http://www.discountgardensupply.net/market/flowers.php) instead of just /flowers.php.

Chris
05-08-2004, 09:16 AM
Originally posted by mobilebadboy
One problem I noticed was if you click the page links at the bottom here:

http://www.discountgardensupply.net/market/Sales/2/

But it doesn't seem to do it on every page. That's the only one I actually noticed it on.

And I can't remember on which page I was, but when I clicked the flowers and shrubs link in the menu, I ended up getting results for grills and such. it had /market/flowers.php (http://www.discountgardensupply.net/market/flowers.php) instead of just /flowers.php.

How did you get to the first page? That URL should not exist.

mobilebadboy
05-08-2004, 09:33 AM
I don't remember. :o I was just randomly clicking through the site. If I run across it again I'll let you know.

mobilebadboy
05-08-2004, 02:32 PM
I got sidetracked. If someone can clue me on [how to do] this, I'd appreciate it. :D I've put a hold on building this new site so I don't have to edit a bunch of pages twice.


Originally posted by mobilebadboy
Is there a way to limit the results to 5 instead of the default 10 per page? I tried changing a few things, but it seems the default code is going to display 10 results no matter what.

chromate
05-08-2004, 02:51 PM
I forget the specifics, but you are right, the default array returned will always be 10 items. What you do is just iterate through the array only 5 places...

for ($i=0; $i < 5; $i++) {
// where $products is your product array returned by amazon...
echo $products[$i][whatever]
}

Get the idea?

So, just go through 5 instead of saying $i < count($pruducts) which would give you all ten because the array returned by amazon (we're calling it $products in this example) will contain 10 as you've noticed.

mobilebadboy
05-08-2004, 03:14 PM
Ah, thanks. :) That worked, well for some reason I had to set it to 9? 5 returned 3 products, 7 returned 4. At least I was originally looking at the right line. Now after I eventually get to sleep I can get back to work again.