chrometweaks.org

How do you access your website? I have iPage if it matters?

Click Here To View All Answers...


Got a quick question: How do you access your website? I have iPage if it matters? Many thanks for any response. My 2nd question... I just enabled "Search Engine Friendly" urls in my site. I had some javascript code that popped up a simple plain window with some detailed specifications about the product when the user clicked a button. Since enableing "Search Engine Friendly" urls on my site, this does not work any more. Does anyone have any suggestions as to how this might be accomplished? Thanks in Advance...

Comments (108)

I'm stumped. I'm not so sure what is the answer. I'll do some Googling and get back to you if I find an anything. You should email the people at iPage as they probably could assist you..

Comment #1

Do you mind sharing your javascript code? We too need to have pop up info for products. Thanks in advance!..

Comment #2

For an easy way to do this, just copy the code that generates the popup in product_info.php. You'll need to change the name of the file that it targets and then create that file. I've done this (for a credit card security info popup) and it works fine. If you can't figure it out, post here and I'll dig out the code for you..

Regards.

Jim..

Comment #3

I think I found the code to modify. I just can't seem to get it to work. Here is the code I copied from the product_info.php file:.

<script language="javascript"><!.

Document.write('<?php echo '<a href="java script:popupWindow(\\\''tep_href_link(FILENAME_POPUP_IMAGE, 'pID='$product_info['products_id'])'\\\')">'tep_image(DIR_WS_IMAGES$product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"')'<br>'TEXT_CLICK_TO_ENLARGE'</a>'; ?>');.

//></script>.

I havn't the slightest idea what to strip out of this code, I think I should replace the FILENAME_POPUP_IMAGE with my own url to the page I want to popup, but I might be wrong..

The code I *WAS* using that doesn't work now is:.

In product_info.php:.

<script language="javascript"><!.

Function popupWindow(url) {.

Window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,res.

Izable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,le.

Ft=150').

}.

//></script>.

Then in the product description:.

<p class=MsoNormal>.

<input type=button value=\"Click here to find your application\" onClick=\"java script:popUp(\'amc_trans_chart.htm\')\"></p>.

Thanks for your help...

Comment #4

Here's what I did. You can modify the file names etc. to suit your needs. First, add the following code to the page that you want the popup from, just before the "</head>" tag:.

<script language="javascript"><!.

Function popupWindow(url) {.

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

Izable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,le.

Ft=150').

}.

//>.

</script>.

If you are adding this to product_info.php, don't bother; it's already there. Now add the following in the page where you want the link to the popup:.

<script language="javascript"><!.

Document.write('<?php echo '<a href="javascript:popupWindow(\\\''tep_href_link(FILENAME_POPUP_CC_SECURITY)'\\\')">'TEXT_SECURITY_CONCERN'</a>'; ?>');.

//>.

</script>.

<noscript>.

<?php echo '<a href="'tep_href_link(FILENAME_POPUP_CC_SECURITY)'" target="_blank" class=inputRequirement>'TEXT_SECURITY_CONCERN'</a>'; ?>.

</noscript>.

FILENAME_POPUP_CC_SECURITY needs to be defined in includes/filenames.php. TEXT_SECURITY_CONCERN needs to be defined in includes/languages/english/product_info.php (or whatever file you are putting this code in), and similar for any other languages you are using. Of course you can change these constant names to something that makes more sense for you..

Now create a new file and paste in the following:.

<?php.

/*.

 $Id: popup_cc_security.php,v 1.0 2001/01/05 jck Exp $.

 Modified from: popup_coupon_help.php,v 1.1.2.5 2003/05/02 01:43:29 wilt Exp $.

 osCommerce, Open Source E-Commerce Solutions.

 http://www.oscommerce.com.

 Copyright (c) 2003 osCommerce.

 Released under the GNU General Public License.

*/.

 require('includes/application_top.php');.

 $navigation->remove_current_page();.

 require(DIR_WS_LANGUAGES$language'/'FILENAME_POPUP_CC_SECURITY);.

?>.

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">.

<html <?php echo HTML_PARAMS; ?>>.

<head>.

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">.

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER)DIR_WS_CATALOG; ?>">.

<title><?php echo HEADING_CC_SECURITY; ?></title>.

<link rel="stylesheet" type="text/css" href="stylesheet.css">.

</head>.

<style type="text/css"><!.

