_searchIndex = 'asin'; $this->_search['ItemId'] = $args[0]; return $this; } if (strtolower($method) === 'category') { $this->_searchIndex = $args[0]; $this->_search['SearchIndex'] = $args[0]; } else if (isset($this->_search['SearchIndex']) || $this->_searchIndex !== null || $this->_searchIndex === 'asin') { $this->_search[$method] = $args[0]; } else { /** * @see Zend_Service_Exception */ require_once 'Zend/Service/Exception.php'; throw new Zend_Service_Exception('You must set a category before setting the search parameters'); } return $this; } /** * Search using the prepared query * * @return Zend_Service_Amazon_Item|Zend_Service_Amazon_ResultSet */ public function search() { if ($this->_searchIndex === 'asin') { return $this->itemLookup($this->_search['ItemId'], $this->_search); } return $this->itemSearch($this->_search); } }