2

I copy this template from

vendor/magento/module-newsletter/view/frontend/templates/subscribe.phtml

There's no js console error and any other error on server log. Subscribe is not working (email id not saved on admin panel). how to tackle it.it doesn't show any message alert.

my newsletter template in

mynamespace/mytheme/Magento_Newsletter/templates/ newsletter-footer.phtml

<section class="signup-section">
    <div class="container">
        <div class="signup-container clearfix">
            <article>  <span>
                <h3>Sign Up For Newsletter</h3>
                <p>Be the First to Know. Sign up to newsletter today</p>
                </span> </article>
            <article>
                <form class="form subscribe"
                      novalidate
                      action="<?php echo $block->getFormActionUrl() ?>"
                      method="post"
                      data-mage-init='{"validation": {"errorClass": "mage-error"}}'
                      id="newsletter-validate-detail">

                            <input name="email" placeholder="<?php echo __('Enter you email address here...'); ?>" type="email" id="newsletter"
                                   data-validate="{required:true, 'validate-email':true}"/>
                            <button class="action subscribe primary" type="submit">

                            </button>

                </form>
            </article>
        </div>
        <!--end of div signup-container-->
    </div>
    <!--end of div container-->
</section>

cms_index_index.xml

<referenceContainer name="main">
        <referenceContainer name="container.global" htmlClass="someotherclass"  >
            <block class="Magento\Framework\View\Element\Template" name="newsletter" template="Magento_Newsletter::newsletter-footer.phtml"/>

        </referenceContainer>
    </referenceContainer>

showing on homepage and validate email also enter image description here

enter image description here

7
  • The folder name should be "Magento_Newsletter" instead of "Magento-Newsletter".
    – kunj
    Jun 14, 2018 at 14:42
  • 1
    @kunj spell mistake Jun 14, 2018 at 14:53
  • This template is calling on frontend or not? Because you have changed the template name. Did you call the new template name from xml? If yes then please post the xml code on your question. Jun 14, 2018 at 15:15
  • Can you update the xml code? Jun 14, 2018 at 15:22
  • @SukumarGorai updated question ! Jun 14, 2018 at 15:27

2 Answers 2

3

Use below xml code instead of yours:

<referenceContainer name="main">
    <referenceContainer name="container.global" htmlClass="someotherclass"  >
        <block class="Magento\Newsletter\Block\Subscribe" name="newsletter" template="Magento_Newsletter::newsletter-footer.phtml"/>
    </referenceContainer>
</referenceContainer>
5
  • Happy to Help!. Jun 14, 2018 at 15:43
  • Hi @ Sukumar Gorai, I need your help? Mar 7, 2019 at 5:24
  • Post your question please. Mar 7, 2019 at 7:13
  • Hi @ Sukumar Gorai, I have 2 years experience in Magento e-commerce website. But I don't have knowledge on extension development. So, I want to learn magento2 coding. Please suggest me any tutorials. Mar 7, 2019 at 12:16
  • Hi @ Sukumar Gorai, Could you please help me? Mar 7, 2019 at 12:29
0

You should use the right path for you override and place the template in

mynamespace/mytheme/Magento_Newsletter/templates

You can also check your code again and compare it with the original code in the vendor package.

1
  • I compare code . Is any other file I need to include ?? Jun 14, 2018 at 15:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.