From 06eea106ca9d58d79013fbfd68b3e6021302a880 Mon Sep 17 00:00:00 2001 From: Brian Kirsten Date: Mon, 17 Sep 2012 11:34:18 -0400 Subject: [PATCH 1/4] Added searchWithParameters function Added function which allows you to search by all allowed parameters offers in ItemSearchRequest (Artist, Author, Title, etc). Just pass in a key/value array with the parameter type and the term you're searching on. --- lib/AmazonECS.class.php | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/lib/AmazonECS.class.php b/lib/AmazonECS.class.php index 8b2aa02..d70e61e 100755 --- a/lib/AmazonECS.class.php +++ b/lib/AmazonECS.class.php @@ -117,6 +117,47 @@ public function search($pattern, $nodeId = null) $this->performSoapRequest("ItemSearch", $params) ); } + + /** + * execute searchWithParameters + * + * @param array $patternArray + * + * @return array|object return type depends on setting + * + * @see returnType() + */ + public function searchWithParameters($patternArray, $nodeId = null) + { + if (false === isset($this->requestConfig['category'])) + { + throw new Exception('No Category given: Please set it up before'); + } + + $browseNode = array(); + if (null !== $nodeId && true === $this->validateNodeId($nodeId)) + { + $browseNode = array('BrowseNode' => $nodeId); + } + + $ItemSearchRequest = array(); + + $ItemSearchRequest['SearchIndex'] = $this->requestConfig['category']; + + foreach($patternArray as $key => $value) + { + $ItemSearchRequest[$key] = $value; + } + + $params = $this->buildRequestParams('ItemSearch', array_merge( + $ItemSearchRequest, + $browseNode + )); + + return $this->returnData( + $this->performSoapRequest("ItemSearch", $params) + ); + } /** * execute ItemLookup request From 5c1b8cdadefb68b1a59a1c96235fac5536bfc9f9 Mon Sep 17 00:00:00 2001 From: Brian Kirsten Date: Mon, 17 Sep 2012 11:34:36 -0400 Subject: [PATCH 2/4] ignoring .ds files --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) 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 From 1bc4f5d69666bda5f16ea000e7cf7adbf6221bcf Mon Sep 17 00:00:00 2001 From: Brian Kirsten Date: Thu, 1 Nov 2012 11:29:25 -0400 Subject: [PATCH 3/4] Modified search function Modified search function to accept array of patterns --- lib/AmazonECS.class.php | 51 +++++++++-------------------------------- 1 file changed, 11 insertions(+), 40 deletions(-) diff --git a/lib/AmazonECS.class.php b/lib/AmazonECS.class.php index d70e61e..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 * @@ -99,41 +99,6 @@ public function search($pattern, $nodeId = null) throw new Exception('No Category given: Please set it up before'); } - $browseNode = array(); - if (null !== $nodeId && true === $this->validateNodeId($nodeId)) - { - $browseNode = array('BrowseNode' => $nodeId); - } - - $params = $this->buildRequestParams('ItemSearch', array_merge( - array( - 'Keywords' => $pattern, - 'SearchIndex' => $this->requestConfig['category'] - ), - $browseNode - )); - - return $this->returnData( - $this->performSoapRequest("ItemSearch", $params) - ); - } - - /** - * execute searchWithParameters - * - * @param array $patternArray - * - * @return array|object return type depends on setting - * - * @see returnType() - */ - public function searchWithParameters($patternArray, $nodeId = null) - { - if (false === isset($this->requestConfig['category'])) - { - throw new Exception('No Category given: Please set it up before'); - } - $browseNode = array(); if (null !== $nodeId && true === $this->validateNodeId($nodeId)) { @@ -144,10 +109,16 @@ public function searchWithParameters($patternArray, $nodeId = null) $ItemSearchRequest['SearchIndex'] = $this->requestConfig['category']; - foreach($patternArray as $key => $value) + if(is_array( $pattern )) { - $ItemSearchRequest[$key] = $value; - } + foreach($pattern as $key => $value) + { + $ItemSearchRequest[$key] = $value; + } + + } else { + $ItemSearchRequest['Keywords'] = $pattern; + } $params = $this->buildRequestParams('ItemSearch', array_merge( $ItemSearchRequest, @@ -158,7 +129,7 @@ public function searchWithParameters($patternArray, $nodeId = null) $this->performSoapRequest("ItemSearch", $params) ); } - + /** * execute ItemLookup request * From 264c1abe44914692127e8fc56dd21558fa35db2e Mon Sep 17 00:00:00 2001 From: Brian Kirsten Date: Wed, 9 Oct 2019 11:38:18 -0400 Subject: [PATCH 4/4] Update readme --- README.markdown | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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