chernecov/cart-bundle

购物车组件。

安装: 9

依赖项: 0

建议者: 0

安全性: 0

星标: 3

关注者: 2

分支: 0

开放问题: 0

类型:symfony-bundle

dev-master 2014-10-27 19:31 UTC

This package is not auto-updated.

Last update: 2024-09-24 03:08:41 UTC


README

Symfony 组件。

提供基本的购物车功能。基于 FOSRestBundle, HateoasBundle, NelmiApiDocBundle...

添加商品到购物车

POST 请求到 /cart/item/add

{
  "title": "Tiffany heart signet ring in sterling silver.",
  "price": 158,
  "quantity": 2,
  "related_id": 74485
}

你可以通过以下URL获取购物车:/cart/content?_embedded=true

{
    "cart_id": "ea98738c",
    "channel": "default",
    "_links": {
        "self": {
            "href": "/cart/content",
            "method": "GET"
        },
        "clear": {
            "href": "/cart/clear",
            "method": "DELETE"
        }
    },
    "_embedded": {
        "items": [
            {
                "id": "46894fe9",
                "title": "Tiffany heart signet ring in sterling silver.",
                "price": 158,
                "quantity": 2,
                "related_id": 74485,
                "_links": {
                    "delete": {
                        "href": "/cart/item/46894fe9/remove",
                        "method": "DELETE"
                    },
                    "quantity": {
                        "href": "/cart/item/46894fe9/quantity/{quantity}",
                        "templated": true,
                        "method": "PATCH"
                    },
                    "patch": {
                        "href": "/cart/item/46894fe9/modify",
                        "templated": true,
                        "method": "PATCH",
                        "data": {
                            "json": [
                                "title",
                                "price",
                                "count",
                                "relatedId"
                            ]
                        }
                    }
                }
            }
        ]
    }
}