1

How to move Success, Error messages position on top for home page only (others are already on top)?

I want to display Newsletter Subscription Message on top instead of bottom for home page only.rest of the places it's showing on top.

this is manage from the following controller:-

Magento\Newsletter\Controller\Subscriber\NewAction.php::execute()

I also tried to do the same from JS but it's not working.when i directly hitting my JS code on browser console then it's moving the message on top but when i tried Magento2 way then it's not working.

Here is the JS code:-

subscribe-newsletter.js:-

requirejs(['jquery'], function($) {
    $(document).ready(function(){
            console.log("Hey123") ;
    $(".message-error").insertBefore(".feature_product");
    });
});

Path:- app/design/frontend/Smartwave/porto_child/web/js/subscribe-newsletter.js

layout cms_index_index.xml:-

<?xml version="1.0"?>
   <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
       <script src="js/subscribe-newsletter.js"/>
    </head>
    <body>              
    </body>
</page>

Screenshot:- https://nimb.ws/jHrfZh

Please help me to resolve!!!

1 Answer 1

0

Installed 3rd Party Free Ext. PHPCuong_Newsletter and it works for me.

Actually this ext. uses AJAX,you can download from Git.

Thanks!!!

Your Answer

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

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