App加Web项目 Opencart Api接口文档,简体版
历史订单
接口描述
| URL | index.php?route=account/order/api |
| 功能描述 | 历史订单 |
| 返回格式 | Json,UTF8 |
| HTTP请求方式 | GET |
返回参数
| 参数名 | 参数全称 | 必选 | 参数类型 | 参数描述 |
|---|---|---|---|---|
| order_id | order_id | true | Int | 订单 ID |
| name | name | true | String | 客户 |
| status | status | true | String | 订单状态 |
| date_added | date_added | true | String | 订单日期 |
| products | products | true | Int | 商品数量 |
| total | total | true | String | 合计 |
调用示例
index.php?route=account/order/api
响应示例
{
"orders": [
{
"order_id": "1",
"name": "admin test",
"status": "Complete",
"date_added": "2016/11/09",
"products": 1,
"total": "HK $0.00"
}
......
]
}商品分类
接口描述
| URL | index.php?route=common/home/categorieapi |
| 功能描述 | 获取商品分类列表 |
| 返回格式 | Json,UTF8 |
| HTTP请求方式 | GET |
返回参数
| 参数名 | 参数全称 | 必选 | 参数类型 | 参数描述 |
|---|---|---|---|---|
| name | name | true | String | 分类名称 |
| category_id | category_id | true | Int | 分类 ID |
| image | image | true | String | 图片 |
| href | href | true | String | 商品列表 API |
调用示例
index.php?route=common/home/categorieapi
响应示例
{
"categories": [
{
"name": "女士服装",
"category_id": "79",
"image": "image/cache/no_image-100x100.png",
"children": [],
"href": "index.php?route=product/category/api&path=79"
},
......
]
}获取商品列表
接口描述
| URL | index.php?route=product/category/api |
| 功能描述 | 根据分类 ID 获取商品列表 |
| 返回格式 | Json,UTF8 |
| HTTP请求方式 | GET |
业务参数
| 参数名 | 参数全称 | 必选 | 参数类型 | 参数描述 |
|---|---|---|---|---|
| path | path | true | Int | 分类 ID |
| page | page | false | Int | 查询第几页数据 |
| sort | sort | false | String | 排序方式:默认 p.sort_order pd.name 名称 p.price 价格 rating 评分 p.model 型号 |
| order | order | false | String | 升序排序:ASC 降序排序:DESC |
| limit | limit | false | Int | 每页返回结果数 默认:15 |
返回参数
| 参数名 | 参数全称 | 必选 | 参数类型 | 参数描述 |
|---|---|---|---|---|
| total | total | true | Int | 结果条数 |
| product_id | product_id | true | Int | 商品 ID |
| thumb | thumb | true | String | 图片地址 |
| name | name | true | String | 名称 |
| description | description | true | String | 描述 |
| price | price | true | String | 价格 |
| special | special | true | String | 优惠价格 |
| tax | tax | true | String | 价格含税 |
| minimum | minimum | true | Int | 最小起订数量 |
| rating | rating | true | Int | 评价 |
| href | href | true | String | 商品详细 API |
调用示例
index.php?route=product/category/api&path=79
响应示例
{
"total": "3",
"products": [
{
"product_id": "76",
"thumb": "image/cache/catalog/TB2fhHlb4vzQeBjSZFxXXXLBpXa_!!12883669.jpg_270x270-300x300.jpg",
"name": "女士服装",
"description": "...",
"price": "HK $300.00",
"special": "HK $288.00",
"tax": false,
"minimum": "1",
"rating": 0,
"href": "index.php?route=product/product/api&path=79&product_id=76"
},
......
],
"sort": "p.sort_order",
"order": "ASC",
"limit": "15"
}获取商品详细信息
接口描述
| URL | index.php?route=product/product/api |
| 功能描述 | 根据商品 ID 获取商品详细信息 |
| 返回格式 | Json,UTF8 |
| HTTP请求方式 | GET |
业务参数
| 参数名 | 参数全称 | 必选 | 参数类型 | 参数描述 |
|---|---|---|---|---|
| product_id | product_id | true | Int | 商品 ID |
返回参数
| 参数名 | 参数全称 | 必选 | 参数类型 | 参数描述 |
|---|---|---|---|---|
| stock | stock | true | String | 库存状况 |
| thumb | thumb | true | String | 图片 |
| images | images | true | JSONArray | 其他图片列表 |
| price | price | true | String | 价格 |
| special | special | true | String | 优惠价格 |
| tax | tax | true | String | 价格含税 |
| discounts | discounts | true | String | 促销活动 |
| options | options | true | JSONArray | 商品选项 |
| minimum | minimum | true | Int | 最小起订数量 |
| rating | rating | true | Int | 评价 |
| customer_name | customer_name | true | String | 顾客名称 |
| products | products | true | String | 相关商品列表 |
商品选项详细字段:options
| 父字段 | 字段 | 字段类型 | 字段描述 |
|---|---|---|---|
| options | product_option_id | Int | 商品选项 ID |
| product_option_value | JSONArray | 选项值列表 | |
| product_option_value | JSONArray | 选项值类别 | |
| option_id | Int | 选项 ID | |
| name | String | 选项名称 | |
| type | String | 选项类型 checkbox 复选框 select 选择 radio 单选 | |
| required | Int | 是否必填 | |
| sort_order | Int | 排序 |
选项值列表详细字段:product_option_value
| 父字段 | 字段 | 字段类型 | 字段描述 |
|---|---|---|---|
| product_option_value | product_option_value_id | Int | 商品选项值列表 ID |
| option_value_id | Int | 选项值列表 ID | |
| name | String | 名称 | |
| image | String | 选项缩略图 | |
| option_image | String | 商品选项图 | |
| price | String | 价格 | |
| quantity | Int | 数量 | |
| price_prefix | String | 价格 + 加 - 减 |
调用示例
index.php?route=product/product/api&path=79&product_id=76
响应示例
{
"stock": "有现货",
"thumb": "image/cache/catalog/TB2fhHlb4vzQeBjSZFxXXXLBpXa_!!12883669.jpg_270x270-200x200.jpg",
"images": [
{
"popup": null
}
......
],
"price": "HK $300.00",
"special": "HK $288.00",
"tax": false,
"discounts": [],
"options": [
{
"product_option_id": "298",
"product_option_value": [
{
"product_option_value_id": "116",
"option_value_id": "76",
"name": "白色",
"image": null,
"option_image": "image/cache/catalog/TB2AWIgb8PzQeBjSZFLXXa3cXXa_!!2069568072.jpg_250x250-100x100.jpg",
"price": "HK $125,555.00",
"quantity": "8888",
"price_prefix": "+"
},
{
"product_option_value_id": "117",
"option_value_id": "77",
"name": "黑色",
"image": null,
"option_image": "image/cache/catalog/TB1gZq2LpXXXXaHXXXXXXXXXXXX_!!0-item_pic.jpg_250x250-100x100.jpg",
"price": false,
"quantity": "999",
"price_prefix": "+"
},
{
"product_option_value_id": "118",
"option_value_id": "78",
"name": "粉红",
"image": null,
"option_image": "image/cache/catalog/TB2m4GCaRaM.eBjSZFMXXcypVXa_!!2137685604.jpg_250x250-100x100.jpg",
"price": false,
"quantity": "9999",
"price_prefix": "+"
}
......
],
"option_id": "26",
"name": "颜色",
"type": "select",
"value": "",
"required": "1",
"sort_order": "1"
},
{
"product_option_id": "299",
"product_option_value": [
{
"product_option_value_id": "121",
"option_value_id": "79",
"name": "Small",
"image": null,
"option_image": null,
"price": false,
"quantity": "999",
"price_prefix": "+"
},
{
"product_option_value_id": "120",
"option_value_id": "80",
"name": "Medium",
"image": null,
"option_image": null,
"price": false,
"quantity": "999",
"price_prefix": "+"
},
{
"product_option_value_id": "119",
"option_value_id": "81",
"name": "Large",
"image": null,
"option_image": null,
"price": false,
"quantity": "999",
"price_prefix": "+"
}
],
"option_id": "27",
"name": "尺寸",
"type": "select",
"value": "",
"required": "1",
"sort_order": "2"
}
......
],
"minimum": "1",
"review_status": "1",
"review_guest": true,
"customer_name": "admin test",
"reviews": "0 评价",
"rating": 0,
"captcha": "index.php?route=extension/captcha/basic_captcha/captcha",
"attribute_groups": [],
"products": [],
"recurrings": []
}
评论列表
发表评论
热评文章
相关阅读