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": "success",
"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": "success"
}删除购物车
接口描述
| URL | index.php?route=checkout/cart/remove |
| 功能描述 | 删除购物车商品 |
| 返回格式 | Json,UTF8 |
| HTTP请求方式 | POST |
业务参数
| 参数名 | 参数全称 | 必选 | 参数类型 | 参数描述 |
|---|---|---|---|---|
| key | key | true | Int | 购物车 ID |
调用示例
index.php?route=checkout/cart/remove
响应示例
{
"success":"您已成功更新了购物车!",
"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
响应示例
{
"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
响应示例
{
"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": "success"
}
评论列表
发表评论
热评文章
相关阅读