# Chi tiết sản phẩm

img

# Thông tin chi tiết sản phẩm - Done

Sử dụng APi này để lấy thông tin sản phẩm cơ bản

img

  • Sử dụng 'variantTemplates' để hiển thị cách thuộc tính
  • Khi người dùng chọn 1 bộ thuộc tính, Check trong 'variantProducts' với 'variantsId' phù hợp để đưa ra price, stock, discountRate, soldQuantity

# Endpoint

# Parameters

Name Type Description Required
id String mã sản phẩm ✔️
slug String slug ✔️

# Response

{
  "status": true,
  "messageCode": "success",
  "messageContent": "success",
  "data": {
    "id": 1,
    "name": "Đèn LED Exit Chỉ dẫn 2 mặt 2W",
    "slug": "den-led-exit-chi-dan-2-mat-2w",
    "eic": "RAD-LED-817155",
    "supplierName": "Rạng đông",
    "content": null,
    "categoryPath": [
            {
                "id": "30",
                "name": "ĐÈN LED  ",
                "slug": "den-led"
            },
            {
                "id": "48",
                "name": "Đèn Exit, khẩn cấp, thoát hiểm LED",
                "slug": "den-exit-khan-cap-thoat-hiem-led"
            }
        ],
    "images": "https://d3p5dsvnajipiv.cloudfront.net/images/products/product_241/D_CD01 40x20_2,2W_1.jpg",
    "price": 2520000,
    "stock": -1,
    "soldQuantity": 1,
    "discountRate": "0",
    "moq": 1,
    "variantProducts": [
      {
        "id": 25,
        "price": 99000,
        "discountRate": 0,
        "stock": 123,
        "soldQuantity": 33,
        "sku": "zxc",
        "variantValues": {
          "variantsId": "8|6"
        }
      },
      ...
    ],
    "variantTemplates": [
      {
        "id": 1,
        "variantGroup": {
          "id": 2,
          "name": "Size",
          "variants": [
            {
              "id": 8,
              "name": "L"
            },
          ...
          ]
        }
      },
      {
        "id": 24,
        "variantGroup": {
          "id": 3,
          "name": "Color",
          "variants": [
            {
              "id": 6,
              "name": "white"
            },
           ...
          ]
        }
      }
    ],
    "tags": [
      {
        "id": 1,
        "name": "Handmade Fresh Shirt",
        "slug": "handmade-fresh-shirt"
      },
     ...
    ]
  }
}
curl -X POST http://localhost:3000/product/ei/getDetailInfo \
  -H 'Content-Type: application/json' \
  --data '{
    "id": "1",
    "slug": "den-led-exit-chi-dan-2-mat-2w"
  }'

# Thêm vào giỏ - Done

Sử dụng API này để thêm một sản phẩm vào giỏ hàng (nếu sản phẩm đã tồn tại thì chỉ cần tăng sô lượng sản phẩm)

# Endpoint

# Parameters

Name Type Description Required
Required parameters Number :userId:
Required parameters Number :productId:
Required parameters Number :quantity:

# Response

Trả về giỏ hàng sau khi thêm

