【问题标题】:Sylius ShopApiPlugin Can't add products to cartSylius ShopApiPlugin 无法将产品添加到购物车
【发布时间】:2018-12-27 16:18:52
【问题描述】:

我正在尝试使用为 Sylius 制作的 ShopApiPlugin 将产品添加到我的购物车。 当我尝试使用 json 正文通过 /carts/mytokenoid/items 添加产品时 { "productCode": "iphone9", "quantity": 5 }

我收到此回复

{
"tokenValue": "mytokenoid",
"channel": "US_WEB",
"currency": "EUR",
"locale": "en_US",
"checkoutState": "cart",
"items": [
    {
        "quantity": 5,
        "total": 4800,
        "product": {
            "code": "iphone9",
            "name": "iPhone 9",
            "slug": "iphone-9",
            "averageRating": 0,
            "taxons": {
                "others": []
            },
            "variants": [
                {
                    "code": "iphone9",
                    "axis": [],
                    "nameAxis": [],
                    "price": {
                        "current": 2000,
                        "currency": "EUR"
                    },
                    "images": []
                }
            ],
            "attributes": [],
            "associations": [],
            "images": []
        }
    }
],
"totals": {
    "total": 6896,
    "items": 4800,
    "taxes": 0,
    "shipping": 2096,
    "promotion": -5200
}, (...)

但是当我使用/shop-api/carts/mytokenoid 检查我的购物车内容时,它是空的,没有添加任何内容。我还检查了数据库,购物车在那里有正确的令牌但没有物品。 有谁知道我该如何解决这个问题?我已经尝试过使用授权令牌和没有。有同样的事情

【问题讨论】:

    标签: symfony sylius


    【解决方案1】:

    找到了解决方案。 您只需取消注释config/packages/league_tactician.yaml 中的“- tactician.middleware.doctrine”行

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-06-09
      • 1970-01-01
      • 2011-12-19
      • 2018-08-13
      • 2012-11-03
      • 1970-01-01
      相关资源
      最近更新 更多