question

bhartlenn0328 avatar image
0 Likes"
bhartlenn0328 asked ·

How to update categoryId by country selected

My PHP app displays eBay item listings using `findItemsAdvanced`, and on the front end has a form select dropdown that is basically used to choose the eBay global id of the eBay site to search for products. In the backend, I can also set the categoryId of the eBay results that are displayed on the front end. If I have categoryId set in my `findItemsAdvanced` call, and after a user uses the form select to change the eBay site to search for products, from what I understand I need to be able to update this categoryId to the categoryId of the same/similar category of the newly selected eBay site. So if I have a categoryId and an eBay country code, how can I update the categoryId when the eBay Country Code changes? I've looked into using `getCategories` and a couple of other category calls from the API, and I saw that we can import the eBay Category data, and keep it up to date somehow, but I haven't looked into that much yet. I'd could really use some advice on generally how I could approach this problem. Here's a basic version of the code I would have: $category_id = 1786; // not a real category ID $ebay_global_id = 'EBAY-US'; // if user changes country, or the eBay Global Id for the findItemsAdvanced API call in our app... if( !empty( $user_global_id_select ) ) { // ...update global id for findItemsAdvanced API call $ebay_global_id = $user_global_id_select; // ...And here is where I'd like to update the $category_id variable according to the new global id selected. The category id should be updated to the id of the same/similar category on the different eBay site/Global Id } I suspect I need to look into how to import and maintain a list of eBay categories in my database maybe, and figure out how to query that data accordingly: but, I can't seem to find any information on what I'm trying to do here, and I'm lost at this point. Any kind of help, and pushes in the right direction are much appreciated!
finditemsadvancedcategoryidcountryglobalidcategory mapping tree
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
xiang.developersupport avatar image
0 Likes"
xiang.developersupport answered ·
Hi, please refer to the documents below: https://developer.ebay.com/Devzone/XML/docs/Reference/eBay/GetCategories.html ... Optimizing Your Calls Retrieving the full set of eBay categories can be time-consuming and the result sets can be quite large. It can be worthwhile to issue one GetCategories call to retrieve the data for the top-level categories (set LevelLimit to 1), then get the full hierarchy of the branches you are interested by specifying those categories as CategoryParent values in subsequent calls to GetCategories. Use GetCategories to retrieve the category hierarchy only when necessary and retrieve category data only when a change in the category hierarchy version is indicated for the specified site (see "Checking the Category Hierarchy Version" in Maintaining Category Data for details on category versioning). Although checking the category version does not reduce the number of calls you make to GetCategories, you can optimize your calls by downloading category data only when needed. ... and the link: https://developer.ebay.com/Devzone/guides/ebayfeatures/Development/Categories-DataMaintenance.html Best Regards,
· Share
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.