提交页面后维护弹窗
我的客户正在使用 Magento,单击提交按钮后,表单提交到控制器,然后提交到同一页面重新加载。他问我的是,一旦他点击提交按钮,他希望显示一个弹出窗口。所以我以动态方式(JavaScript)使用了一个禁用背景的div作为弹出窗口,但是由于按钮是“提交”,页面刷新并且我丢失了弹出窗口,所以即使在提交后也可以保持该div的显示?
My client is using Magento, and after clicking the submit button, the form submits to the controller and then the same page reloads. What he asked me is once he clicks on the submit button he wants a popup displayed. So I used a div with a disabled background as a popup in a dynamic way (JavaScript), but since the button is "submitting", the page refreshes and I lose the popup, so is it possible to keep that div displayed even after submitting?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Jquery 示例:
Jquery example:
我不熟悉万磁王,但一般来说,当页面重新加载并调用弹出窗口时,您不能在控制器中查找表单提交吗?如果是的话?
I'm not familiar with Magneto, but generally speaking, couldn't you look for a form submit in the controller when the page reloads and call for the popup, if true?
为什么不使用滑动面板而不是弹出面板?
例如,检查 Magento 的
isLoggedin
功能:如果客户已登录,则在滑动面板内显示客户的必要信息。
如果您只想显示一次此面板,请尝试使用 magento 的事件观察器方法:
app/code/core/Mage/Customer/Model/Session.php
事件名称:
对于 jQuery 滑动面板,您可以使用支持的 jqEasy
showOnLoad
属性。jqEasy
Why don't you use slide panel instead of pop-up panel?
For instance, check
isLoggedin
function of Magento :if customer is logged, show necessary information of customer inside the slide panel.
If you want just one time show this panel, try to event observer methods of magento :
app/code/core/Mage/Customer/Model/Session.php
Event names :
For jQuery Sliding Panel, you can use jqEasy which is supporting
showOnLoad
property.jqEasy
鉴于您不想保留页面的提交,您基本上需要在页面提交后回显弹出窗口。因此,使用一些通用事件(
catalog_product_add_to_cart_after
),添加一个会话变量,如下所示:然后,在模板中,您可以检查此变量是否存在以显示弹出窗口:
这不是经过测试的代码,但它应该为您提供如何捕获事件并在模板中响应它的要点。希望有帮助!
谢谢,
乔
Given that you don't want to hold submission of the page, you basically need to echo the popup after the page is submitted. So, using some generic event (
catalog_product_add_to_cart_after
), add a session variable like this:Then, in your template, you can check for the existence of this variable to show your popup:
This is not tested code, but it should give you the gist of how to capture the event and respond to it in the template. Hope that helps!
Thanks,
Joe