Shopware 6:如何添加到自定义插件配置单序列中的国家列表
对于创建单选项列表,我们有:
<input-field type="single-select">
<name>currentCountry</name>
<label>Current country</label>
<required>true</required>
<options>
<option>
<id>..</id>
<name>...</name>
</option>
<option>
...
</option>
</options>
</input-field>
但是,如果我们想显示SW中已经存在的国家列表,该怎么办?
我们可以指定实体的来源,以便将其转换为所需的格式吗? 在Magento 2中,我们有这样的机会,SW是否支持类似的东西,或者在某个阶段可以替代必要的数据以便不在XML中形成永久列表?
For the creation single select list we have:
<input-field type="single-select">
<name>currentCountry</name>
<label>Current country</label>
<required>true</required>
<options>
<option>
<id>..</id>
<name>...</name>
</option>
<option>
...
</option>
</options>
</input-field>
But what if we want to show the list of countries that already exist in SW?
Can we specify the source of the entity so that it can be transformed into the desired format?
In Magento 2, we have such an opportunity, does SW support something similar, or is it possible at some stage to substitute the necessary data there so as not to form a permanent list in xml?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以具有自定义组件并将所需的实体传递给它。
It's written within the Documentation - There's an example for an
只需在
&lt; entity&gt;
中指定实体 - 在这种情况下,实体被称为country 。您可以看一下 。
因此,一个完整的工作示例是:
示例屏幕:
You can have a custom component and pass the required entity to it.
It's written within the Documentation - There's an example for an Entity single select for products
Just specify the Entity within
<entity>
- The entity in this case is calledcountry
. You can take a look at the CountryDefinition.So a full working example would be:
Example Screen: