User Tools

Site Tools


udropship:umarketplace:m2:vendor-info-graphql

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
udropship:umarketplace:m2:vendor-info-graphql [2021/02/18 16:59]
wtsergo created
udropship:umarketplace:m2:vendor-info-graphql [2021/09/06 19:06] (current)
wtsergo
Line 181: Line 181:
  
 ===== Get Single Vendor Info ===== ===== Get Single Vendor Info =====
 +
 +''
 +Example:
 +''
 +<code>
 +{
 +  vendor(id: 1) {
 +    vendorId
 +    vendorName
 +    vendorAttn
 +    email
 +    telephone
 +    fax
 +    streetFull
 +    street1
 +    street2
 +    city
 +    zip
 +    countryId
 +    regionId
 +    region
 +    regionCode
 +    billingUseShipping
 +    billingTelephone
 +    billingFax
 +    billingStreetFull
 +    billingStreet1
 +    billingStreet2
 +    billingCity
 +    billingZip
 +    billingCountryId
 +    billingRegionId
 +    billingRegion
 +    billingRegionCode
 +    status
 +    carrierCode
 +    urlKey
 +    createdAt
 +    vacationMode
 +    vacationEnd
 +    vacationMessage
 +    accountType
 +    isFeatured
 +    ratingSummary
 +  }
 +}
 +</code>
 +''
 +RESPONSE
 +''
 +<code>
 +{
 +  "data": {
 +    "vendor": {
 +      "vendorId": "1",
 +      "vendorName": "vendor1",
 +      "vendorAttn": "",
 +      "email": "wtsergo.test+v1@gmail.com",
 +      "telephone": "4025555555",
 +      "fax": null,
 +      "streetFull": "1234 Test",
 +      "street1": "1234 Test",
 +      "street2": "",
 +      "city": "los angeles",
 +      "zip": "90210",
 +      "countryId": "US",
 +      "regionId": "12",
 +      "region": null,
 +      "regionCode": "CA",
 +      "billingUseShipping": "1",
 +      "billingTelephone": "4025555555",
 +      "billingFax": null,
 +      "billingStreetFull": "",
 +      "billingStreet1": "",
 +      "billingStreet2": "",
 +      "billingCity": "",
 +      "billingZip": null,
 +      "billingCountryId": "",
 +      "billingRegionId": null,
 +      "billingRegion": null,
 +      "billingRegionCode": null,
 +      "status": "A",
 +      "carrierCode": "flatrate",
 +      "urlKey": "vendor1",
 +      "createdAt": "2021-01-05 20:09:54",
 +      "vacationMode": "0",
 +      "vacationEnd": null,
 +      "vacationMessage": null,
 +      "accountType": null,
 +      "isFeatured": "0",
 +      "ratingSummary": "0.00 (0)"
 +    }
 +  }
 +}
 +</code>
 +
 +===== Get list of Vendor Products =====
 +
 +It's a shorthand of general magento //products// query.
 +
 +''
 +Example:
 +''
 +<code>
 +{
 +  vendorProducts(vendorId:3, filter: { price: { from: "28" to: "30"} }
 +) {
 +    total_count
 +    items {
 +      name
 +      sku
 +      description {
 +        html
 +      }
 +      price_range {
 +        maximum_price {
 +          regular_price {
 +            value
 +          }
 +        }
 +      }
 +    }
 +  }
 +}
 +</code>
 +''
 +RESPONSE
 +''
 +<code>
 +{
 +  "data": {
 +    "vendorProducts": {
 +      "total_count": 2,
 +      "items": [
 +        {
 +          "name": "Overnight Duffle",
 +          "sku": "24-WB07",
 +          "description": {
 +            "html": "<p>For long weekends away, camping outings and business trips, the Overnight Duffle can't be beat. The dual handles make it a cinch to carry, while the durable waterproof exterior helps you worry less about the weather. With multiple organizational pockets inside and out, it's the perfect travel companion.</p>\r\n<ul>\r\n<li>Dual top handles.</li>\r\n<li>W 15\" x H 15\" x D 9\".</li>\r\n</ul>"
 +          },
 +          "price_range": {
 +            "maximum_price": {
 +              "regular_price": {
 +                "value": 45
 +              }
 +            }
 +          }
 +        },
 +        {
 +          "name": "Push It Messenger Bag",
 +          "sku": "24-WB04",
 +          "description": {
 +            "html": "<p>The name says so, but the Push It Messenger Bag is much more than a busy commuter's tote. It's a closet away from home when you're pedaling from class or work to gym and back or home again. It's the perfect size and shape for laptop, folded clothes, even extra shoes.</p>\r\n<ul>\r\n<li>Adjustable crossbody strap.</li>\r\n<li>Top handle.</li>\r\n<li>Zippered interior pocket.</li>\r\n<li>Secure clip closures.</li>\r\n<li>Durable fabric construction.</li>\r\n</ul>"
 +          },
 +          "price_range": {
 +            "maximum_price": {
 +              "regular_price": {
 +                "value": 45
 +              }
 +            }
 +          }
 +        }
 +      ]
 +    }
 +  }
 +}
 +</code>
 +
 +Magento native version of above query is
 +
 +''
 +Example:
 +''
 +<code>
 +{
 +  products(
 +    filter: { udropship_vendor: { eq: "1"} }
 +  ) {
 +    items {
 +      name
 +      sku
 +    }
 +  }
 +}
 +</code>
 +
 +===== Get product offers from multiple vendors =====
 +
 +''
 +Example:
 +''
 +<code>
 +{
 +  vendorProductOffers(sku: "24-WB04") {
 +    vendorProductId
 +    vendorId
 +    productId
 +    priority
 +    vendorSku
 +    vendorCost
 +    stockQty
 +    backorders
 +    status
 +    shippingPrice
 +    vendorTitle
 +    state
 +    stateDescr
 +    freeshipping
 +    vendorPrice
 +    specialPrice
 +    specialFromDate
 +    specialToDate
 +  }
 +}
 +</code>
 +''
 +RESPONSE
 +''
 +<code>
 +{
 +  "data": {
 +    "vendorProductOffers": [
 +      {
 +        "vendorProductId": "15",
 +        "vendorId": "1",
 +        "productId": "14",
 +        "priority": null,
 +        "vendorSku": null,
 +        "vendorCost": null,
 +        "stockQty": "99",
 +        "backorders": "-1",
 +        "status": "1",
 +        "shippingPrice": null,
 +        "vendorTitle": null,
 +        "state": "new",
 +        "stateDescr": null,
 +        "freeshipping": "0",
 +        "vendorPrice": "187.86",
 +        "specialPrice": null,
 +        "specialFromDate": null,
 +        "specialToDate": null
 +      },
 +      {
 +        "vendorProductId": "6171",
 +        "vendorId": "2",
 +        "productId": "14",
 +        "priority": null,
 +        "vendorSku": null,
 +        "vendorCost": null,
 +        "stockQty": "20",
 +        "backorders": "-1",
 +        "status": "1",
 +        "shippingPrice": null,
 +        "vendorTitle": null,
 +        "state": "new",
 +        "stateDescr": null,
 +        "freeshipping": "0",
 +        "vendorPrice": "1287.86",
 +        "specialPrice": null,
 +        "specialFromDate": null,
 +        "specialToDate": null
 +      },
 +      {
 +        "vendorProductId": "6174",
 +        "vendorId": "3",
 +        "productId": "14",
 +        "priority": null,
 +        "vendorSku": null,
 +        "vendorCost": null,
 +        "stockQty": "30",
 +        "backorders": "-1",
 +        "status": "1",
 +        "shippingPrice": null,
 +        "vendorTitle": null,
 +        "state": "new",
 +        "stateDescr": null,
 +        "freeshipping": "0",
 +        "vendorPrice": "290",
 +        "specialPrice": null,
 +        "specialFromDate": null,
 +        "specialToDate": null
 +      }
 +    ]
 +  }
 +}
 +</code>
 +
 +===== Get product questions to vendors =====
 +
 +''
 +Example:
 +''
 +<code>
 +{
 +  vendorProductQuestions(sku: "24-WB04") {
 +    questionText
 +    answerText
 +    customerName
 +    vendorId
 +    vendorName
 +    visibility
 +    questionDate
 +    answerDate
 +  }
 +}
 +</code>
 +''
 +RESPONSE
 +''
 +<code>
 +{
 +  "data": {
 +    "vendorProductQuestions": [
 +      {
 +        "questionText": "test question",
 +        "answerText": "test answer",
 +        "customerName": "test 1",
 +        "vendorId": "1",
 +        "vendorName": "vendor1",
 +        "visibility": "1",
 +        "questionDate": "2021-02-15 21:41:00",
 +        "answerDate": "2021-02-15 21:45:51"
 +      },
 +      {
 +        "questionText": "test 2 question",
 +        "answerText": "test 2 answer",
 +        "customerName": "test 2",
 +        "vendorId": "1",
 +        "vendorName": "vendor1",
 +        "visibility": "1",
 +        "questionDate": "2021-02-15 21:41:51",
 +        "answerDate": "2021-02-15 21:45:48"
 +      }
 +    ]
 +  }
 +}
 +</code>
 +
 +===== Ask product question to vendor =====
 +
 +Before run this mutation you need to obtain customer token via //generateCustomerToken// mutation [[https://devdocs.magento.com/guides/v2.4/graphql/mutations/generate-customer-token.html]] and use it in Authorization: Bearer <token> header.
 +
 +''
 +Example:
 +''
 +<code>
 +mutation {
 +  askProductQuestion (input: {
 +    vendorId: 3,
 +    sku: "24-MB01",
 +    email: "wtsergo@gmail.com",
 +    name: "gql test",
 +    question: "gql test question",
 +    visibility: 1
 +  })
 +}
 +</code>
 +''
 +RESPONSE
 +''
 +<code>
 +{
 +  "data": {
 +    "askProductQuestion": true
 +  }
 +}
 +</code>
 +
 +===== Get vendor reviews =====
 +
 +''
 +Example:
 +''
 +<code>
 +{
 +  vendorReviews(vendorId: 1) {
 +    detail
 +    nickname
 +    createdAt
 +    ratingVotes {
 +        ratingCode
 +        isAggregate
 +        percent
 +        value
 +    }
 +  }
 +}
 +</code>
 +''
 +RESPONSE
 +''
 +<code>
 +{
 +  "data": {
 +    "vendorReviews": [
 +      {
 +        "detail": "test 000000003 description",
 +        "nickname": "test",
 +        "createdAt": "2021-02-15 22:21:09",
 +        "ratingVotes": [
 +          {
 +            "ratingCode": "Vendor Quality",
 +            "isAggregate": "1",
 +            "percent": "80",
 +            "value": "4"
 +          },
 +          {
 +            "ratingCode": "Is Quality OK",
 +            "isAggregate": "0",
 +            "percent": "20",
 +            "value": "1"
 +          }
 +        ]
 +      },
 +      {
 +        "detail": "test 000000007-1 description",
 +        "nickname": "test",
 +        "createdAt": "2021-02-15 22:21:30",
 +        "ratingVotes": [
 +          {
 +            "ratingCode": "Vendor Quality",
 +            "isAggregate": "1",
 +            "percent": "60",
 +            "value": "3"
 +          },
 +          {
 +            "ratingCode": "Is Quality OK",
 +            "isAggregate": "0",
 +            "percent": "0",
 +            "value": "0"
 +          }
 +        ]
 +      },
 +      {
 +        "detail": "test 000000006-1 review details",
 +        "nickname": "test",
 +        "createdAt": "2021-02-15 22:21:53",
 +        "ratingVotes": [
 +          {
 +            "ratingCode": "Vendor Quality",
 +            "isAggregate": "1",
 +            "percent": "100",
 +            "value": "5"
 +          },
 +          {
 +            "ratingCode": "Is Quality OK",
 +            "isAggregate": "0",
 +            "percent": "20",
 +            "value": "1"
 +          }
 +        ]
 +      }
 +    ]
 +  }
 +}
 +</code>
 +
 +===== Add product to cart with specific vendor =====
 +
 +It's the same mutation with small extension to grapql CartItemInput 
 +
 +''
 +Example:
 +''
 +<code>
 +mutation {
 +  addSimpleProductsToCart(
 +    input: {
 +      cart_id: "{ CART_ID }"
 +      cart_items: [
 +        {
 +          data: {
 +            quantity: 1
 +            sku: "test"
 +            udropship_vendor: 1
 +          }
 +        }
 +      ]
 +    }
 +  ) {
 +    cart {
 +      items {
 +        id
 +        product {
 +          sku
 +          stock_status
 +        }
 +        quantity
 +        udropship_vendor
 +      }
 +    }
 +  }
 +}
 +</code>
 +''
 +RESPONSE
 +''
 +<code>
 +{
 +  "data": {
 +    "addSimpleProductsToCart": {
 +      "cart": {
 +        "items": [
 +          {
 +            "id": "102",
 +            "product": {
 +              "sku": "test",
 +              "stock_status": "IN_STOCK"
 +            },
 +            "quantity": 1,
 +            "udropship_vendor": 1
 +          }
 +        ]
 +      }
 +    }
 +  }
 +}
 +</code>
 +
 +
udropship/umarketplace/m2/vendor-info-graphql.1613667583.txt.gz · by wtsergo