Search code examples
formstwigshopwareshopware6

Custom Tag appears in the result selection list, but it doesn't show up in the form field after reopening the modal


Custom Tag Id for Property Options saved into database and Tag appears in the result selection list. But it doesn't show up in the form field after reopening the (Option details) modal:

<sw-entity-tag-select
    v-if="currentOption"
    v-model="currentOption.extensions.myTags"
    :label="$tc('global.sw-tag-field.title')"
/>

I have made a look at the Customer Tag for the reference, but it doesn't help:

<sw-entity-tag-select
    v-model="customer.tags"
    :label="editMode ? $tc('sw-customer.baseForm.labelTags') : ''"
    class="sw-customer-card__tag-select"
    :disabled="!editMode"
    :size="editMode ? 'default' : 'medium'"
/>

Solution

  • You have to find the criteria which was used to load the entities and add the association by overriding the component where it originates.

    Component.override('sw-property-detail', {
        computed: {
            defaultCriteria() {
                const criteria = this.$super('defaultCriteria');
                
                criteria.addAssociation('options.myTags');
    
                return criteria;
            },
        },
    });