Не могу добавить продукт с вариациями на eBay с помощью API - PullRequest
0 голосов
/ 29 января 2019

Я использую eBay PHP API для добавления продуктов на ebay.Он работает нормально, когда я добавляю один продукт без варианта, но когда у продукта есть варианты, я получаю ошибки

Я использую класс TradingService для его обработки, а когда я конвертирую объект в xml, яполучить этот XML, который швы правильно.Но в любом случае я получаю следующие ошибки:

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

Что не так с 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 голосов
/ 31 января 2019

Попробуйте изменить значение с

<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>
...