How to fetch categories from eBay using GetCategories method

While developing a module for Zencart where the user would be able to list his products on eBay using the Zencart admin panel the client requested that he wanted the list of categories on eBay available in the admin panel so he can list the products into the category he wishes. This would allow the client to set the eBay category against the product from the add/edit product page in the admin panel.

Fortunately eBay provides this facility in their SOAP API. They provide a method called GetCategories which will return the category related information to you. Each eBay site i.e. eBay USA, eBay UK has it’s own set of categories so you need to specify the location in your input to receive the related categories to that location.

GetCategories take an array as input. The array is made up of the following

Version
RequesterCredentials
CategorySiteID
DetailLevel

and returns an array of objects which contains the category information as

BestOfferEnabled
AutoPayEnabled
CategoryID
CategoryLevel
CategoryName
CategoryParentID

Here we are concerned with CategoryID and CategoryName. If you would like more information on the above you can view the information here.

If you would like to view the code for fetching the categories and saving it into the database then you can download the code from here

Hope the above helped.

Tagged with: , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*