【问题标题】:How to add image url to Magento 2 Rest call “rest/V1/categories”?如何将图像 url 添加到 Magento 2 Rest 调用“rest/V1/categories”?
【发布时间】:2017-04-21 11:32:31
【问题描述】:

在 magento 2.1 中:

Categories Rest api "rest/V1/categories" 返回数据如下:

    {
  "id": 0,
  "parent_id": 0,
  "name": "string",
  "is_active": true,
  "position": 0,
  "level": 0,
  "product_count": 0,
  "children_data": [
    {}
  ]
}

如何修改它以包含类别图片

【问题讨论】:

    标签: php rest magento2


    【解决方案1】:

    如果您想要自定义属性,您可以使用/V1/categories/{id} API,您可以在custom_attributes 部分下找到图像。

    如果您需要将其放在类别列表中:

    您可以通过查看webapi.xmldi.xml 找到调用了哪个方法和模块。按照此处的代码,您可以看到代码将您带到the category tree

    所以你可以创建一个插件(拦截器)来添加你的字段。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-03-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多