mirakl / sdk-php-shop

Mirakl PHP SDK for sellers
29 stars 16 forks source link

Maybe a few more samples? #25

Closed hgreuvers closed 5 months ago

hgreuvers commented 2 years ago
    //Instantiating the Mirakl Marketplace Products (MMP): Shop API Client
    $apiClient = new Mirakl\MMP\Shop\Client\ShopApiClient($MiraklUrl_ob, $MiraklApiKey_ob, $MiraklShopId_ob);

    //OR11: Get order information
    echo "<hr><b>OR11</b><br>";
    $GetOR = new Mirakl\MMP\Shop\Request\Order\Get\GetOrdersRequest(); //initiate request
    $GetOR->setOrderStates(['WAITING_ACCEPTANCE']); //define request
    $MiraklColl = $apiClient->getOrders($GetOR);
    if ($MiraklColl->getTotalCount() > 0)
    {   //Orders returned
        var_dump($MiraklColl->toArray());
    }
    else echo "No orders returned";

    //SH21: List all carriers
    echo "<hr><b>SH21</b><br>";
    $MiraklColl = $apiClient->getShippingCarriers();
    $aListCarriers = $MiraklColl->toArray();
    foreach ($aListCarriers as $aListCarrier)
    {
        echo implode('|', $aListCarrier).'<br>';
    }

    //P31: Get products for a list of product
    echo "<hr><b>P31</b><br>";
    $GetPR = new Mirakl\MMP\Shop\Request\Product\GetProductsRequest(array('EAN' => '8719326011127')); //initiate+define request
    $MiraklColl = $apiClient->getProducts($GetPR);
    if ($MiraklColl->getTotalCount() > 0)
    {   //Products returned
        var_dump($MiraklColl->toArray());
    }
    else echo "No products returned";
jreinke commented 2 years ago

Hello,

What is your request exactly please?

Thank you.

Johann

hgreuvers commented 2 years ago

Hello Johann,

I thought it might be helpful for others to add a few more samples to get started?

Kind regards,

Harold

Op ma 4 apr. 2022 om 10:54 schreef Johann Reinké @.***>:

Hello,

What is your request exactly please?

Thank you.

Johann

— Reply to this email directly, view it on GitHub https://github.com/mirakl/sdk-php-shop/issues/25#issuecomment-1087289418, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACTMF7NUU5J55VAI57QJJVLVDKU3DANCNFSM5SFRGRYQ . You are receiving this because you authored the thread.Message ID: @.***>

jatinbphp commented 2 years ago

Very true. More examples needed regarding how to use this sdk.

jreinke commented 2 years ago

Hello,

Thanks for your feedbacks. We are always trying to make things easy to understand for developers with an implementation example for each API. What are the difficulties encountered please? It would help us understanding how and where add more examples and explanations.

Best.

jatinbphp commented 2 years ago

Thank you for replying. At the moment, you have wrote examples but it is in on individual class. it would be very helpful if same examples are written in separate page. Thanks.