Skip to content
This repository has been archived by the owner on Mar 14, 2021. It is now read-only.

Added searchWithParameters function #39

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
*.project
testSettings.php
sampleSettings.php

.DS_Store
12 changes: 6 additions & 6 deletions README.markdown
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -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.
Expand All @@ -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
https://github.com/Exeu/Amazon-ECS-PHP-Library/wiki
24 changes: 18 additions & 6 deletions lib/AmazonECS.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand All @@ -104,20 +104,32 @@ 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
));

return $this->returnData(
$this->performSoapRequest("ItemSearch", $params)
);
}

/**
* execute ItemLookup request
*
Expand Down