How to create a popup window in admin panel?
I want to open a popup window when a custom button on the sales/order page is clicked to show details to the customer.
You have two options:
Magento has a shortcut JavaScript function for popup windows, defined in js/varien/js.js
:
function popWin(url,win,para)
The parameters are the same as in window.open
popWin(
"http://www.domainname.ext/path/ImageFile.png",
"DescriptiveWindowName",
"resizable,scrollbars,status")
In the admin area you have also access to the prototype.js Window
plugin that can open a layer with control elements and arbitrary content, which can be an external URL. In that case it is loaded into an iframe.
var url ='http://www.domainname.ext/path/ImageFile.png'
var win = new Window({
className:'magento',
title:'Enter Window Title',
url:url,
width:820,
height:600,
minimizable:false,
maximizable:false,
showEffectOptions: {duration:0.4},
hideEffectOptions:{duration:0.4}
});
win.setZIndex(100);
win.showCenter(true);
It's also possible to load the window content via AJAX instead of in an iframe, see: Window.setAjaxContent()
This should work
<a href="javascript:window.open('document.aspx','mywindowtitle','width=500,height=750')">open window</a>
If you desire more complex functions, use the php variable "GET"
Using "POST" can be a bit tricky with Backend HTTP/1.1 Validation.