# How to pass data to this storefront view page using events ?

**URL:** <https://forum.shopware.com/t/how-to-pass-data-to-this-storefront-view-page-using-events/64912>\
**Category:** Programming (EN)\
**Created:** [21. Februar 2020 um 13:23 UTC](https://forum.shopware.com/t/how-to-pass-data-to-this-storefront-view-page-using-events/64912 "2020-02-21T13:23:27Z")\
**Posts on this page:** 2\
**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:** [21. Februar 2020 um 13:23 UTC](https://forum.shopware.com/t/how-to-pass-data-to-this-storefront-view-page-using-events/64912/1 "2020-02-21T13:23:27Z")

</div>

I want to pass some custom data to the product review form when the review from loads after the review saved. How to do that using events?

```
    /**
     * @Route("/product/{productId}/reviews", name="frontend.product.reviews", methods={"GET","POST"}, defaults={"XmlHttpRequest"=true})
     */
    public function loadReviews(Request $request, RequestDataBag $data, SalesChannelContext $context): Response
    {
        $reviews = $this->reviewPageletLoader->load($request, $context);

        return $this->renderStorefront('storefront/page/product-detail/review/review.html.twig', [
            'reviews' => $reviews,
            'ratingSuccess' => $request->get('success'),
        ]);
    }

```

This is the review loading&nbsp;action in&nbsp;ProductController.php (shopware controller).

&nbsp;

I am&nbsp;using&nbsp;ProductEvents::PRODUCT\_REVIEW\_LOADED event. but unfortunately, I am not able to find any solution to this. how to do that?

---

<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:** [26. Februar 2020 um 04:38 UTC](https://forum.shopware.com/t/how-to-pass-data-to-this-storefront-view-page-using-events/64912/2 "2020-02-26T04:38:01Z")

</div>

We can pass custom data to view the page by using StorefrontRenderEvent

&nbsp; &nbsp; public static function getSubscribedEvents(): array  
&nbsp; &nbsp; {  
&nbsp; &nbsp; &nbsp; &nbsp; return [  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; StorefrontRenderEvent::class =\> ‘onStorefrontRender’  
&nbsp; &nbsp; &nbsp; &nbsp; ];  
&nbsp; &nbsp; }

&nbsp; &nbsp; public function onStorefrontRender(StorefrontRenderEvent $event)  
&nbsp; &nbsp; {  
&nbsp; &nbsp; &nbsp; &nbsp; $route = $event-\>getRequest()-\>get(’\_route’);

&nbsp; &nbsp; &nbsp; &nbsp; if($route == ‘frontend.product.reviews’)  
&nbsp; &nbsp; &nbsp; &nbsp; {  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;$event-\>setParameter(‘testParam’, ‘testParamValue’);  
&nbsp; &nbsp; &nbsp; &nbsp; }  
&nbsp; &nbsp; }
