diff --git a/.gitignore b/.gitignore index b5373e1..c36cb57 100755 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ *.project testSettings.php sampleSettings.php + +.DS_Store diff --git a/README.markdown b/README.markdown index f163c18..9517b7d 100755 --- a/README.markdown +++ b/README.markdown @@ -1,4 +1,4 @@ -#Amazon ECS PHP Library Version 1.3 +# Amazon ECS PHP Library Version 1.3 AmazonECS is a class which searchs products and fetchs information about it from tha amazon productdatabase. @@ -15,7 +15,7 @@ These operations could be expanded with extra prarmeters to specialize the query Requirement is the PHP extension SOAP. -##Basic Usage: +## Basic Usage: The usage is quite simple. Just require the class, create a new object of it and it's ready to use. Nothing else to configure. @@ -35,13 +35,13 @@ var_dump($response); For some very simple examples go to the samples-folder and have a look at the sample files. These files contain all information you need for building querys successful. -##Demo Site: +## Demo Site: Simple Produkt Search: http://amazonecs.pixel-web.org -##Webservice Documentation: +## Webservice Documentation: Hosted on Amazon.com: http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/ -##More information: +## More information: See wikipages for more information: -https://github.com/Exeu/Amazon-ECS-PHP-Library/wiki \ No newline at end of file +https://github.com/Exeu/Amazon-ECS-PHP-Library/wiki diff --git a/lib/AmazonECS.class.php b/lib/AmazonECS.class.php index 8b2aa02..c614363 100755 --- a/lib/AmazonECS.class.php +++ b/lib/AmazonECS.class.php @@ -86,7 +86,7 @@ public function __construct($accessKey, $secretKey, $country, $associateTag) /** * execute search * - * @param string $pattern + * @param string $pattern|$array (key/value) * * @return array|object return type depends on setting * @@ -104,12 +104,24 @@ public function search($pattern, $nodeId = null) { $browseNode = array('BrowseNode' => $nodeId); } + + $ItemSearchRequest = array(); + + $ItemSearchRequest['SearchIndex'] = $this->requestConfig['category']; + + if(is_array( $pattern )) + { + foreach($pattern as $key => $value) + { + $ItemSearchRequest[$key] = $value; + } + + } else { + $ItemSearchRequest['Keywords'] = $pattern; + } $params = $this->buildRequestParams('ItemSearch', array_merge( - array( - 'Keywords' => $pattern, - 'SearchIndex' => $this->requestConfig['category'] - ), + $ItemSearchRequest, $browseNode )); @@ -117,7 +129,7 @@ public function search($pattern, $nodeId = null) $this->performSoapRequest("ItemSearch", $params) ); } - + /** * execute ItemLookup request *