首页 > 解决方案 > /api/v1/search/order - Sw 6.2.2 - 内部服务器错误

问题描述

我在 shopware 6.2.2 中使用 /api/v1/search/order Api。

这些是我的参数

{
   "page":1,
   "limit":10,
   "filter":[
      {
         "type":"range",
         "field":"orderDate",
         "parameters":{
            "gte":"2020-03-9"
         }
      }
   ],
   "aggregations":[
      {
         "type":"histogram",
         "name":"order_count_month",
         "field":"orderDateTime",
         "interval":"day",
         "aggregation":{
            "type":"sum",
            "name":"amountTotal",
            "field":"amountTotal"
         }
      }
   ]
}

我收到以下错误

{“错误”:[{“代码”:“0”,“状态”:“500”,“标题”:“内部服务器错误”,“详细信息”:“注意:未定义的索引:amountTotal”,“元”: {“跟踪”:[{“文件”:“/var/www/html/vendor/shopware/core/System/SalesChannel/Api/StructEncoder.php”,“行”:118,“函数”:“encodeStruct”, “类”:“Shopware\Core\System\SalesChannel\Api\StructEncoder”,“类型”:“->”,“args": [ { "key": "2020-04-29 00:00:00", "count": 1, "extensions": [], "amountTotal": { "sum": 19.99, "extensions": [] } }, 1, {} ] },[], "amountTotal": { "sum": 19.99, "extensions": [] } }, 1, {} ] },[], "amountTotal": { "sum": 19.99, "extensions": [] } }, 1, {} ] },

我怎样才能解决这个问题?

Shopware 仪表板中也存在此错误。因此 Shopware 6.2.2 仪表板中未显示销售、订单图表。

在此处输入图像描述

标签: apiinternal-server-errorshopware

解决方案


您的 API 需要定义“totalAmount”,并且您没有传递它,请在文档或您的代码中检查该参数的预期位置。


推荐阅读