Zend_Service_Ebay_Finding proporciona un cliente
para el eBay Finding.
Según el sitio web de eBay, "The Finding API provides programmatic access to
the next generation search capabilities on the eBay platform. It
lets you search and browse for items listed on eBay, and provides
useful metadata to refine searches and enhance the search experience."
Para poder usar Zend_Service_Ebay_Finding,
ya debería tener un eBay Application ID. Para obtener una clave y para
más información, visite el sitio web del
eBay Developers Program.
Instancie un objeto Zend_Service_Ebay_Finding,
pasándole sus claves privadas:
Ejemplo 64.93. Creando una instancia del servicio eBay Finding
$finding = new Zend_Service_Ebay_Finding('my-app-id');
Instancie un objeto Zend_Service_Ebay_Finding,
pasándole sus claves privadas y configurando opciones:
Ejemplo 64.94. Creando una instancia del servicio eBay Finding
$options = array(Zend_Service_Ebay_Abstract::OPTION_APP_ID => 'my-app-id',
Zend_Service_Ebay_Abstract::OPTION_GLOBAL_ID => 'EBAY-GB');
$finding = new Zend_Service_Ebay_Finding($options);
Hay cinco métodos disponibles para buscar elementos:
findItemsByKeywords($keywords)
findItemsByProduct($productId)
findItemsByCategory($categoryId)
findItemsAdvanced($keywords)
findItemsInEbayStores($storeName)
Ejemplo 64.95. Muchas formas de buscar elementos
$finding = new Zend_Service_Ebay_Finding('my-app-id');
$response = $finding->findItemsByKeywords('zend framework book');
foreach ($response->searchResult->item as $item) {
$item->title;
$item->listingInfo->buyItNowPrice;
$item->listingInfo->viewItemURL;
// inner call, find for items of same current product
// like $finding->findItemsByProduct($item->productId, $item->attributes('productId', 'type'))
$response2 = $item->findItemsByProduct($finding);
// inner call, find for items of same store
// like $finding->findItemsInEbayStores($item->storeInfo->storeName)
$response3 = $item->storeInfo->findItems($finding);
}
Esta operación comprueba las palabras clave especificadas y devuelve palabras clave correctamente escritas para obtener los mejores resultados de búsqueda.
Ejemplo 64.96. Buscando recomendación de palabras clave
// searching keywords
$finding = new Zend_Service_Ebay_Finding('my-app-id');
$result = $finding->getSearchKeywordsRecommendation('zend');
echo 'Did you mean ' . $result->keyword . '?';
// inner call
// like $finding->findItemsByKeywords($result->keyword)
$result2 = $result->findItems($finding);
Según el sitio web de eBay, esta operación "category and/or aspect histogram information for the eBay category ID you specify. Histograms are item counts for the associated category or aspect value. Input category ID numbers in the request using the categoryId field".
Ejemplo 64.97. Obteniendo un histograma
$finding = new Zend_Service_Ebay_Finding('my-app-id');
$result = $finding->getHistograms($categoryId);
foreach ($result->categoryHistogramContainer->categoryHistogram as $category) {
$category->categoryId;
$category->categoryName;
// inner call
// like $finding->findItemsByCategory($category->categoryId);
$result2 = $category->findItems($finding);
}