Author - Robert Popovic

Founder and Technical Director of LERO9, a web agency specializing in Magento and WordPress design and development.

I launched Magebase in April, 2010 and am its editor and contributor. My main topics of interest are Magento development, customization and how to get the most out of Magento with the least amount of headache.

More Info » Follow me on Twitter »

Reader Comments (14)

  1. Magentalliage
    Magentalliage
    November 7, 2011 at 11:18 pm /

    Hi, thanks for this code but in the compare window, ‘Close Windows’ Button don’t work :(

    Reply
  2. Mooshi
    Mooshi
    November 8, 2011 at 9:24 am /

    Thanks very much Robert…excellent! mod ;)

    Reply
  3. Kamil
    Kamil
    November 9, 2011 at 9:46 pm /

    Hello!
    Thanks for great article. I just have done all of this for my compare list.
    I can share additional js to close window with default “Close this window” button in compare list:
    1. Replace onclick=”window.close();” with onclick=”close_window()”;
    2. add this to js section in the end:

    function close_window() {
    	var elements = window.parent.document.getElementsByClassName('dialog');
    	for (i = 0; i < elements.length; i++){
    		id = elements[i].firstChild.id;
    		break;
    	}
    	id = id.replace('_close','');
    	window.parent.Windows.close(id, event);
    }
    
    Reply
  4. Max
    November 24, 2011 at 5:12 am /

    Hello Beautiful people, i just saw this and i think is going to solve the problem i am having for long time now. Please can anyone put me in the right direction? I want create a block to put anywhere and any page on my magento site and to as soon as the page loads. I cannot realize it with this method, i know it is my fault, please how can i do it? In the parameter supplied in new window instance, where did the “className ” came from?

    Best Regards

    Reply
  5. Jun Bagares
    Jun Bagares
    January 20, 2012 at 1:29 pm /

    The only local.xml file I found is the one from etc/local.xml which contains the configuration file. Are you actually referring to the page.xml or catalog.xml?

    Thanks…

    Reply
  6. Jun Bagares
    Jun Bagares
    January 20, 2012 at 2:02 pm /

    I added the below code to page.xml

    <default>
        <reference name="head">
            <action method="addJs"><script>prototype/window.js</script></action>
            <action method="addItem"><type>js_css</type><name>prototype/windows/themes/default.css</name></action>
            <action method="addItem"><type>js_css</type><name>prototype/windows/themes/magento.css</name></action>
        </reference>
    </default>
    Reply
  7. Pavel
    Pavel
    February 14, 2012 at 10:26 pm /

    Hi,
    Robert, I am new to JavaScript, please help me.
    I want based on your example to make a pop-up message on the product page.
    How correctly do it?

    Reply

Add a Comment & Join the Discussion

Insert small snippets of code by using [code]{your_code_here}[/code]
For larger code blocks please use http://pastebin.com and paste your link.

You may also use the following HTML in your comment: <a href="" title=""> <abbr title="">
<acronym title=""> <blockquote cite=""> <cite> <em> <strike> <strong>