Is it possible to prepopulate structure field with multiple values from parent?

Hi, there are products with technical details, and for each product from the same category properties are the same (marked with red):

So I would like to have these properties in parent page (category), so that client can edit them, as they can change, but then show them in each product, so that client needs only to fill values (right column).

I know how to query options from parent page, but that still required selecting them each time, but would be easier to have structure field, that would already have fields with these properties.

You could pre-fill those property values when a new child page is created using a hook. However, if these properties change, how do you want to handle existing pages?

Actually, there is no need in structure field, as in product user doesn’t need to edit properties, they can be just like labels, that are editable in parent page. And yes, if they are edited in parent, that should also reflect in child (product).

Let’s take an example. You have a structure field in the product page like this:

structurefield:
  type: structure
  label: Properties
  fields:
    fieldlabel:
      label: Fieldlabel
      type: text
      disabled: true
    fieldvalue:
      label: Fieldvalue
      type: text

Then in your parent, you define the fieldlabels, let’s say using a tags field:

tags: propA, propB, propC, propD

Now we use a hook to prefill our structure field, which will end up in the content file like this:

Structurefield:

-
  fieldlabel: propA
  fieldvalue:
-
  fieldlabel: propB
  fieldvalue:
-
  fieldlabel: propC
  fieldvalue:
-
  fieldlabel: propC
  fieldvalue: 

Now the user can fill in the values (in the Panel), while the “Label” is disabled.

But what if the “Fieldlabels” are changed in the parent? Do you need to update all structure fields of all pages in that case? Or will the changes only have to affect newly created pages?

Labels should be updated in all pages, new and old.

Then you need a second hook that checks if the labels in the parent have changed and update all structure fields of all children.

You would have to make sure that the order of those structure items cannot be changed, then. But if you have a lot of pages that could possibly be affected, I don’t know if that is such a great idea.

Thinking about real life scenario, I think filling only newly created pages can also be an option, can ask client tomorrow. As it’s more to eliminate the need to create a lot of fields for new products.

Also another option can be create lists of fields, without ability to add new from panel, but with ability to edit labels.