I’ve created 50 new fields in the ProductsDefinitionSetup. Now I want all of this field to be added to a existing ProductFieldTemplate. I want to add a FieldTemplateFieldGroup to the VariantFieldGroups and add my new fields. I’ve tried to copy some accelerator code and I’ve tried to do this. But I have failed! So, how do I do this? I don’t want to add this group and theese fields to all of our environments. I just want it to be created by deploy.
Someone?
In ProductsDefinitionSetup.InitTemplates() there is a check if the template is already created, if it is then the template is not generated again from code so this is only done on first startup. If you have not done it already that code need to be adjusted to update the template on every startup if you always want to overwrite from code.
But can’t I just create a productgroup and add my fields and add it to an existing template without doing that?
I’ve looked at the code there and I dosent get overwritter anyway. All I want to do is to add some new fields, it’s 50. I don’t want to do it manually…
The fieldgroup is part of the template and template will not be generated more that first startup in default code.
If you have a Litium 7 Accelerator avaliable you can compare the code to DefinitionSetup.InitTemplates() in that version. There the code can easily be modified by commenting out the IsAlreadyExecuted-check to create or update the template on every startup:
And your question was for Litium 6 and not Litium 7 but it is mostly the same. In the ProductDefinitionSetup you have a lot of rows that points to the method IsAlreadyExecuted that will prohibit updating an already existing field/template/displaytemplate… you need to rewrite the logic that are using this IsAlreadyExecuted code to update the template if it already exists instead of creating a new one.