davidtsadler / ebay-sdk-examples

Several examples of using the eBay SDK for PHP
http://devbay.net
Apache License 2.0
184 stars 100 forks source link

Error: The UPC field is missing. The UPC field is missing. Please add UPC to the listing and try again. #89

Closed skcin7 closed 5 years ago

skcin7 commented 5 years ago

Hey, I'm trying to list a Fixed Price item for sale using this example: https://github.com/davidtsadler/ebay-sdk-examples/blob/master/trading/04-add-fixed-price-item.php

Pretty sweet, honestly. I had to add some Item Specifics which were required, no big deal, I just looked for the example that shows how to add Item Specifics, and combined some of the code.

However, now eBay is requiring that I add a UPC field to my listing in order for it to be submitted. When I try to add the Fixed Price listing, I get the following error: Error: The UPC field is missing. The UPC field is missing. Please add UPC to the listing and try again.

However, no where in the documentation do I see anywhere that makes any mention of the UPC. I looked in the code but can't seem to figure out how there either. HELP!

My Category I'm trying to list in is Video Games & Consoles > Video Games (139973). Please somebody help me figure out how to add a UPC. Thank you.

pjw345 commented 5 years ago

You might want to try something like this?

` if ($stockItem->getBarCode()) { $item->ProductListingDetails = new Types\ProductListingDetailsType(); $item->ProductListingDetails->UPC = $stockItem->getBarCode(); }

`

I believe this is similar to what we used to use, I also believe you can use EAN instead of UPC

skcin7 commented 5 years ago

@pjw345 Works, thank you!

pjw345 commented 5 years ago

That was just a piece of example code to show where we got the barcode from, you can't just copy/paste this into your environment. I assume you have some kind of object/array that contains the data, i.e. barcode/ean/upc that you'd want to assign to the $item which of class DTS\eBaySDK\Trading\Types,

     $item = new Types\ItemType();
     $item->ListingType = Enums\ListingTypeCodeType::C_FIXED_PRICE_ITEM;

. . . $request->Item = $item;