Infinite Scrolling Event

Hello, I’m trying to change my Articles after Infinite Scrolling work. I need to find event that will handle it. I tried

 Enlight\_Controller\_Action\_PostDispatchSecure\_Widgets\_Listing

 Shopware\_Modules\_Articles\_sGetArticlesByCategory\_FilterResult

Enlight_Controller_Action_Widgets_Listing_listingCount

But non of them work. 

Can you provide your code?

Infinity scrolling invoked by url:

/widgets/Listing/ajaxListing?p=[pageNumber]&c=[categoryId]

So both of events subscribes should works for you:

Enlight_Controller_Action_PostDispatchSecure_Widgets_Listing

Shopware_Modules_Articles_sGetArticlesByCategory_FilterResult

Is it possible that you haven’t reinstalled plugin after add these subscribers?

Try to assign some variable and check is it available on template or just die(); in event hendler:

_/\*\*_ _\*_ _@param_ _\Enlight\_Controller\_ActionEventArgs $args_ _\*_ _@return_ _bool_ _\*/_ **public function** postDispatchFrontendWidgets(\Enlight\_Controller\_ActionEventArgs $args) { $request = $args-\>getSubject()-\>Request(); $action = $args-\>getSubject(); $response = $action-\>Response(); $view = $action-\>View(); $assignData = $view-\>getAssign( **'articles'** ); $sArticles = $view-\>getAssign( **'sArticles'** ); **if** (!$request-\>isDispatched() || $response-\>isException() || !$view-\>hasTemplate() || ( **empty** ($assignData) && **empty** ($sArticles) ) ) { **return false** ; } $view-\>assign( **'myVariable'** , **'myValue'** ); }

It used to work but they changed controller from widgets/listing/ajaxListing to widgets/listing/listingCount. You can’t use $view->getAssign(‘sArticles’) because controller’s response is json.

 $this-\>Front()-\>Plugins()-\>ViewRenderer()-\>setNoRender(); $this-\>Response()-\>setBody(json\_encode($body)); $this-\>Response()-\>setHeader('Content-type', 'application/json', true);

Then you should replace data in body?

_/\*\*_ _\*_ _@param_ _\Enlight\_Controller\_ActionEventArgs $args_ _\*_ _@return_ _bool_ _\*/_ **public function** postDispatchFrontendWidgets(\Enlight\_Controller\_ActionEventArgs $args) { $action = $args-\>getSubject(); $response = $action-\>Response(); $body = _json\_decode_($response-\>getBody(), **true** ); **if** (! **empty** ($body)){ $body[**'totalCount'**] = 0; } $response-\>setBody(_json\_encode_($body)); }