App加Web项目 Opencart Api接口文档,简体版
添加購物車
接口描述
| URL | /index.php?route=checkout/cart/add |
| 功能描述 | 添加商品到購物車 |
| 返回格式 | Json,UTF8 |
| HTTP請求方式 | POST |
業務參數
| 參數名 | 參數全稱 | 必选 | 參數类型 | 參數描述 |
|---|---|---|---|---|
| product_id | product_id | true | Int | 商品 ID |
| quantity | quantity | true | Int | 數量 |
| option | option | true/false | Int | 選項 ID option[product_option_id] => product_option_value_id 如果選項字段required為 1 ,則option true,反之false 如:'option[298]' => 116,'option[299]' => 120 ...... |
调用示例
/index.php?route=checkout/cart/add
響應示例
{
"success": true,
"message": "",
"quantity": 1,
"total": "HK $125,845.00"
}更新購物車
接口描述
| URL | /index.php?route=checkout/cart/edit |
| 功能描述 | 更新購物車商品 |
| 返回格式 | Json,UTF8 |
| HTTP請求方式 | POST |
業務參數
| 參數名 | 參數全稱 | 必选 | 參數类型 | 參數描述 |
|---|---|---|---|---|
| quantity | quantity | true | Array | 數量 'quantity[cart_id]' => quantity 'quantity[10]' => 4, 'quantity[8]' => 2 ...... |
调用示例
/index.php?route=checkout/cart/edit
響應示例
{
"success": true,
"message": ""
}刪除購物車
接口描述
| URL | /index.php?route=checkout/cart/remove |
| 功能描述 | 刪除購物車商品 |
| 返回格式 | Json,UTF8 |
| HTTP請求方式 | POST |
業務參數
| 參數名 | 參數全稱 | 必选 | 參數类型 | 參數描述 |
|---|---|---|---|---|
| key | key | true | Int | 購物車 ID |
调用示例
/index.php?route=checkout/cart/remove
響應示例
{
"success": true,
"message":"您已成功更新了購物車!",
"quantity":8,
"total":"HK $378,969.00"
}獲取購物車下拉列表
接口描述
| URL | 獲取購物車下拉列表 |
| 功能描述 | /index.php?route=common/cart/infoapi |
| 返回格式 | Json,UTF8 |
| HTTP請求方式 | GET |
返回參數
| 參數名 | 參數全稱 | 必选 | 參數類型 | 參數描述 |
|---|---|---|---|---|
| cart_id | cart_id | true | Int | 購物車 ID |
| thumb | thumb | true | String | 圖片 |
| name | name | true | String | 名稱 |
| option | option | true | JSONArray | 選項列表 |
| quantity | quantity | true | Int | 數量 |
| price | price | true | String | 價格 |
| total | total | true | String | 總計 |
| totals | totals | true | JSONArray | 訂單總計 |
调用示例
/index.php?route=common/cart/infoapi
響應示例
{
"success": true,
"message": "",
"products": [
{
"cart_id": "8",
"thumb": "/image/cache/catalog/TB2fhHlb4vzQeBjSZFxXXXLBpXa_!!12883669.jpg_270x270-47x47.jpg",
"name": "女士服裝",
"model": "0",
"option": [
{
"name": "顏色",
"value": "粉紅",
"type": "select"
},
{
"name": "尺寸",
"value": "Small",
"type": "select"
}
],
"recurring": "",
"quantity": "1",
"price": "HK $288.00",
"total": "HK $288.00",
"href": "/index.php?route=product/product/api&product_id=76"
}
],
"totals": [
{
"title": "商品總額",
"text": "HK $288.00"
},
{
"title": "訂單總額",
"text": "HK $288.00"
}
]
}獲取購物車列表
接口描述
| URL | /index.php?route=checkout/cart/api |
| 功能描述 | 獲取購物車列表 |
| 返回格式 | Json,UTF8 |
| HTTP請求方式 | GET |
返回參數
| 參數名 | 參數全稱 | 必选 | 參數類型 | 參數描述 |
|---|---|---|---|---|
| weight | weight | true | String | 商品重量 |
| cart_id | cart_id | true | Int | 購物車 ID |
| thumb | thumb | true | String | 圖片 |
| name | name | true | String | 名稱 |
| option | option | true | JSONArray | 選項列表 |
| quantity | quantity | true | Int | 數量 |
| price | price | true | String | 價格 |
| total | total | true | String | 總計 |
| totals | totals | true | JSONArray | 訂單總計 |
调用示例
/index.php?route=checkout/cart/api
響應示例
{
"success": true,
"message": "",
"weight": "0.00kg",
"products": [
{
"cart_id": "18",
"thumb": "/image/cache/catalog/TB2fhHlb4vzQeBjSZFxXXXLBpXa_!!12883669.jpg_270x270-47x47.jpg",
"name": "女士服裝",
"model": "0",
"option": [
{
"name": "顏色",
"value": "粉紅"
},
{
"name": "尺寸",
"value": "Small"
}
],
"recurring": "",
"quantity": "1",
"stock": true,
"reward": "",
"price": "HK $288.00",
"total": "HK $288.00",
"href": "/index.php?route=product/product/api&product_id=76"
}
......
],
"totals": [
{
"title": "商品總額",
"text": "HK $576.00"
},
{
"title": "訂單總額",
"text": "HK $576.00"
}
]
}優惠券
接口描述
| URL | /index.php?route=extension/total/coupon/coupon |
| 功能描述 | 使用優惠券 |
| 返回格式 | Json,UTF8 |
| HTTP請求方式 | POST |
業務參數
| 參數名 | 參數全稱 | 必选 | 參數类型 | 參數描述 |
|---|---|---|---|---|
| coupon | coupon | true | String | 優惠券代碼 |
调用示例
/index.php?route=extension/total/coupon/coupon
響應示例
{
"success": true,
"message": ""
}
评论列表
发表评论
热评文章
相关阅读