abinjohnedamanaabinjohnedamana MemberComments: 36 Received thanks: 9 Member since: February 2019

Hi

I have an event subscriber

    public static function getSubscribedEvents(): array
    {
        return [
            ProductEvents::PRODUCT_REVIEW_LOADED => 'onProductReviewLoads'
        ];
    }


    public function onProductReviewLoads(EntityLoadedEvent $event)
    {

    }

I want to fetch some data from DB and pass it to the storefront view page.


How to pass data to the storefront view page from subscriber?

Answers

  • abinjohnedamanaabinjohnedamana MemberComments: 36 Received thanks: 9 Member since: February 2019

    "you should use the ProductPageLoadedEvent as the event, you use will always be fired, if a review is loaded, which means also for API, admin, etc
    the PageLoadedEvent is only for the Storefront.
    then have a look at the Page objects and the classes which extend from it. Page itself extends from Struct which comes with a addExtension method. with this you could add data for the Storefront" - From Michael Telgmann

Sign In or Register to comment.