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 (21)

  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
    1. Stefan Schwann
      Stefan Schwann
      April 18, 2012 at 8:32 pm /

      Hello, i added the button and the javascript to my page. But in firefox the window won’t close. In every other browser it works but not in firefox. Do you have a idea what’s the solution for this problem is?

      best regards
      Stefan

      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
  8. JW
    JW
    February 25, 2012 at 11:09 am /

    Hi Robert,

    Loved your posts about local.xml and on the easy pop.up, both helped a lot !

    Now I’m stuck with trying to change the appearance of my product comparison pop-up.
    The only thing I want to do is changing the order in which the attributes are shown … that’s all, but I can’t find where to change it.

    Can you direct me in the right direction ??

    Reply
  9. Maier
    Maier
    March 22, 2012 at 3:17 am /

    Thank you for the tutorial(s). How would i achieve this for a more simple purpose? I know the first step where you add the js / css is universal, but because this tutorial describes how to modify compare, it leaves me confused if i just wanted to make an <a> tag that pops up a window with some information — basically can you please provide me with more simple example to help the lesson hit home?

    Thanks,

    Maier

    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>