NixH
NixH

Reputation: 539

Shopware 6 add customfield set to cms-element

I was wondering if there is a way to map custom fields (e.g. from product) in custom cms-elements?

I added some custom fields to the product entity. Now I'm trying to add them to the demovalue. Since I'm completely new to vue I don't know how to start.

Can anybody help me?

Upvotes: 2

Views: 460

Answers (1)

dneustadt
dneustadt

Reputation: 13161

Hard to say without knowing what your current code is and what the element should look like exactly.

For a simple example, have a look at how the "Product name" element is registered.

It is registered here. The actual mapping of the product name happens within the component of the element though.

this.element.config.content.source = 'mapped';
this.element.config.content.value = 'product.name';

Set the content source of the element to be mapped. For the content value you'll provide a path to the field. In case of a custom field: product.customFields.technical_name_of_a_custom_field

Upvotes: 2

Related Questions