I read these 2 articles to get me started with using Amazon Web Services: http://www.devshed.com/c/a/PHP/Usin...-SOAP-part-1/ && http://www.devshed.com/c/a/PHP/Usin...-SOAP-part-2/
I have a page with a Table of Contents linking to specific Browse Nodes that would be of interest to our viewers. I'd like to add a link to a results page with books published by Nolo Press. To do this I'm passing the name "nolo" via the link. Here is the code I have so far. Note, that it works perfectly when I only want to see a list from a Browse Node. CODE:: ---------------------------- //get publisher information $publisher = $_GET['publisher']; if ($publisher == "nolo") { $publisher = "Nolo Press"; } // if keyword is set, get those results if (isset($keyword)) { $catalogParams = array( 'keyword' => htmlentities($keyword), 'page' => $page, 'mode' => 'books', 'tag' => 'tag', 'sort' => '+pmrank', 'type' => 'lite', 'devtag'=> 'tag' ); // invoke the method $result = $proxy->KeywordSearchRequest($catalogParams); $catalogItems = $result['Details']; $catalogTotal = $result['TotalResults']; } else { // get items from the catalog // sort order is default $catalogParams = array( 'browse_node' => $node, 'page' => $page, 'mode' => 'books', 'tag' => 'tag', 'type' => 'heavy', 'devtag' => 'tag' ); $catalogResult = $proxy->BrowseNodeSearchRequest($catalogParams); $catalogTotal = $catalogResult['TotalResults']; $catalogItems = $catalogResult['Details']; } if (isset($publisher)) { //THE FOLLOWING LINE IS LINE 115 foreach ($catalogItems as $i) { if($i['Manufacturer'] == $publisher) { $catalogParams = array( 'browse_node' => $node, 'page' => $page, 'mode' => 'books', 'tag' => 'tag', 'type' => 'heavy', 'devtag' => 'tag' ); $catalogResult = $proxy->BrowseNodeSearchRequest($catalogParams); $catalogTotal = $catalogResult['TotalResults']; $catalogItems = $catalogResult['Details']; } } } // format and display the results ?> <!-- inner catalog table --> <table border="0" cellspacing="5" cellpadding="0"> <? // parse the $items[] array and extract the necessary information // (image, price, title, author, item URL) //THE FOLLOWING LINE IS LINE 209 foreach ($catalogItems as $i) { ?> <tr> <td align="center" valign="top" rowspan="3"> <a href="book.php?asin=<? echo $i['Asin']; ?>"> <img border="0" src=<? echo $i['ImageUrlSmall']; ?>></a></td> <td><b><a href="book.php?asin=<? echo $i['Asin']; ?>"> <? echo $i['ProductName']; ?></a></b> / <? echo implode(", ", $i['Authors']); ?></td> </tr> <tr> <td align="left" valign="top"><font size="-1"> <!--List Price: <? echo $i['ListPrice']; ?> / Amazon.com--> Price: <? echo $i['OurPrice']; ?> / Used Price: <? echo $i['UsedPrice'] ?> </font></td> </tr> <tr> <td colspan=2> </td> </tr> <? } ?> </table> ---------------------------------------------------------- END CODE I get this error only if $publisher is set (these lines are marked above): Warning: Invalid argument supplied for foreach() in /home/www/palawport/amazon/sample7.php on line 115 Warning: Invalid argument supplied for foreach() in /home/www/palawport/amazon/sample7.php on line 209 I did a little test and tried to see if catalogItems had any data. The following code ONLY returned the Publisher ... nothing else. print_r($catalogItems); print "<p>"; print_r($publisher); print "<p>"; print_r($keyword); exit; Suggestions are welcome :) Thanks Nicole -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php