如何使BigCommerce小部件与PageBuilder兼容 [英] How to make a BigCommerce widget compatible with PageBuilder

查看:75
本文介绍了如何使BigCommerce小部件与PageBuilder兼容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里遵循本教程 https://developer.bigcommerce.com/api-docs/storefront/widgets/widgets-tutorial

我通过执行对 https:的发布请求来制作了小部件模板://api.bigcommerce.com/stores/81mdugvyu5/v3/content/widget-templates 与此

I made the widget template by performing a post request to https://api.bigcommerce.com/stores/81mdugvyu5/v3/content/widget-templates with this in the body

{
  "name": "Header Images",
  "template": "{{#each images}}<a href='{{image_url}}'><img src={{image_source}} style='width:33.3%'/></a>{{/each}}"
}

响应成功.然后,我向 https://api.bigcommerce.com/stores执行了发布请求/81mdugvyu5/v3/content/widgets

The response was successful. I then performed a post request to https://api.bigcommerce.com/stores/81mdugvyu5/v3/content/widgets

将其植入体内

{
  "name": "Header Images",
  "widget_configuration": {
    "images": [
      {
        "image_url": "https://google.com",
        "image_source": "https://cdn11.bigcommerce.com/s-n0i50vy/images/stencil/1280x1280/products/91/309/thekinfolktablecover_1024x1024__80715.1456436719.jpg?c=2&imbypass=on"
      },
      {
        "image_url": "https://google.com",
        "image_source": "https://cdn11.bigcommerce.com/s-n0i50vy/images/stencil/1280x1280/products/109/361/kinfolkessentialissue_1024x1024__22507.1456436715.jpg?c=2&imbypass=on"
      },
      {
        "image_url": "https://google.com",
        "image_source": "https://cdn11.bigcommerce.com/s-n0i50vy/images/stencil/500x659/products/85/282/livingwithplants_grande__26452.1456436666.jpg?c=2&imbypass=on"
      }
    ]
  },
  "widget_template_uuid": "7c5f05c2-2361-45a3-bb99-89554dd145ee"
}

响应成功.我的自定义窗口小部件确实会出现在页面构建器中,但是当我尝试添加它时,会收到此错误

The response was successful. My custom widget does then appear in page builder but when I try to add it I receive this error

页面构建器不支持此小部件.请查阅我们的开发人员文档有关如何制作自己的更多信息与Page Builder兼容的小部件

This widget is not supported by Page Builder. Please consult our developer documentation for more information on how to make your widget compatible with Page Builder

当我访问开发人员文档时,它链接到有关如何使其与Page Builder兼容的链接,但我没有提到Page Builder.

When I visit the developer documentation it links to on how to make it compatible with Page Builder I don't see any mention of Page Builder.

有没有办法找出使教程小部件与Page Builder兼容的方法?

Is there any way to find out how to make the tutorial widget compatible with Page Builder?

推荐答案

@Mikhail是正确的.通过在我的窗口小部件模板后请求的主体中指定一个架构,我能够将其添加为页面构建器可访问的窗口小部件.在发送另一个请求并添加如下所示的架构后:

@Mikhail was correct. I was able to add it as a widget accessible by page builder by specifying a schema in the body of my widget-templates post request. After sending another request with the schema added like this:

{
  "name": "Header Images",
  "template": "{{#each images}}<a href='{{image_url}}'><img src={{image_source}} style='width:33.3%'/></a>{{/each}}",
  "schema": [
       {
      "type": "tab",
      "label": "Content",
      "sections": []
       }
    ]
}

有效.

您可以在此处 https://developer.bigcommerce.com/stencil-docs/page-builder/page-builder-overview

,您可以在此处 https://developer.bigcommerce.com/stencil-docs/page-builder/schema-settings

这篇关于如何使BigCommerce小部件与PageBuilder兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