# Custom Products Backend::assignAttributes() Problem

**URL:** <https://forum.shopware.com/t/custom-products-backend-assignattributes-problem/54598>\
**Category:** Plugins\
**Tags:** offizielle-shopware-\
**Created:** [14. August 2018 um 08:56 UTC](https://forum.shopware.com/t/custom-products-backend-assignattributes-problem/54598 "2018-08-14T08:56:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pino](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/pino/32/14373_2.png) [@pino](https://forum.shopware.com/u/pino)\
**Post date:** [14. August 2018 um 08:56 UTC](https://forum.shopware.com/t/custom-products-backend-assignattributes-problem/54598/1 "2018-08-14T08:56:00Z")

</div>

Liebes SW Team,

leider bekommen wir häufig von Kunden Probleme gemeldet, dass das Plugin „FriedmOrderlistInvoiceNr“&nbsp;&nbsp;mit „Custom Products“ nich kompatibel sein.

Folgender&nbsp;Fehler wird ausgegeben:

> Fatal error: Uncaught TypeError: Argument 1 passed to SwagCustomProducts\Subscriber\Backend::shouldDisplayCustomOptionDetails() must be of the type array, null given, called in /html/shopware/testserver/custom/plugins/SwagCustomProducts/Subscriber/Backend.php on line 177 and defined in /html/shopware/testserver/custom/plugins/SwagCustomProducts/Subscriber/Backend.php:218 Stack trace: #0 /html/shopware/testserver/custom/plugins/SwagCustomProducts/Subscriber/Backend.php(177): SwagCustomProducts\Subscriber\Backend-\>shouldDisplayCustomOptionDetails(NULL) #1 /html/shopware/testserver/custom/plugins/SwagCustomProducts/Subscriber/Backend.php(91): SwagCustomProducts\Subscriber\Backend-\>assignAttributes(Array) #2 /html/shopware/testserver/engine/Library/Enlight/Event/Handler/Default.php(91): SwagCustomProducts\Subscriber\Backend-\>extendOrderModule(Object(Enlight\_Controller\_ActionEventArgs)) #3 /html/shopware/testserver/engine/Library/Enlight/Event/EventManager.php(220): Enlight\_Event\_Handler\_Default-\>execute(Object(Enlight\_Control in /html/shopware/testserver/custom/plugins/SwagCustomProducts/Subscriber/Backend.php on line 218

Ich konnte das Problem ermittel und hoffe, dass ihr euer Plugin anpasst.

SwagCustomProducts/Subscriber/Backend.php

```
[166] $attributes = $this->loadAttributes($ids);

```

Man erhält nun folgendes Array:

```
Array
(
    [158563] => Array
        (
            [0] => Array
                (
                    [swag_custom_products_configuration_hash] => 
                    [swag_custom_products_mode] => 0
                )

        ),
    [158566] => Array
        (
            [0] => Array
                (
                    [swag_custom_products_configuration_hash] => 
                    [swag_custom_products_mode] => 0
                )

        ),
    ...,
    [160000] => Array
        (
        ),
    [160001] => Array
        (
        )
)

```

Ja, der Eintrag&nbsp;160000 und&nbsp;160001 ist leer und verursacht nun folgendes Problem:

```
[171] 
if (!isset($attributes[$id])) {
    continue;
}

 $attributes[160000] ist vorhanden aber leer. Dennoch wird der Datensatz verarbeitet.

[177] if (!$this->shouldDisplayCustomOptionDetails($attribute)) {

```

Fehler wird ausgegeben.

BITTE

Zeile 177 anpassen:

```
if (!isset($attributes[$id]) || empty($attributes[$id])) {
    continue;
}

```

Vielen Dank
