> For the complete documentation index, see [llms.txt](https://docs.fact-finder.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fact-finder.com/magento/sdk-v4.x/sdk-v4.x/customization-and-troubleshooting.md). Agents can also search and read this documentation through its [MCP server](https://docs.fact-finder.com/~gitbook/mcp).

# Customization and troubleshooting

## Customization and troubleshooting

The module provides a working Magento 2 integration. Customize it through Magento dependency injection when your project needs different exported data or communication parameters.

### Change an exported column name

First, replace the column name in your module's `di.xml`:

```xml
<virtualType name="Omikron\Factfinder\Model\Export\CatalogFeed">
    <arguments>
        <argument name="columns" xsi:type="array">
            <item name="Master" xsi:type="string">CUSTOM_NAME</item>
        </argument>
    </arguments>
</virtualType>
```

Then add a data-provider plugin that returns the new key:

```php
public function afterToArray($subject, $result)
{
    return ['CUSTOM_NAME' => $result['Master']] + $result;
}
```

Clear the configuration cache:

```bash
php bin/magento cache:clean config
```

### Add a column

Register a custom product field in `di.xml`. The field implementation must implement `Omikron\Factfinder\Api\Export\FieldInterface`.

```php
class BrandLogo implements \Omikron\Factfinder\Api\Export\FieldInterface
{
    public function getValue(Product $product): string
    {
        // Return the product brand-logo URL.
    }
}
```

Add the matching feed column:

```xml
<virtualType name="Omikron\Factfinder\Model\Export\CatalogFeed">
    <arguments>
        <argument name="columns" xsi:type="array">
            <item name="BrandLogo" xsi:type="string">BrandLogo</item>
        </argument>
    </arguments>
</virtualType>
```

#### Use `GenericField`

Use `GenericField` when you only need to export a product attribute without transformation:

```xml
<virtualType name="Omikron\Factfinder\Model\Export\Catalog\ProductField\Brand" type="Omikron\Factfinder\Model\Export\Catalog\ProductField\GenericField">
    <arguments>
        <argument name="attributeCode" xsi:type="string">manufacturer</argument>
    </arguments>
</virtualType>
```

Clear the configuration cache after adding the virtual type.

### Add a custom communication parameter

Create a provider that implements `Omikron\Factfinder\Api\Config\ParametersSourceInterface`:

```php
class CustomAddParams implements \Omikron\Factfinder\Api\Config\ParametersSourceInterface
{
    public function getParameters(): array
    {
        return [
            'add-params' => $this->getMyVariableParameters(),
        ];
    }
}
```

Providers run in array order. When two providers return the same key, the later provider wins.

### Add a product data provider

Map a custom product type to a provider in `di.xml`:

```xml
<type name="Omikron\Factfinder\Model\Export\Catalog\DataProvider">
    <arguments>
        <argument name="entityTypes" xsi:type="array">
            <item name="customProductType" xsi:type="string">YOUR_VENDOR\YOUR_MODULE\Model\Export\Catalog\ProductType\CustomDataProvider</item>
        </argument>
    </arguments>
</type>
```

Your provider must implement `DataProviderInterface` and return its entities from `getEntities()`.

### Export fields from variants

The module exports configurable-product data by default. Variants override only selected fields for performance.

Configure `variantFields` when variant values differ, such as color-specific product images:

```xml
<type name="Omikron\Factfinder\Model\Export\Catalog\FieldProvider">
    <arguments>
        <argument name="variantFields" xsi:type="array">
            <item name="ImageURL" xsi:type="object">Omikron\Factfinder\Model\Export\Catalog\ProductField\ProductImage</item>
        </argument>
    </arguments>
</type>
```

### Remove `/pub` from exported URLs

When exported URLs include `/pub`, add this setting to your project's `env.php`:

```php
'directories' => [
    'document_root_is_pub' => true,
],
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.fact-finder.com/magento/sdk-v4.x/sdk-v4.x/customization-and-troubleshooting.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
