1

I have created an event on my new custom module to display something after new newsletter subscriber have subscribe both nothing is showing. I reference this for event Here for both postdispatch and predispatch

The event.xml shown below

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
  <event name="controller_action_postdispatch_newsletter_manage_save">
    <observer name="controller_action_dispatch_newsletter" instance="Company\Module\Observer\Update" />
  </event>
</config>

This is the observer is shown below /observer/Update.php

 <?php
 namespace Company\Module\Observer;

 use Magento\Framework\Event\Observer;
 use Magento\Framework\Event\ObserverInterface;

class Update implements \Magento\Framework\Event\ObserverInterface
{


public function execute(\Magento\Framework\Event\Observer $observer)
{
    echo "email";
    exit; //un commet this to make sure event works
}
 }

Thank You

5
  • 1
    Event's name looks fine. Observer folder has to be with capital O, is it?
    – Nikolas
    Aug 7, 2017 at 10:04
  • @Nikolas Observer folder is fine
    – codePhree
    Aug 7, 2017 at 11:06
  • Give a try placing the events.xml file under frontend/events.xml
    – Nikolas
    Aug 7, 2017 at 11:42
  • Will try this @Nikolas
    – codePhree
    Aug 7, 2017 at 12:08
  • any update on the above? Jan 2, 2023 at 10:18

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.