makaira / magento2-connect
Makaira 无头扩展插件适用于 Magento 2
dev-stable
2021-03-30 15:35 UTC
Requires
- php: ^7.1
- magento/framework: >=101.0.0
- magento/module-catalog: >=102.0.0
- magento/module-configurable-product: >=100.2.0
- magento/module-directory: >=100.2.0
- magento/module-store: >=100.2.0
- magento/zendframework1: ^1.13
Requires (Dev)
- magento/magento-coding-standard: ^6.0
- pdepend/pdepend: >=2.5.1
- phpmd/phpmd: ^2.9
This package is not auto-updated.
Last update: 2024-09-11 08:20:22 UTC
README
本文件帮助您将 Makaira 无头扩展插件集成到您的 Magento 2 商店中。
目录
要求
本模块支持
- Magento 2 版本 2.2 及更高版本
- PHP 版本 7.1 及更高版本
警告:不支持 PHP 7.0
安装
要安装模块,请打开您的终端并运行以下命令
composer require makaira/magento2-connect:dev-main
有关更多信息,请参阅 Composer 手册。如果由于某些原因 composer
不可用,请按照项目网站上的说明进行安装:项目网站。
激活模块
从您的 Magento 2 安装根目录开始,按顺序输入以下命令
php bin/magento module:enable Makaira_Headless
php bin/magento setup:upgrade
作为最后一步,通过运行以下命令来检查模块激活
php bin/magento module:status
模块现在应出现在上方的列表 已启用模块列表 中。
这就完成了,您已经准备好开始使用了!
API 端点示例
以下所有示例均为 application/json
内容类型。PUT、DELETE 和 POST 方法需要带有有效 JSON 的原始正文。
购物车操作
获取所有购物车商品
GET /makaira/cart/
Response:
{
"success": true,
"cart": {
"items": [],
"total": 0
}
}
将商品添加到购物车
POST /makaira/cart/
Body:
{
"sku": "24-MB04",
"quantity": "1"
}
Response:
{
"success": true,
"cart": {
"items": [
{
"sku": "24-MB04",
"name": "Strive Shoulder Pack",
"quantity": 1,
"price": 32
}
],
"total": 32
}
}
从购物车中删除商品
DELETE /makaira/cart/
Body:
{
"sku": "24-MB04"
}
Response:
{
"success": true,
"message": "Der Artikel wurde entfernt.",
"sku": "24-MB04"
}
更改购物车中商品的数量
PUT /makaira/cart/
Body:
{
"sku": "24-MB04",
"quantity": "3"
}
Response:
{
"success": true,
"cart": {
"items": [
{
"sku": "24-MB04",
"name": "Strive Shoulder Pack",
"quantity": 3,
"price": 32
}
],
"total": 96
}
}
用户操作
获取当前登录用户
GET /makaira/user/
Response:
{
"success": true,
"user": null
}