尝试在 orocommerce 中创建自定义块类型,但我得到:无法加载块类型“product_variants”。
我在 Resources/config/block_types.yml 中创建了 block_types yml 文件
services:
xngage_product.layout.block_type.product_variants:
parent: oro_layout.block_type.abstract_configurable_container
calls:
- [setOptionsConfig, [{variants: {required: true}}]]
- [setName, ['product_variants']]
tags:
- { name: layout.block_type, alias: product_variants }
xngage_product.layout.block_type_extension.product_variants:
class: Xngage\ProductBundle\Layout\Extension\ProductVariantsExtension
tags:
- { name: layout.block_type_extension, alias: product_variants }
并在 Resources/layouts/xngage_theme/oro_product_frontend_product_view/configure_product.yml 中为配置产品创建布局
layout:
imports:
- oro_product_view
actions:
- '@setBlockTheme':
themes: 'configurable_product.html.twig'
- '@add':
id: product_variants
blockType: product_variants
parentId: product_specification_container
siblingId: product_specification
options:
variants: '=data["product_variants"].getVariants(data["product"])'
conditions: 'context["product_type"] == "simple"'
请问有什么遗漏的步骤吗?