Created
March 1, 2016 09:41
-
-
Save davidtsadler/cfe9ae0a732c624b3be2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require __DIR__.'/vendor/autoload.php'; | |
use \DTS\eBaySDK\Constants; | |
use \DTS\eBaySDK\Trading\Services; | |
use \DTS\eBaySDK\Trading\Types; | |
use \DTS\eBaySDK\Trading\Enums; | |
$service = new Services\TradingService(array( | |
'apiVersion' => '941', | |
'siteId' => Constants\SiteIds::US | |
)); | |
$request = new Types\SetStoreCategoriesRequestType(); | |
$request->RequesterCredentials = new Types\CustomSecurityHeaderType(); | |
$request->RequesterCredentials->eBayAuthToken = ''; | |
$request->Action = 'Add'; | |
$request->ItemDestinationCategoryID = 14122; | |
$request->DestinationParentCategoryID = 14125; | |
$request->StoreCategories = new Types\StoreCustomCategoryArrayType(); | |
$category = new Types\StoreCustomCategoryType(); | |
$category->Name = 'MP3 Players and Accessories'; | |
$category->Order = 1; | |
$request->StoreCategories->CustomCategory[] = $category; | |
$category = new Types\StoreCustomCategoryType(); | |
$category->Name = 'GPS Devices'; | |
$category->Order = 2; | |
$request->StoreCategories->CustomCategory[] = $category; | |
$response = $service->SetStoreCategories($request); | |
if (isset($response->Errors)) { | |
foreach ($response->Errors as $error) { | |
printf("%s: %s\n%s\n\n", | |
$error->SeverityCode === Enums\SeverityCodeType::C_ERROR ? 'Error' : 'Warning', | |
$error->ShortMessage, | |
$error->LongMessage | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment