Magento 2.1.13 extend modal-popup for custom modal template (modal-popup template child)
![Multi tool use Multi tool use](http://sgv.ssvwv.com/sg/ssvwvcomimagb.png)
Multi tool use
We are trying to develop a custom modal-popup on page load when cookie is not there.
Everything is fine except for the template. We copied and modified the template in our child-theme and the popup works great! However, our modifications on the template affected all of our previous modal-popups.
We want to extend the template to use it specifically in our modal-popup without affecting the other ones.
Let my show you,
this is the original template placed in: /vendor/magento/module-ui/view/base/web/templates/modal
<aside
class="modal-<%= data.type %> <%= data.modalClass %>
<% if(data.responsive){ %><%= data.responsiveClass %><% } %>
<% if(data.innerScroll){ %><%= data.innerScrollClass %><% } %>"
data-role="modal"
data-type="<%= data.type %>"
tabindex="0">
<div data-role="focusable-start" tabindex="0"></div>
<div class="modal-inner-wrap"
data-role="focusable-scope">
<header class="modal-header">
<% if(data.title){ %>
<h1 class="modal-title"
data-role="title"><%= data.title %></h1>
<% } %>
<button
class="action-close"
data-role="closeBtn"
type="button">
<span><%= data.closeText %></span>
</button>
</header>
<div
class="modal-content"
data-role="content"></div>
<% if(data.buttons.length > 0){ %>
<footer class="modal-footer">
<% _.each(data.buttons, function(button) { %>
<button
class="<%= button.class %>"
type="button"
data-role="action"><span><%= button.text %></span></button>
<% }); %>
</footer>
<% } %>
</div>
<div data-role="focusable-end" tabindex="0"></div>
and this is our modified template placed in: /app/design/frontend/{{vendor}}/{{child-theme}}/Magento_Ui/web/templates/modal
<aside
class="modal-<%= data.type %> <%= data.modalClass %>
<% if(data.responsive){ %><%= data.responsiveClass %><% } %>
<% if(data.innerScroll){ %><%= data.innerScrollClass %><% } %>"
data-role="modal"
data-type="<%= data.type %>"
tabindex="0">
<div data-role="focusable-start" tabindex="0"></div>
<div class="modal-inner-wrap <%= data.name %>"
data-role="focusable-scope">
<div
class="modal-content"
data-role="content"></div>
<div class="go-to-product-container">
<a class="go-to-product" href="<%= data.buttonurl %>">Ir al producto</a>
</div>
</div>
<div data-role="focusable-end" tabindex="0"></div>
We need to use our custom template without affecting the rest of the popups in the website. After so many searches on the internet, there's not explanations on how to extend a template / create a child template for modals on Magento 2.
I'll be eternally grateful if you guys can help me out with this.
magento2.1
add a comment |
We are trying to develop a custom modal-popup on page load when cookie is not there.
Everything is fine except for the template. We copied and modified the template in our child-theme and the popup works great! However, our modifications on the template affected all of our previous modal-popups.
We want to extend the template to use it specifically in our modal-popup without affecting the other ones.
Let my show you,
this is the original template placed in: /vendor/magento/module-ui/view/base/web/templates/modal
<aside
class="modal-<%= data.type %> <%= data.modalClass %>
<% if(data.responsive){ %><%= data.responsiveClass %><% } %>
<% if(data.innerScroll){ %><%= data.innerScrollClass %><% } %>"
data-role="modal"
data-type="<%= data.type %>"
tabindex="0">
<div data-role="focusable-start" tabindex="0"></div>
<div class="modal-inner-wrap"
data-role="focusable-scope">
<header class="modal-header">
<% if(data.title){ %>
<h1 class="modal-title"
data-role="title"><%= data.title %></h1>
<% } %>
<button
class="action-close"
data-role="closeBtn"
type="button">
<span><%= data.closeText %></span>
</button>
</header>
<div
class="modal-content"
data-role="content"></div>
<% if(data.buttons.length > 0){ %>
<footer class="modal-footer">
<% _.each(data.buttons, function(button) { %>
<button
class="<%= button.class %>"
type="button"
data-role="action"><span><%= button.text %></span></button>
<% }); %>
</footer>
<% } %>
</div>
<div data-role="focusable-end" tabindex="0"></div>
and this is our modified template placed in: /app/design/frontend/{{vendor}}/{{child-theme}}/Magento_Ui/web/templates/modal
<aside
class="modal-<%= data.type %> <%= data.modalClass %>
<% if(data.responsive){ %><%= data.responsiveClass %><% } %>
<% if(data.innerScroll){ %><%= data.innerScrollClass %><% } %>"
data-role="modal"
data-type="<%= data.type %>"
tabindex="0">
<div data-role="focusable-start" tabindex="0"></div>
<div class="modal-inner-wrap <%= data.name %>"
data-role="focusable-scope">
<div
class="modal-content"
data-role="content"></div>
<div class="go-to-product-container">
<a class="go-to-product" href="<%= data.buttonurl %>">Ir al producto</a>
</div>
</div>
<div data-role="focusable-end" tabindex="0"></div>
We need to use our custom template without affecting the rest of the popups in the website. After so many searches on the internet, there's not explanations on how to extend a template / create a child template for modals on Magento 2.
I'll be eternally grateful if you guys can help me out with this.
magento2.1
add a comment |
We are trying to develop a custom modal-popup on page load when cookie is not there.
Everything is fine except for the template. We copied and modified the template in our child-theme and the popup works great! However, our modifications on the template affected all of our previous modal-popups.
We want to extend the template to use it specifically in our modal-popup without affecting the other ones.
Let my show you,
this is the original template placed in: /vendor/magento/module-ui/view/base/web/templates/modal
<aside
class="modal-<%= data.type %> <%= data.modalClass %>
<% if(data.responsive){ %><%= data.responsiveClass %><% } %>
<% if(data.innerScroll){ %><%= data.innerScrollClass %><% } %>"
data-role="modal"
data-type="<%= data.type %>"
tabindex="0">
<div data-role="focusable-start" tabindex="0"></div>
<div class="modal-inner-wrap"
data-role="focusable-scope">
<header class="modal-header">
<% if(data.title){ %>
<h1 class="modal-title"
data-role="title"><%= data.title %></h1>
<% } %>
<button
class="action-close"
data-role="closeBtn"
type="button">
<span><%= data.closeText %></span>
</button>
</header>
<div
class="modal-content"
data-role="content"></div>
<% if(data.buttons.length > 0){ %>
<footer class="modal-footer">
<% _.each(data.buttons, function(button) { %>
<button
class="<%= button.class %>"
type="button"
data-role="action"><span><%= button.text %></span></button>
<% }); %>
</footer>
<% } %>
</div>
<div data-role="focusable-end" tabindex="0"></div>
and this is our modified template placed in: /app/design/frontend/{{vendor}}/{{child-theme}}/Magento_Ui/web/templates/modal
<aside
class="modal-<%= data.type %> <%= data.modalClass %>
<% if(data.responsive){ %><%= data.responsiveClass %><% } %>
<% if(data.innerScroll){ %><%= data.innerScrollClass %><% } %>"
data-role="modal"
data-type="<%= data.type %>"
tabindex="0">
<div data-role="focusable-start" tabindex="0"></div>
<div class="modal-inner-wrap <%= data.name %>"
data-role="focusable-scope">
<div
class="modal-content"
data-role="content"></div>
<div class="go-to-product-container">
<a class="go-to-product" href="<%= data.buttonurl %>">Ir al producto</a>
</div>
</div>
<div data-role="focusable-end" tabindex="0"></div>
We need to use our custom template without affecting the rest of the popups in the website. After so many searches on the internet, there's not explanations on how to extend a template / create a child template for modals on Magento 2.
I'll be eternally grateful if you guys can help me out with this.
magento2.1
We are trying to develop a custom modal-popup on page load when cookie is not there.
Everything is fine except for the template. We copied and modified the template in our child-theme and the popup works great! However, our modifications on the template affected all of our previous modal-popups.
We want to extend the template to use it specifically in our modal-popup without affecting the other ones.
Let my show you,
this is the original template placed in: /vendor/magento/module-ui/view/base/web/templates/modal
<aside
class="modal-<%= data.type %> <%= data.modalClass %>
<% if(data.responsive){ %><%= data.responsiveClass %><% } %>
<% if(data.innerScroll){ %><%= data.innerScrollClass %><% } %>"
data-role="modal"
data-type="<%= data.type %>"
tabindex="0">
<div data-role="focusable-start" tabindex="0"></div>
<div class="modal-inner-wrap"
data-role="focusable-scope">
<header class="modal-header">
<% if(data.title){ %>
<h1 class="modal-title"
data-role="title"><%= data.title %></h1>
<% } %>
<button
class="action-close"
data-role="closeBtn"
type="button">
<span><%= data.closeText %></span>
</button>
</header>
<div
class="modal-content"
data-role="content"></div>
<% if(data.buttons.length > 0){ %>
<footer class="modal-footer">
<% _.each(data.buttons, function(button) { %>
<button
class="<%= button.class %>"
type="button"
data-role="action"><span><%= button.text %></span></button>
<% }); %>
</footer>
<% } %>
</div>
<div data-role="focusable-end" tabindex="0"></div>
and this is our modified template placed in: /app/design/frontend/{{vendor}}/{{child-theme}}/Magento_Ui/web/templates/modal
<aside
class="modal-<%= data.type %> <%= data.modalClass %>
<% if(data.responsive){ %><%= data.responsiveClass %><% } %>
<% if(data.innerScroll){ %><%= data.innerScrollClass %><% } %>"
data-role="modal"
data-type="<%= data.type %>"
tabindex="0">
<div data-role="focusable-start" tabindex="0"></div>
<div class="modal-inner-wrap <%= data.name %>"
data-role="focusable-scope">
<div
class="modal-content"
data-role="content"></div>
<div class="go-to-product-container">
<a class="go-to-product" href="<%= data.buttonurl %>">Ir al producto</a>
</div>
</div>
<div data-role="focusable-end" tabindex="0"></div>
We need to use our custom template without affecting the rest of the popups in the website. After so many searches on the internet, there's not explanations on how to extend a template / create a child template for modals on Magento 2.
I'll be eternally grateful if you guys can help me out with this.
magento2.1
magento2.1
asked Nov 20 at 15:32
Cristina Moreno
11
11
add a comment |
add a comment |
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53396386%2fmagento-2-1-13-extend-modal-popup-for-custom-modal-template-modal-popup-templat%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53396386%2fmagento-2-1-13-extend-modal-popup-for-custom-modal-template-modal-popup-templat%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
a,u,J,EQ4kuL93pnY,xYUKqXLR SzFPl,RBJ2t