BODY { margin-bottom: 10px; margin-left: 10px; margin-right: 10px; margin-top: 10px; }.

//></style>.

<body marginwidth="10" marginheight="10" topmargin="10" bottommargin="10" leftmargin="10" rightmargin="10">.

<?php.

   $html_file = DIR_WS_LANGUAGES$language'/html/'basename($PHP_SELF,".php")'.html';.

   $html = implode("", file($html_file));.

Echo ereg_replace("(<!doctype([^>]+)>)|(<[/]?html>)|(<head>(.*)?</head>)|(<[/]?body([^>]+)?>)", '', $html);.

?>.

<p class="smallText" align="right"><?php echo '<a href="javascript:window.close()">'TEXT_CLOSE_WINDOW'</a>'; ?></p>.

</body>.

</html>.

<?php require('includes/application_bottom.php'); ?>.

That's the popup itself; name it whatever filename you defined FILENAME_POPUP_CC_SECURITY to be. Now copy the following code:.

<?php.

/*.

 $Id: popup_cc_security.php,v 1.0 2001/01/05 jck Exp $.

 Modified from: popup_coupon_help.php,v 1.1.2.4 2003/05/01 22:04:29 wilt Exp $.

 osCommerce, Open Source E-Commerce Solutions.

 http://www.oscommerce.com.

 Copyright (c) 2002 osCommerce.

 Released under the GNU General Public License.

*/  .

Define('TITLE', 'How We Protect Your Credit Card Information');.

Define('HEADING_CC_SECURITY', 'How We Protect Your Credit Card Information');.

Define('TEXT_CLOSE_WINDOW', 'Close Window [x]');.

?>.

Name it the same filename as you named the previous code block, and place it in includes/languages/english/. Change the title etc. to what makes sense for your new popup..

Now create a new directory in includes/languages/english/ and name it html. Create a new HTML file using your favorite editor and put in the information that you want to appear in your new popup. You can use any HTML tags taht you want, and don't worry about escaping special characters. Name this file the same as you named the popup code in the previous code block, except change the extension from .php to .html. Put this file in includes/languages/english/html..

You should now have a popup that always works, even if java is disabled..

I really need to package this up and add it to the Contribution. When I have time..

Regards.

Jim..

Comment #5

Thank you so much. It took me some tinkering with my lack of knowledge of the overall layout of osCommerce, but I learned a lot implementing your code and it works exactly like I had hoped for..

Thanks for you help...

Comment #6

I packaged this up and added it to the.

Include HTML.

Contribution. Should be a bit easier than copying the code from this page..

Regards.

Jim..

Comment #7

Is there a way to pass a different filename to the popupWindow function? I will need a different page to popup for a lot of my products. It appears to me that this will popup the same html file. Thanks for you help...

Comment #8

This was designed as a static popup, but it should be adaptable to multiple popups. I can think of several ways to do this. You will need to pass a variable to the code (using either POST or GET) so that it knows what file to include. Or, if this will be strictly by product, you could use the product number. Just change the tep_href_link(FILENAME_POPUP_CC_SECURITY) in the second code snippit (it appears twice) to tep_href_link('filename_'$_GET['products_id']'.php'). That will give you a filename of popup_1.php for a product with an ID number of 1, and so forth..

This will require quite a few files. It would be cleaner to pass the information to the popup file (again, POST or GET) and have it select the HTML file. This would be a bit more work, but would result in less work in the long run..

Perhaps better than any of these would be to adapt the popup on product_info.php the one that does the images. This is already set up to pass the product ID to the popup. You could change it to pull text from a new database field, or to select an HTML file based on the product ID. This sounds like the cleanest approach..

Sorry for the rambling, I'm not thinking very coherently right now. If this is too much for you, I'll have a go at a detailed solution tomorrow..

Regards.

Jim..

Comment #9

Is there any way to just set a variable when I type in the "product description" that would be the filename of the page to popup?..

Comment #10

I just enabled "Search Engine Friendly" urls in my site. I had some javascript code that popped up a simple plain window with some detailed specifications about the product when the user clicked a button. Since enableing "Search Engine Friendly" urls on my site, this does not work any more. Does anyone have any suggestions as to how this might be accomplished? Thanks in Advance...

Comment #11

Simple: turn off Search Engine Friendly URLs. This code does not work properly, and the search engines don't need it anyway..

Regards.

Jim..

Comment #12


This question was taken from a support group/message board and re-posted here so others can learn from it.