# Event Subscriber - $sArticle NULL - PostDispatch\_Frontend\_Listing

**URL:** https://forum.shopware.com/t/event-subscriber-sarticle-null-postdispatch-frontend-listing/91375
**Category:** Plugins
**Tags:** general, programming
**Created:** [9. November 2021 um 14:48 UTC](https://forum.shopware.com/t/event-subscriber-sarticle-null-postdispatch-frontend-listing/91375 "2021-11-09T14:48:48Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![datema-nt](https://avatars.discourse-cdn.com/v4/letter/d/8797f3/32.png) [@datema-nt](https://forum.shopware.com/u/datema-nt)
#### Post date: [9. November 2021 um 14:48 UTC](https://forum.shopware.com/t/event-subscriber-sarticle-null-postdispatch-frontend-listing/91375/1 "2021-11-09T14:48:48Z")

</div>

Hallo,

ich habe ein Plugin, welches sich auf zwei Events subscribed. Einmal `Enlight_Controller_Action_PostDispatch_Frontend_Detail` und einmal `Enlight_Controller_Action_PostDispatch_Frontend_Listing`.  
Das Ziel ist, Artikel ausverkaufte Artikel im Shop auszublenden. Ich weiß, dass es in Shopware eine Einstellung dafür gibt, die hat in diesem Fall aber einen unerwünschten Nebeneffekt, also soll das mit einem Plugin realisiert werden.

```auto
public static function getSubscribedEvents()
    {
        return [
            'Enlight_Controller_Action_PostDispatch_Frontend_Detail' => 'onFrontendDetail',
            'Enlight_Controller_Action_PostDispatch_Frontend_Listing' => 'onFrontendListing'
            ];
    }

```

In beiden Funktionen soll auf die Variable **$sArticle** zugegriffen werden. Das funktioniert in `onFrontendDetail`, aber in `onFrontendListing` bekomme ich als Wert **null** zurück.

Der Zugriff sieht so aus:

```auto
$controller = $args->getSubject();
$view = $controller->View();
$articles = $view->getAssign('sArticle');

```

Zum Auslesen gebe ich sie wieder als Smarty-Variable zurück:

```auto
$view->assign('Articles', $articles);

```

Ist `PostDispatch_Frontend_Listing` evtl. das falsche Event? Da es bei dem anderen funktioniert, dachte ich, dass es bei diesem auch der Fall ist, aber wohl nicht.
