Submit New Api Order With Multiple Vendors Products

Hi.

I'm developing an app using Cscart Api for Orders.

I'm having trouble to send a new order with products from multiple vendors, since the doc is not clear at all on doing it.

I understood that i have to do something with product_groups, it's okay for shipping_ids but not for products.

Here is the best JSON i could make, but it submit only one order, not even two with a parent one.

{
  "user_id":"2749",
  "notes": "test api",
  "payment_id":"14",
  "shipping_id":{
    "1001102222":"20",
    "1001112222":"20"
  },
  "products":{
    "1001102222":{
      "product_id":"8891","amount":"1"
    },
    "1001112222":{
      "product_id":"9987",
      "amount":"1"
    }
  }
}

If you have any advice you're welcome.

Regards.

PS: i can't POST carts, so no carts are in the database before the order is submitted.

Hello

Did you test by postaman? You don't get information what's wrong?

Best regards

Robert

Oh waw, didn't see that my post was finally accepted, 15 days after.

Thank you Robert for your answer.

Postman just said me that my json is malformed or accept to create one order only.

The more i'm working on CsCart API the more frustrated i am.

For exemple, i can't post a new cart using API... and the API doc is a mess since it misses so many exemples.

What i finally did is putting a Symfony app based on the CsCart database (read only) to have a better interraction with what i want, and have a better API...

If your goal is to create a cart and then have the user checkout, you might want to consider this approach instead.

It can be done with a pre-controller. No need to use the api at all. You can use straight html (I.e. an anchor tag) to do it all. See this for structure. You can add your own security related requirements if you need to.

https://ez-ms.com/private/unsupported_scripts/checkout_pre.tgz

How to add products in cart using API. Please guide if you know

How to add products in cart using API. Please guide if you know

Hello,

There's no API method to add products to customers cart. As you can see in official documentation: https://docs.cs-cart.com/latest/developer_guide/api/entities/carts.html, you can only read customer's cart, or delete it.

Regarding orders - in Multi-Vendor, if customer places an order with products from multiple vendors, it gets split into multiple orders (one for each vendor), so each vendor will see only his part of order. Probably it works the same way for API requests - you have to create a separate order for each vendor that is included in order.

Best regards,

Robert