mirakl / sdk-php-shop

Mirakl PHP SDK for sellers
30 stars 16 forks source link

Can you document a way of fetching the products? #37

Closed abdellahrk closed 7 months ago

abdellahrk commented 1 year ago

Hello, it's ambigouos and difficult to be able to fetch products. Can you document this? I'll like to fetch all the products but I see the api limits me to specify a product reference. And for this I can only successfylly fetch by EAN. What about a SHOP_SKU? or CATEGORY?

jreinke commented 1 year ago

Hello,

Did you try something like this for example?

$request = new GetProductsRequest([new ProductReference('SHOP_SKU', '<shop_sku>')]);

Do not hesitate to share your code so I can help (without credentials of course).

abdellahrk commented 1 year ago

Hello @jreinke. Thank you for responding. I am new with your api and certain things are still hard to get. Where should I get the shop_sku? Is it in this format FS-Kart-RH-xxxx? Hitting this endpoint api/offers gives a couple of shop_sku but none returns the products. My example here:

$request = new GetProductsRequest([new ProductReference('SHOP_SKU', '<shop_sku>')]);
$products = $api->getProducts($request);

I tried getting by 'EAN'

        foreach ($barcodes as $barcode) {
            $references [] = new ProductReference('EAN', (string) $barcode);  
        }
$request = new GetProductsRequest([$references])

It did not work. Thank you.

abdellahrk commented 1 year ago

@jreinke please how can I get the shop_sku?

jreinke commented 1 year ago

Hello @abdellahrk,

Can you explain globally what you want to do please? More context will probably help me to guide you in the right direction with the different APIs.

Thank you.

abdellahrk commented 1 year ago

Hi @jreinke, I want to periodically fetch products from the marketplace and save them in a system. These will facilitate sending orders to a fulfillment center. I am already able to fetch orders with the api. I just can't with the products. Thank you.

abdellahrk commented 1 year ago

@jreinke how can I get the shop sku?

jreinke commented 1 year ago

Hello @abdellahrk,

Actually, The SHOP_SKU should be yours, it is the product SKU for which you have associated offers that you should have sent to the Mirakl marketplace previously. If you can fetch orders, it means that you have previously sent associated offers and therefore associated products too. Am I missing something in your integration?

abdellahrk commented 1 year ago

Hi @jreinke, I am seriously missing something. If I have this block

            "product_sku": "C92908411",
            "product_title": "my-title",
            "quantity": 0,
            "shipping_deadline": "2023-01-18T10:16:32.853Z",
            "shop_sku": "FS-Kart-Somthing-something",
            "state_code": "11",
            "total_price": 49.99

then this returns empty

  $request = new GetProductsRequest([new ProductReference('SHOP_SKU', '<FS-Kart-Somthing-something>')]);

  $products = $api->getProducts($request);
jreinke commented 1 year ago

Can you try this instead please:

$request = new GetProductsRequest([new ProductReference('SHOP_SKU', 'FS-Kart-Somthing-something')]);
abdellahrk commented 1 year ago

@jreinke thank you. Unfortunately it returns empty.

jreinke commented 1 year ago

Hello,

Can you send me your personal credentials at support-magento-seller@mirakl.com please? I will verify locally why the response is empty.

Thank you. Johann

jreinke commented 1 year ago

Hello @abdellahrk, I didn't receive anything, do you still have a problem with the request?

abdellahrk commented 1 year ago

Hi @jreinke, I am sorry I did not see the notification for the previous message. I am sending it in a moment. Thank you.