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

Custom API to Fetch Customer Data by Customer ID in Spryker

Spread the love Introduction In this blog post, we will

Creating a Custom Module for a Custom Frontend Page in Spryker

Spread the love To create a custom module for a custom

How to create custom module api get category list without access token in Spryker

Spread the love To create a custom API for fetching a

Creating a Custom Glue API in Spryker

Spread the love Spryker’s Glue API is a powerful tool

Get AI Generated 360-Degree View of Account Summary in Dynamics 365 Sales

Spread the love Navigating the demanding landscape of sales

Enhancing Productivity with Dynamics 365: The Power of Session Restore

Spread the love Enhancing Productivity with Dynamics 365:

Salesforce Admin

Spread the love In our last blog, we discussed common

Unlocking AI with Spring Boot: Real-World Use Cases and Solutions

Spread the love Artificial Intelligence (AI) has moved from

Enhancing Performance with Reactive Java: A Beginner-Friendly Guide

Spread the love In today’s fast-paced software

Integrating Azure Function with Dynamics 365

Spread the love Signup on azure portal and make sure to

bluethinkinc Blogs