无法使用API​​将具有变体的产品添加到eBay

时间:2019-01-29 09:29:50

标签: php xml ebay ebay-api

我正在使用eBay PHP API将产品添加到ebay。 当我添加不带变体的单个产品时,它工作正常,但是当该产品具有变体时,我会报错

我正在使用TradingService类来处理它,当我将对象转换为xml时,就得到了这种XML,这是正确的。 但是无论如何我都会遇到以下错误-

"Variations Specifics and Item Specifics entered for a Multi-SKU item should be different."
"Missing name in the variation specifics or variation specifics set."

xml有什么问题吗?

<?xml version="1.0" encoding="UTF-8"?> <AddFixedPriceItemRequest xmlns="urn:ebay:apis:eBLBaseComponents">
    <Item xmlns="urn:ebay:apis:eBLBaseComponents">
        <Country>AD</Country>
        <Currency>USD</Currency>
        <Description>Gabiel Ring</Description>
        <ListingDuration>Days_5</ListingDuration>
        <ListingType>FixedPriceItem</ListingType>
        <Location>Shirak, Gyumri</Location>
        <PaymentMethods>PayPal</PaymentMethods>
        <PaymentMethods>CashOnPickup</PaymentMethods>
        <PaymentMethods>OtherOnlinePayments</PaymentMethods>
        <PayPalEmailAddress>agabrielyan0@gmail.com</PayPalEmailAddress>
        <PrimaryCategory xmlns="urn:ebay:apis:eBLBaseComponents">
            <CategoryID>162046</CategoryID>
        </PrimaryCategory>
        <PrivateListing>false</PrivateListing>
        <Quantity>1</Quantity>
        <ShippingDetails xmlns="urn:ebay:apis:eBLBaseComponents"><GlobalShipping>false</GlobalShipping>
            <ShippingServiceOptions xmlns="urn:ebay:apis:eBLBaseComponents"><ShippingService>Other</ShippingService>
                <ShippingServiceCost xmlns="urn:ebay:apis:eBLBaseComponents">0</ShippingServiceCost>
                <ShippingServiceAdditionalCost xmlns="urn:ebay:apis:eBLBaseComponents">0</ShippingServiceAdditionalCost>
                <ShippingServicePriority>2</ShippingServicePriority></ShippingServiceOptions>
            <ShippingType>Flat</ShippingType></ShippingDetails>
        <ShipToLocations>Worldwide</ShipToLocations>
        <StartPrice xmlns="urn:ebay:apis:eBLBaseComponents">0.99</StartPrice>
        <Title>Gabiel Ring</Title>
        <BestOfferDetails xmlns="urn:ebay:apis:eBLBaseComponents"><BestOfferEnabled>true</BestOfferEnabled></BestOfferDetails>
        <PostalCode>3108</PostalCode>
        <PictureDetails xmlns="urn:ebay:apis:eBLBaseComponents">
            <GalleryType>Gallery</GalleryType>
            <PictureURL>http://ecx.images-amazon.com/images/I/412yHOve6JL.jpg</PictureURL>
        </PictureDetails>
        <DispatchTimeMax>1</DispatchTimeMax>
        <ItemSpecifics xmlns="urn:ebay:apis:eBLBaseComponents">
            <NameValueList xmlns="urn:ebay:apis:eBLBaseComponents">
                <Name>Color</Name>
                <Value>Black</Value>
                <Value>Blue</Value>
                <Value>Grey</Value>
            </NameValueList>
        </ItemSpecifics>
        <ReturnPolicy xmlns="urn:ebay:apis:eBLBaseComponents">
            <Refund>MoneyBack</Refund>
            <ReturnsWithin>Days_14</ReturnsWithin>
            <ReturnsAcceptedOption>ReturnsAccepted</ReturnsAcceptedOption>
            <Description>Days_14</Description>
            <ShippingCostPaidBy>Buyer</ShippingCostPaidBy>
        </ReturnPolicy>
        <Variations xmlns="urn:ebay:apis:eBLBaseComponents">
            <Variation xmlns="urn:ebay:apis:eBLBaseComponents">
                <SKU>asdasd4557</SKU>
                <StartPrice currencyID="USD" xmlns="urn:ebay:apis:eBLBaseComponents">1.15</StartPrice>
                <Quantity>1</Quantity>
                <VariationSpecifics xmlns="urn:ebay:apis:eBLBaseComponents">
                    <NameValueList xmlns="urn:ebay:apis:eBLBaseComponents">
                        <Name>Color</Name>
                        <Value>Black</Value>
                    </NameValueList>
                </VariationSpecifics>
            </Variation>
            <Variation xmlns="urn:ebay:apis:eBLBaseComponents">
                <SKU>wercz54578</SKU>
                <StartPrice currencyID="USD" xmlns="urn:ebay:apis:eBLBaseComponents">2</StartPrice>
                <Quantity>1</Quantity>
                <VariationSpecifics xmlns="urn:ebay:apis:eBLBaseComponents">
                    <NameValueList xmlns="urn:ebay:apis:eBLBaseComponents">
                        <Name>Color</Name>
                        <Value>Blue</Value>
                    </NameValueList>
                </VariationSpecifics>
            </Variation>
            <Variation xmlns="urn:ebay:apis:eBLBaseComponents">
                <SKU>yuturty78</SKU>
                <StartPrice currencyID="USD" xmlns="urn:ebay:apis:eBLBaseComponents">3</StartPrice>
                <Quantity>1</Quantity>
                <VariationSpecifics xmlns="urn:ebay:apis:eBLBaseComponents">
                    <NameValueList xmlns="urn:ebay:apis:eBLBaseComponents">
                        <Name>Color</Name>
                        <Value>Grey</Value>
                    </NameValueList>
                </VariationSpecifics>
            </Variation>
            <VariationSpecificsSet xmlns="urn:ebay:apis:eBLBaseComponents">
                <NameValueList xmlns="urn:ebay:apis:eBLBaseComponents">
                    <Name>Color</Name>
                    <Value>Black</Value>
                    <Value>Blue</Value>
                    <Value>Grey</Value>
                </NameValueList>
            </VariationSpecificsSet>
        </Variations>
        <ConditionID>3000</ConditionID>
        <ShippingPackageDetails xmlns="urn:ebay:apis:eBLBaseComponents">
            <ShippingPackage>PackageThickEnvelope</ShippingPackage>
        </ShippingPackageDetails>
    </Item> </AddFixedPriceItemRequest>

1 个答案:

答案 0 :(得分:0)

尝试从以下位置更改

<ItemSpecifics xmlns="urn:ebay:apis:eBLBaseComponents">
    <NameValueList xmlns="urn:ebay:apis:eBLBaseComponents">
        <Name>Color</Name>
        <Value>Black</Value>
        <Value>Blue</Value>
        <Value>Grey</Value>
    </NameValueList>
</ItemSpecifics>

<ItemSpecifics xmlns="urn:ebay:apis:eBLBaseComponents">
    <NameValueList xmlns="urn:ebay:apis:eBLBaseComponents">
        <Name>Brand</Name>
        <Value>yourbrandname</Value>
    </NameValueList>
</ItemSpecifics>