Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Javascript pop up help


sefu

Recommended Posts

Hi,

I want to be able to offer a link in the information box that will open up a popup window when pressed and display a Flash Page that we have. the problem is I wouldnt know where to start and what javascript to add in?

 

Does anyone have any tips on what to add and where to add it?

 

Thanks heaps!!

Wing

Link to comment
Share on other sites

Add in the "head" of the page you want the pop-up on

 

<script language="javascript"><!--

function popupWindow(url) {

 window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,

scrollbars=no,resizable=yes,copyhistory=no,width=400,height=400,screenX=150,scre
enY=150,top=150,left=150')

}

//--></script>

 

I have this

'<a href="javascript:popupWindow('ccv2.html')">What is it? </a>'

added to one of the language files. Change the "ccv2.html" to the page you want opened.

-Doug

Link to comment
Share on other sites

hmm didnt work.

i added the below in both the header.php file and then tried on default.php also

 

<script language="javascript"><!-- 

function popupWindow(url) { 

 window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no, 

scrollbars=no,resizable=yes,copyhistory=no,width=400,height=400,screenX=150,scre
enY=150,top=150,left=150') 

} 

//--></script>

 

The below i added in the english.php part

 

define('BOX_INFORMATION_FLASH', '<a href="javascript:popupWindow('ccv2.html')">What is it? </a>');

 

I fixed up the information box and also added the filename in application top. However when I press the link a javasript error of the following

 

Line 1

Char 1

Error: Object expected

Code: 0

 

What did I do wrong?

 

Is it possible to add the head bit into the header.php so I dont have to update every file

Link to comment
Share on other sites

The first code needs to go between the <head> and </head> on pages , not the header.php file.

I wanted a pop-up on the checkout_payment.php page that says "What is it?" linked to the ccv2.html page, so I added MODULE_PAYMENT_ECHO_CC_TEXT_CREDIT_CNP_WHAT to my echo_cc.php page (Echo payment mod)- this was defined in the language payment page.

 

How about this....brainstorming here....

Back up these files first!

add: define('FILENAME_FLASH', 'flash.html');

in application_top.php

 

add:

'<a href="' . tep_href_link(FILENAME_FLASH, '', 'NONSSL') . '">' . FLASH_POPUP . '</a><br>' .

in the information.php where appropiate-

add:

define('FLASH_POPUP', 'See My Flash');

in english.php

 

Put your flash.html page and associated .swf file in with your catalog pages.

Put

<script language="javascript"><!-- 

function popupWindow(url) { 

 window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no, 

scrollbars=no,resizable=yes,copyhistory=no,width=400,height=400,screenX=150,scre
enY=150,top=150,left=150') 

} //--></script>

in between the <head> and </head> in the default.php

(make sure there aren't any line breaks)

 

Let me know if that gets you closer....don't yell if it doesn't work- I might be missing something!

-Doug

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...