{
  "status": true,
  "message": "success",
  "data": {
    "id": 31,
    "userId": 5,
    "totalQty": 15,
    "deleted": false,
    "createdAt": "2021-07-16T04:51:47.000Z",
    "updatedAt": "2021-07-16T10:45:35.000Z",
    "items": [
      {
        "id": 74,
        "productId": 104,
        "cartId": 31,
        "quantity": 5,
        "deleted": false,
        "createdAt": "2021-07-16T04:52:49.000Z",
        "updatedAt": "2021-07-16T04:52:53.000Z",
        "product": {
          "id": 104,
          "name": "Practical Steel Chair",
          "slug": "practical-steel-chair",
          "eic": null,
          "mpn": "2",
          "uom": null,
          "companyId": 0,
          "supplierId": 1,
          "description": "The automobile layout consists of a front-engine design, with transaxle-type transmissions mounted at the rear of the engine and four wheel drive",
          "specification": null,
          "categoryId": 9,
          "images": "http://placeimg.com/640/480",
          "tags": null,
          "price": 2151320,
          "supplierPrice": null,
          "promotionCode": null,
          "warrantyZone": null,
          "shipMethodId": 0,
          "specialRequest": null,
          "rate": 0,
          "brand": null,
          "deleted": 1,
          "createdBy": 5,
          "updatedBy": 3,
          "createdAt": "2021-06-17T08:04:19.000Z",
          "updatedAt": "2021-07-16T08:15:42.788Z"
        }
      },
      {
        "id": 78,
        "productId": 103,
        "cartId": 31,
        "quantity": 4,
        "deleted": false,
        "createdAt": "2021-07-16T05:13:46.000Z",
        "updatedAt": "2021-07-16T05:13:49.000Z",
        "product": {
          "id": 103,
          "name": "Small Concrete Salad",
          "slug": "small-concrete-salad",
          "eic": null,
          "mpn": "Spyder",
          "uom": null,
          "companyId": 0,
          "supplierId": 1,
          "description": "The Nagasaki Lander is the trademarked name of several series of Nagasaki sport bikes, that started with the 1984 ABC800J",
          "specification": null,
          "categoryId": 4,
          "images": "http://placeimg.com/640/480",
          "tags": null,
          "price": 5821940,
          "supplierPrice": null,
          "promotionCode": null,
          "warrantyZone": null,
          "shipMethodId": 0,
          "specialRequest": null,
          "rate": 0,
          "brand": null,
          "deleted": 1,
          "createdBy": 10,
          "updatedBy": 3,
          "createdAt": "2021-06-17T08:04:19.000Z",
          "updatedAt": "2021-07-16T08:16:15.512Z"
        }
      },
      {
        "id": 79,
        "productId": 105,
        "cartId": 31,
        "quantity": 6,
        "deleted": false,
        "createdAt": "2021-07-16T05:13:58.000Z",
        "updatedAt": "2021-07-16T10:45:35.000Z",
        "product": {
          "id": 105,
          "name": "Small Cotton Table",
          "slug": "small-cotton-table",
          "eic": null,
          "mpn": "Escalade",
          "uom": null,
          "companyId": 0,
          "supplierId": 1,
          "description": "The Football Is Good For Training And Recreational Purposes",
          "specification": null,
          "categoryId": 9,
          "images": "http://placeimg.com/640/480",
          "tags": null,
          "price": 6461960,
          "supplierPrice": null,
          "promotionCode": null,
          "warrantyZone": null,
          "shipMethodId": 0,
          "specialRequest": null,
          "rate": 0,
          "brand": null,
          "deleted": 1,
          "createdBy": 9,
          "updatedBy": 3,
          "createdAt": "2021-06-17T08:04:19.000Z",
          "updatedAt": "2021-07-16T08:15:43.839Z"
        }
      }
    ]
  }
}
curl -X POST http://localhost:3000/cart/ei/addToCart \
  -H 'Content-Type: application/json' \
  --data '{
     "userId" : 5,
     "productId": 105,
     "quantity": 1
  }'

# Thêm vào mua lại - Done

Sử dụng API này để khách hàng thêm sản phẩm vào wish list, khi khách hàng đã đăng nhập

# Endpoint

# Parameters

Name Type Description Required
productId Number ✔️
quantity Number ✔️

# Response

{
  "status": true,
  "messageCode": "",
  "messageContent": "",
  "data": {
    "totalCnt": 1,
    "items": {
      "deleted": false,
      "updatedBy": null,
      "id": 3,
      "quantity": 15,
      "productId": 1,
      "customerId": 1,
      "createdBy": 1,
      "updatedAt": "2021-07-26T03:27:12.171Z",
      "createdAt": "2021-07-26T03:27:12.171Z"
    }
  }
}
curl -X POST http://localhost:3000/customerWishList/ei/add \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <const name="MOCK_TOKEN" />' \
  --data '{
    "productId": 1,
    "quantity": 15
  }'

# Thông tin Mô Tả

Sử dụng APi này để lấy Thông tin + Mô Tả + Hồ sơ Nhà Cung cấp img

# Endpoint

# Parameters

Name Type Description Required
id String mã sản phẩm ✔️
slug String slug ✔️

# Response


curl -X POST http://localhost:3000/product/ei/getDetailInfo \
  -H 'Content-Type: application/json' \
  --data '{
    "id": "1",
    "slug": "den-led-exit-chi-dan-2-mat-2w"
  }'

# Nhận xét

Sử dụng APi này để lấy Thông tin Nhận xét img

# Endpoint

# Parameters

Name Type Description Required
id String mã sản phẩm ✔️
slug String slug ✔️

# Response


curl -X POST http://localhost:3000/product/ei/getDetailInfo \
  -H 'Content-Type: application/json' \
  --data '{
    "id": "1",
    "slug": "den-led-exit-chi-dan-2-mat-2w"
  }'

# Sản phẩm liên quan - Done

Sử dụng APi này để lấy Thông tin Sản phẩm liên quan

# Endpoint

# Parameters

Name Type Description Required
id String mã sản phẩm ✔️
slug String slug ✔️

# Response

{
  "status": true,
  "messageCode": "success",
  "messageContent": "success",
  "data": {
    "upSells": [
      {
        "id": 73772,
        "name": "Demo 1",
        "eic": "FAC-HSE-389125",
        "mpn": null,
        "uom": null,
        "companyId": 0,
        "images": "https://ei-dev-store.s3.amazonaws.com/Product/1/256/dayhan.jpg#146#undefined#undefined#undefined",
        "tags": "54|43",
        "price": 99000,
        "promotionCode": null,
        "rate": 0,
        "brandId": 0
      },
      {
        "id": 30576,
        "name": "Cáp hàn Kiseong 16123",
        "eic": "EII-RAW-396781",
        "mpn": null,
        "uom": null,
        "companyId": 1,
        "images": "https://d3p5dsvnajipiv.cloudfront.net/images/products/product_39722/cap-han-kiseong-16.jpg#undefined#undefined",
        "tags": "",
        "price": 89000,
        "promotionCode": null,
        "rate": 0,
        "brandId": 0
      },
      {
        "id": 73728,
        "name": "Găng tay nilon dùng một lần",
        "eic": "EII-HSE-724213",
        "mpn": null,
        "uom": null,
        "companyId": 1,
        "images": "https://d3p5dsvnajipiv.cloudfront.net/images/thumbnails/gang-tay-nilong-dung-mot-lan-1.1.jpg",
        "tags": null,
        "price": 8500,
        "promotionCode": null,
        "rate": 0,
        "brandId": 0
      }
    ],
    "grouping": [
      {
        "id": 193,
        "name": "Bộ đèn LED Âm trần 300x1200 M15 36W",
        "eic": "RAD-LED-499974",
        "mpn": null,
        "uom": null,
        "companyId": 1,
        "images": "https://d3p5dsvnajipiv.cloudfront.net/images/products/product_545/LED_M15L_30x120_36W_7.jpg",
        "tags": null,
        "price": 765600,
        "promotionCode": null,
        "rate": 0,
        "brandId": 0
      },
      {
        "id": 194,
        "name": "Bộ đèn LED Âm trần 600x1200 M15 72W",
        "eic": "RAD-LED-428920",
        "mpn": null,
        "uom": null,
        "companyId": 1,
        "images": "https://d3p5dsvnajipiv.cloudfront.net/images/products/product_546/LED_M15L_60x120_72W_1.jpg",
        "tags": null,
        "price": 1128160,
        "promotionCode": null,
        "rate": 0,
        "brandId": 0
      },
      {
        "id": 195,
        "name": "Bộ đèn LED Âm trần 600x600 M15 36W",
        "eic": "RAD-LED-644681",
        "mpn": null,
        "uom": null,
        "companyId": 1,
        "images": "https://d3p5dsvnajipiv.cloudfront.net/images/products/product_547/LED_M15L_60x60_36W_1.jpg",
        "tags": null,
        "price": 765600,
        "promotionCode": null,
        "rate": 0,
        "brandId": 0
      },
      {
        "id": 196,
        "name": "Bộ đèn LED Âm trần 300x1200 M15 36W",
        "eic": "RAD-LED-936643",
        "mpn": null,
        "uom": null,
        "companyId": 1,
        "images": "https://d3p5dsvnajipiv.cloudfront.net/images/products/product_548/LED_M15L_30x120_36W_7.jpg",
        "tags": null,
        "price": 765600,
        "promotionCode": null,
        "rate": 0,
        "brandId": 0
      }
    ]
  }
}
curl -X POST http://localhost:3000/product/ei/getProductRelated \
  -H 'Content-Type: application/json' \
  --data '{
    "id": "39913",
    "slug": "yem-chiu-nhiet-khong-tay-trang-nhom-39x27inch-blue-eagle-al7"
  }'

# Get Supplier By ProductId

Sử dụng API này để lấy thông tin chi tiết nhà cung cấp của sản phẩm

# Endpoint

# Parameters

Name Type Description Required
productId Number ✔️

# Response

{
  "status": true,
  "message": "success",
  "totalRows": 1,
  "rows": {
    "id": 241,
    "name": "Đèn LED Exit Chỉ dẫn 2 mặt 2W",
    "slug": "den-led-exit-chi-dan-2-mat-2w",
    "eic": "RAD-LED-817155",
    "mpn": null,
    "uom": null,
    "companyId": 1,
    "supplierId": 1,
    "description": "<html><head></head><body><div role=\"tabpanel\" class=\"tab-pane active\" id=\"ud\"> <h1 style=\"text-align: center;\"><a href=\"#\">&nbsp;</a></h1></div><a href=\"#\"> <!-- Kết thúc 1 thuộc tính -->                 \n\n</a><a href=\"#\">http://example.com</a></body></html>",
    "content": null,
    "specification": "<div role=\"tabpanel\" class=\"tab-pane table-responsive\" id=\"tskt\">                     <!-- Bắt đầu 1 thuộc tính--> <div class=\"col-sm-6\"> <div style=\"width:100%; height:auto\"> <p style=\"font-weight:bold; font-size:20px\">Đặc t&iacute;nh của đ&egrave;n</p>  <div style=\"width:100%; height:auto; border-color:#CCC; background-color:#D7FDE6; padding:10px; line-height:40px\"> <table border=\"0\" cellpadding=\"4\" cellspacing=\"4\" width=\"100%\"> \t<tbody> \t\t<tr> \t\t\t<td>C&ocirc;ng suất</td> \t\t\t<td>2,2W</td> \t\t</tr> \t\t<tr> \t\t\t<td>Nguồn điện danh định</td> \t\t\t<td>220V/50Hz</td> \t\t</tr> \t\t<tr> \t\t\t<td>Thời gian chiếu s&aacute;ng dự ph&ograve;ng</td> \t\t\t<td>3 giờ</td> \t\t</tr> \t</tbody> </table> </div> </div> </div> <!-- Kết thúc 1 thuộc tính --><!-- THÔNG SỐ ĐIỆN -->  <div class=\"col-sm-6\"> <div style=\"width:100%; height:auto\"> <p style=\"font-weight:bold; font-size:20px\">Th&ocirc;ng số điện</p>  <div style=\"width:100%; height:auto; border-color:#CCC; background-color:#D7FDE6; padding:10px; line-height:40px\"> <table border=\"0\" cellpadding=\"4\" cellspacing=\"4\" width=\"100%\"> \t<tbody> \t\t<tr> \t\t\t<td>Dung lượng pin</td> \t\t\t<td>400 mAh</td> \t\t</tr> \t\t<tr> \t\t\t<td>Thời gian nạp đầy</td> \t\t\t<td>20 giờ</td> \t\t</tr> \t</tbody> </table> </div> </div> </div>  <div class=\"divClear\">&nbsp;</div> <!-- Kết thúc 1 thuộc tính --><!-- TUỔI THỌ -->  <div class=\"col-sm-6\"> <div style=\"width:100%; height:auto\"> <p style=\"font-weight:bold; font-size:20px\">Tuổi thọ</p>  <div style=\"width:100%; height:auto; border-color:#CCC; background-color:#D7FDE6; padding:10px; line-height:40px\"> <table border=\"0\" cellpadding=\"4\" cellspacing=\"4\" width=\"100%\"> \t<tbody> \t\t<tr> \t\t\t<td>Tuổi thọ của đ&egrave;n</td> \t\t\t<td>15.000 giờ</td> \t\t</tr> \t\t<tr> \t\t\t<td>Số chu kỳ tắt/bật</td> \t\t\t<td>50.000 lần</td> \t\t</tr> \t</tbody> </table> </div> </div> </div>  <div class=\"divClear\">&nbsp;</div> <!-- Kết thúc 1 thuộc tính --><!-- KÍCH THƯỚC -->  <div class=\"col-sm-6\"> <div style=\"width:100%; height:auto\"> <p style=\"font-weight:bold; font-size:20px\">K&iacute;ch thước của đ&egrave;n</p>  <div style=\"width:100%; height:auto; border-color:#CCC; background-color:#D7FDE6; padding:10px; line-height:40px\"> <table border=\"0\" cellpadding=\"4\" cellspacing=\"4\" width=\"100%\"> \t<tbody> \t\t<tr> \t\t\t<td>Chiếu d&agrave;i</td> \t\t\t<td>370 mm</td> \t\t</tr> \t\t<tr> \t\t\t<td>Chiều rộng</td> \t\t\t<td>25 mm</td> \t\t</tr> \t\t<tr> \t\t\t<td>Chiều cao</td> \t\t\t<td>202 mm</td> \t\t</tr> \t</tbody> </table> </div> </div> </div> <!-- Kết thúc 1 thuộc tính --><!-- Bắt đầu 1 thuộc tính -->  <div class=\"col-sm-6\"> <div style=\"width:100%; height:auto\"> <p style=\"font-weight:bold; font-size:20px\">Đặc điểm kh&aacute;c</p>  <div style=\"width:100%; height:auto; border-color:#CCC; background-color:#D7FDE6; padding:10px; line-height:40px\"> <table border=\"0\" cellpadding=\"4\" cellspacing=\"4\" width=\"100%\"> \t<tbody> \t\t<tr> \t\t\t<td>H&agrave;m lượng thủy ng&acirc;n</td> \t\t\t<td>0 mg</td> \t\t</tr> \t\t<tr> \t\t\t<td>Thời gian khởi động của đ&egrave;n</td> \t\t\t<td>&lt; 0,5 gi&acirc;y</td> \t\t</tr> \t</tbody> </table> </div> </div> </div> <!-- Kết thúc 1 thuộc tính -->  <div class=\"divClear\">&nbsp;</div>  <div class=\"divClear\">&nbsp;</div>  <div style=\"width:100%; height:30px\">&nbsp;</div> <!-- Kết thúc 1 thuộc tính -->                 </div>\r\n",
    "categoryId": 48,
    "images": "https://ei-dev-store.s3.amazonaws.com/Product/1/48/den-led-exit-chi-dan-2-mat-2w.jpg#51057",
    "thumbnail": "https://ei-dev-store.s3.amazonaws.com/Product/1/48/den-led-exit-chi-dan-2-mat-2w.jpg#51057",
    "tags": null,
    "price": 2520000,
    "supplierPrice": 2520000,
    "promotionCode": null,
    "warrantyZone": null,
    "shipMethodId": 0,
    "specialRequest": null,
    "rate": 0,
    "brandId": 0,
    "deleted": 0,
    "createdBy": 1,
    "updatedBy": 1,
    "startDate": "2021-08-04T12:02:58.419Z",
    "endDate": null,
    "upSellId": null,
    "groupingId": null,
    "crossSellIds": null,
    "productCustomIds": null,
    "variantTemplateTypeId": null,
    "stock": -1,
    "soldQuantity": 0,
    "moq": 1,
    "discountRate": "0",
    "categoryPath": "[{\"id\":48,\"name\":\"Đèn Exit, khẩn cấp, thoát hiểm LED\",\"slug\":\"den-exit-khan-cap-thoat-hiem-led\"}]",
    "supplierName": null,
    "companyName": null,
    "brandName": null,
    "productPackingId": null,
    "unitId": null,
    "createdAt": "2021-08-04T12:02:57.000Z",
    "updatedAt": "2021-08-04T12:02:57.000Z",
    "supplier": {
      "id": 1,
      "name": "Rạng đông",
      "slug": null,
      "address": "Số 87-89, Phố Hạ Đình, Phường Thanh Xuân Trung, Quận Thanh Xuân, Hà Nội",
      "email": "rangdong.cskh@gmail.com",
      "phone": "0942 669 678",
      "company": "Rạng đông",
      "taxCode": null,
      "code": "RAD",
      "shortDesc": null,
      "desc": null,
      "type": 2,
      "deleted": 0,
      "status": 1,
      "createdBy": 1,
      "updatedBy": 1,
      "createdAt": "2021-07-19T02:08:14.000Z",
      "updatedAt": "2021-07-19T02:08:14.000Z"
    }
  }
}
curl -X POST http://localhost:3000/product/ei/getSupplier \
  -H 'Content-Type: application/json' \
  --data '{
        "productId" : 241
    }'

