sonnenglas / amazon-mws-laravel

A library to connect to Amazon's MWS web services in an object oriented manner
Apache License 2.0
64 stars 73 forks source link

What data as string passed to setFeedContent? Is it xml as string? #56

Open ameer8f26 opened 3 years ago

ameer8f26 commented 3 years ago

I need to know what data as string is passed to following function amazon-mws-laravel/src/AmazonFeed.php/setFeedContent($s)

What will be inside $s in setFeedContent($s)?? Will it be xml as string?

Give simple example please. Thanks.

gaurav2262 commented 3 years ago

Which feed type you want to submit?

if your feed type contains XML,

Then just create an XML and store it to the variable and then set that variable to the setFeedCotent().

$xmlString = '<?xml version="1.0" encoding="UTF-8"?>
            <AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
                <Header>
                    <DocumentVersion>1.01</DocumentVersion>
                    <MerchantIdentifier>XXXX</MerchantIdentifier>
                </Header>
                <MessageType>CartonContentsRequest</MessageType>
                <Message>
                    <MessageID>MSG !</MessageID>
                    <CartonContentsRequest>
                        <ShipmentId>FBAXXX</ShipmentId>
                        <NumCartons>XX</NumCartons>
                        <Carton>
                            <CartonId>SSS</CartonId>
                            <Item>
                                <SKU>SKU</SKU>
                                <QuantityShipped>XXX</QuantityShipped>
                                <QuantityInCase>XX</QuantityInCase>
                            </Item>
                        </Carton>
                        <Carton>
                            <CartonId>SSS</CartonId>
                            <Item>
                                <SKU>SKU</SKU>
                                <QuantityShipped>XXX</QuantityShipped>
                                <QuantityInCase>XX</QuantityInCase>
                            </Item>
                        </Carton>
                    </CartonContentsRequest>
                </Message>
            </AmazonEnvelope>';

Once your XML is ready just set it to the setFeedContent() function.

Here is my example, I have created XML in $xmlString variable and then I set that variable to the setFeedContent() function

        $amzRequestFeed = new AmazonFeed($store);
        $setFeedResult = $amzRequestFeed->setFeedContent($xmlString);

Hope this is helpful.