How to create pop-up Modal

Blog
Spread the love

In this article we’ll learn how to create pop-up modal in Magento 2.

What is Modal :

According to devdocs, The Magento modal widget implements a secondary window that opens
on top of the main window. It contains the overlay and modal content.

To create a popup modal in Magento 2, follow the below steps:

Step 1: Firstly, we need to create a “registration.php” file inside

app/code/[vendor_name]/[module_name].

app\code\BluethinkInc\PopUp

Now, add the below code as mentioned below

Step 2: After that, we need to create a “module.xml” file inside the etc directory of our extension

app\code\BluethinkInc\PopUp\etc

And add the below code

Step 3: After that, we need to create a “routes.xml” file inside etc/frontend directory of our module

app\code\BluethinkInc\PopUp\etc\frontend

And add the below-mentioned code

Step 4: First, we need to create an “modal_index_index.xml” file inside the module at the following
path

app\code\BluethinkInc\PopUp\view\frontend\layout

Now, add the code as follows

Also, need to create a “Index.php” file inside the module at the following path

app\code\BluethinkInc\PopUp\Controller\Index

And add the code as follows

Step 5: After that, we need to create a “ modal_popup.phtml” file inside the module on the
following path.

app\code\BluethinkInc\PopUp\view\frontend\templates

Finally, add the below code

Step 6: We naeed to create a “requirejs-config.js” file inside the module on the following path

app\code\BluehtinkInc\PopUp\view\frontend

Add the below code

Step 7: After that, we need to create a “popup-modal.js” file inside the module on the following path

app\code\BluethinkInc\PopUp\view\frontend\web\js

and add the below code

Successfully performing the above steps, will show the Custom Popup window

conimplementation_java

Thanks for reading my blog. I hope you would learn a lot of things from this blog. Keep liking
and sharing!!

bluethinkinc_blog

bluethinkinc_blog

2023-02-10

0

Leave a Reply

Your email address will not be published. Required fields are marked *

Find More Blogs

How to Add a Custom Tab to the Customer Order Detail Page in Magento 2

Spread the love Adding a custom tab to the Order Detail

Exception Handling in Java

Spread the love Introduction – Exception:An unwanted

How to add custom less file in Magento2

Spread the love Source files *.css included into layout

Spring Boot Microservices

Spread the love Microservices architecture has become

Implementation of WireMock for better testing

Spread the love WireMock is a flexible and powerful tool

Magento 2: How to selected default option in configurable options?

Spread the love Configurable products in Magento 2 allow

How To Implement Simple JWT Authentication in Django Rest Framework

Spread the love We’ll learn how to use simple JWT

Optimizing Search: Integrating Elasticsearch in Django Applications

Spread the love What is Elasticsearch? Elasticsearch is a

How to create Customer Segments

Spread the love In Magento 2, “customer

Proxy Design Pattern and Requisition List in Magento 2

Spread the love Requisition List in Magento 2 Requisition

bluethinkinc Blogs