# Get Customer Follow Supplier

Sử dụng API này để khi Customer ấn nút theo dõi Supplier, hoặc ấn để hủy theo dõi nếu đã theo dõi trước đó. Sử dụng Khi Customer đã đăng nhập.

# Endpoint

# Parameters

Name Type Description Required
supplierId Number ✔️

# Response

{
  "status": true,
  "messageCode": "",
  "messageContent": "",
  "data": {
    "totalCnt": 1,
    "items": {
      "createdAt": {
        "val": "CURRENT_TIMESTAMP(3)"
      },
      "updatedAt": {
        "val": "CURRENT_TIMESTAMP(3)"
      },
      "deleted": false,
      "id": 17,
      "customerId": 13,
      "supplierId": 1,
      "createdBy": 13
    }
  }
}
curl -X POST http://localhost:3000/customer/ei/followSupplier \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <const name="MOCK_TOKEN" />' \
  --data '{
      "supplierId": 1
    }'

# Check If The Customer Has Followed The Supplier

Sử dụng API này để kiểm tra Customer đã theo dõi Supplier hay chưa. Sử dụng Khi Customer đã đăng nhập.

# Endpoint

# Parameters

Name Type Description Required
supplierId Number ✔️

# Response

{
  "status": true,
  "messageCode": "",
  "messageContent": "followed",
  "data": {
    "totalCnt": 0,
    "items": {
      "id": 17,
      "customerId": 13,
      "supplierId": 1,
      "createdAt": "2021-08-04T11:57:28.411Z",
      "updatedAt": "2021-08-04T11:57:28.411Z",
      "createdBy": 13,
      "updatedBy": null,
      "deleted": false
    }
  }
}
curl -X POST http://localhost:3000/customer/ei/isFollowed \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <const name="MOCK_TOKEN" />' \
  --data '{
      "supplierId": 1
    }'