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

Customize lead qualification for a seamless experience

Spread the love When the 2024 Release Wave 2 was launched,

Create a Custom Console Command in Spryker

Spread the love In Spryker, developers can create custom

SALESFORCE

Spread the love Salesforce is a cloud-based software

CRUD Operation in Spryker Backoffice with a Custom Module

Spread the love Spryker is a highly flexible and modular

How to create custom module on Spryker for Backoffice?

Spread the love Creating a custom module in Spryker

How to Install Spryker Project with Docker on Local Machine

Spread the love Spryker is a flexible and scalable commerce

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

bluethinkinc Blogs