【发布时间】:2020-11-21 09:38:53
【问题描述】:
在后端我定义了几个自定义字段,它们都是选择类型,这些都与产品相关联。现在我想在详细页面中显示 product.customFields 的选定选项的值。
我可以转储 product.customFields 并获得这样的数组:
product.customFields array [
technical_name_select_field_1 => option_xxx
technical_name_select_field_2 => option_123
]
现在我如何获取存储在 custom_field 中的值作为 json 对象,用 name = Technical_name_select_field_1 和 config = {{"type": "select", "label": {"de-DE": “Wert für option xxx”、“en-US”:“option xxx 的值”、“nl-NL”:“Waarde optie xxx”)、“value”:“option_xxx”} 等。
当我在模板中写 {{ attribute(product.translated.customFields,'technical_name_select_field_1')|sw_sanitize }} 时,我会打印 option_xxx。但我想查看标签值“选项 xxx 的值”等。
【问题讨论】: