Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Oct 2006
    Location
    At Home
    Posts
    370
    Plugin Contributions
    0

    Default Create popup for button

    I'm struggling to create a popup window not from a text link but an image button. I want to be able to click on that button and open up a popup window. I have tried this method here but doesn't work for me. Maybe because of 2 reasons.

    1- It's a button link not a text link.
    2- The button is located in the header tagline which is here includes/languages/english/mytemplate/header.php

    Either way, I'm not sure about all that. Just guessing.

    The code for my header 'tagline',

    PHP Code:
    // added defines for header alt and text
      
    define('HEADER_ALT_TEXT''Company Logo');
      
    define('HEADER_SALES_TEXT''<a href="http://www.mysite.com/gallery.php" target="new"><img alt="button" src="http://www.mysite.com/images/blue_button.jpg"></a>');
      
    define('HEADER_LOGO_WIDTH''150px');
      
    define('HEADER_LOGO_HEIGHT''100px');
      
    define('HEADER_LOGO_IMAGE''companylogo.gif'); 


    So far I tried to change the code to something like this,
    PHP Code:
    define('HEADER_SALES_TEXT''<a href="javascript:popupWindow('http://www.mysite.com/gallery.php')" target="new"><img alt="button" src="http://www.mysite.com/images/blue_button.jpg"></a>'); 
    Tried this also,
    PHP Code:
    define('HEADER_SALES_TEXT''<a href="javascript:popupWindow(\'http://www.mysite.com/gallery.php\')" target="new"><img alt="button" src="http://www.mysite.com/images/blue_button.jpg"></a>'); 


    But still can't seems to work. Can somebody help me on this? Thanks.

  2. #2
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Create popup for button

    Is the popupWindow javascript function already defined on the page?
    What's the URL where it can be seen in action?
    Does your browser report any javascript errors when you click on the button?
    Why do you have target="new" in there?
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Oct 2006
    Location
    At Home
    Posts
    370
    Plugin Contributions
    0

    Default Re: Create popup for button

    I have placed this js code in includes/modules/pages/index/jscript_details_popup.php.
    PHP Code:
    <script language="javascript" type="text/javascript"><!-- 
    function 
    popupDetails(url) { 
      
    window.open(url,'newWin','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=649,height=404,screenX=150,screenY=150,top=150,left=40'

    -->
    </script> 
    I noticed that on other page than the home page, the popup didn't work.

    Do I have to include the js code to all pages?

  4. #4
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Create popup for button

    If you want a particular jscript file to run on every page, it's easiest to put the file into your /includes/templates/YOUR_TEMPLATE/jscript folder (creating it if needed).

    Documentation for how the jscript folder overrides work is here: http://www.zen-cart.com/wiki/index.p...s_-_Javascript

    If you move the file to the template's jscript folder, don't put that same file in the modules/pages folder, or you'll end up with duplicate javascript on the page, which may give additional errors.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #5
    Join Date
    Oct 2006
    Location
    At Home
    Posts
    370
    Plugin Contributions
    0

    Default Re: Create popup for button

    Thanks Doc,

    That's solve it.

 

 

Similar Threads

  1. Create a rollover effect for a ‘BuyNow’ button
    By thaipokey in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 15 Jun 2011, 10:33 PM
  2. Add button for popup in categories
    By rottiejoe in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 30 Jan 2011, 12:50 AM
  3. create popup for new sidebox
    By digger99 in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 10 May 2009, 10:32 PM
  4. How can I Create Nicer Image Popup Windows?
    By ittybittykitty in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 8 Aug 2008, 02:22 PM
  5. Create Popup Windows from Signup Form?
    By DavidHojak in forum General Questions
    Replies: 2
    Last Post: 21 Feb 2008, 11:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg