# Import/export not working for product entity extension

**URL:** https://forum.shopware.com/t/import-export-not-working-for-product-entity-extension/72274
**Category:** Programming (EN)
**Created:** [22. Januar 2021 um 13:36 UTC](https://forum.shopware.com/t/import-export-not-working-for-product-entity-extension/72274 "2021-01-22T13:36:53Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![abinjohnedamana](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/abinjohnedamana/32/17378_2.png) [@abinjohnedamana](https://forum.shopware.com/u/abinjohnedamana)
#### Post date: [22. Januar 2021 um 13:36 UTC](https://forum.shopware.com/t/import-export-not-working-for-product-entity-extension/72274/1 "2021-01-22T13:36:53Z")

</div>

I have done a product entity extension with OneToOneAssociation. It was to add a new short description field. I was able to save the field when editing and adding products from admin. The issue is I am not able to import or export the contents of the new fields using shopware import/export in settings. I mapped the field using “shortDescription.translations.DEFAULT.shortDescriptionValue”. &nbsp;I am wondering if there is anything I should add in the code for this to work.

&nbsp;

```
public function extendFields(FieldCollection $collection): void
    {
        $collection->add(
            (new OneToOneAssociationField(
                'shortDescription',
                'id',
                'product_id',
                ShortDescriptionDefinition::class, false))->addFlags(new Inherited())
        );
    }

```

&nbsp;

---

<div class="post-metadata">

### Author: ![halfpint\_utopia](https://avatars.discourse-cdn.com/v4/letter/h/eb9ed0/32.png) [@halfpint\_utopia](https://forum.shopware.com/u/halfpint_utopia)
#### Post date: [17. Februar 2021 um 14:26 UTC](https://forum.shopware.com/t/import-export-not-working-for-product-entity-extension/72274/2 "2021-02-17T14:26:53Z")

</div>

Hi, I would also like to add a teaser description field to the product, could you share or give me pointers about how to add this? I have create a Struct/CustomProductExtension.php with the following:

```
class CustomProductStruct extends Struct
{
    /**
     * @var string|null
     */
    protected $teaserDescription;

    public function getTeaserDescription(): ?string
    {
        return $this->teaserDescription;
    }

    public function setTeaserDescription(?string $teaserDescription): void
    {
        $this->teaserDescription = $teaserDescription;
    }
}

```

and then added in my Extension/Content/Product/CustomProductExtension.php&nbsp;

```
class CustomProductExtension extends EntityExtension
{
    public function extendFields(FieldCollection $collection): void
    {
        $collection->add(
            (new OneToOneAssociationField(
                'teaserDescription',
                'id',
                'product_id',
                CustomProductStruct::class, false))->addFlags(new Inherited())
        );
    }

    public function getDefinitionClass(): string
    {
        return ProductDefinition::class;
    }
}

```

&nbsp;

add overrode the template by adding&nbsp;to my Resources/app/administration/src/extension/sw-product-detail-base/sw-product-detail-base.html.twig

```
{% block sw_product_detail_base_basic_info_card %}
    
        {% block sw_product_detail_base_basic_info_teaser_form %}
            
            
        {% endblock %}
        {% block sw_product_detail_base_basic_info_form %}
            {% parent %}
        {% endblock %}
    
{% endblock %}

```

but wondering how to see, edit, add&nbsp;this on my Product page.

---

<div class="post-metadata">

### Author: ![SteveKraemer-Mindfav](https://avatars.discourse-cdn.com/v4/letter/s/97f17d/32.png) [@SteveKraemer-Mindfav](https://forum.shopware.com/u/SteveKraemer-Mindfav)
#### Post date: [2. April 2024 um 16:50 UTC](https://forum.shopware.com/t/import-export-not-working-for-product-entity-extension/72274/3 "2024-04-02T16:50:27Z")

</div>

You can use the field in the importer/exporter by using the name of your extension.

```auto
yourExtension.yourFieldYouWantToWriteTo

```

I know, the answer comes late, but I stumpled across this, when searching for an answer.  
But be careful. It adds the data, everytime you do an import, so you maybe want to write an import extension, if you are doing multiple imports, or you’ll end up with a lot of duplicated data entries in the extension table.
