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

Proxy Design Pattern and Requisition List in Magento 2

Spread the love Requisition List in Magento 2 Requisition

Google Ads Conversion Tracking Through Magento Platform:

Spread the love Google Ads Conversion Tracking Through

Object Pool Pattern in Magento2

Spread the love What is Object Pool Pattern in Magento 2 An

JENKINS

Spread the love JENKINS Introduction and Installation

Virtual Type and Type

Spread the love Virtual type is one of the most common

Customize the length of Input field

Spread the love Sometimes we need to change the limit the

How to Add Custom Tab on Admin Dashboard and Count Website Total Visitor in Magento 2?

Spread the love In this blog we’ll see How to Add Custom

How to Add Sign Out Tab in Customer Account in Magento 2?

Spread the love In this blog we’ll see How to Add

How to create custom tab in product detail page in magento 2?

Spread the love In this blog we’ll see how to add

Understanding and Implementing CORS & CSRF

Spread the love What is security? The world has become more

bluethinkinc Blogs