Click to See Complete Forum and Search --> : [RESOLVED] New window
Ronny
01-05-2007, 05:34 PM
I have tryed to post this at osCommerce but with no response.
I have a osCommerce shop. In the product information page I have a link that opens a product url in a new window.
I would like to have this window without meny, adressbar, navigation ect.
The codes concerning this issue are as follows:
product_info.php (posting only what I think is significant):
<?php
}
if (tep_not_null($product_info['products_url'])) {
?>
<tr>
<td class="main"><?php echo sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false)); ?>
redirect.php (posting only what I think is significant):
break;
case 'url':
if (isset($HTTP_GET_VARS['goto']) && tep_not_null($HTTP_GET_VARS['goto'])) {
$check_query = tep_db_query("select products_url from " . TABLE_PRODUCTS_DESCRIPTION . " where products_url = '" . tep_db_input($HTTP_GET_VARS['goto']) . "' limit 1");
if (tep_db_num_rows($check_query)) {
tep_redirect('http://' . $HTTP_GET_VARS['goto']);
}
}
includes/languages/norwegian/product_info.php (whole file):
<?php
define('TEXT_PRODUCT_NOT_FOUND', 'Produktet finnes ikke!');
define('TEXT_CURRENT_REVIEWS', 'Omtaler:');
define('TEXT_MORE_INFORMATION','For å se siden, <a href="%s" target="_blank"><b>Trykk her.</b></a>');
define('TEXT_DATE_ADDED', 'Dette produktet ble lagt inn i vår katalog %s.');
define('TEXT_DATE_AVAILABLE', '<font color="#ff0000">Ventet inn %s.</font>');
define('TEXT_ALSO_PURCHASED_PRODUCTS', 'Kunder som kjøpte dette produktet, kjøpte også');
define('TEXT_PRODUCT_OPTIONS', 'Alternativer:');
define('TEXT_CLICK_TO_ENLARGE', 'Trykk for</br>større bilde');
?>
Can anyone help me opening this window without menu, addressbar ect. and the size I want?
Heres´s a link to the site: Eterya Design (http://www.eterya.com) . Click on test 2 on the front page and then "Trykk her" to see the way it currently is. (As a test Eterya Design is set as product url)
bpat1434
01-05-2007, 06:36 PM
You'd have to edit the Javascript function "popWin" in the source of the theme you're using. PHP can't define how to open a new window, it's server-side.
Moving to the appropriate forum
Basically, you're looking for a line that looks like this:
window.open(someURL, "", "someOptions");
The someOptions part is what you want to pay attention to. Take a look at this page for a neat popup window script generator (pay only attention to the line with window.open on it): Javascript Kit (http://javascriptkit.com/popwin/index.shtml)
Also look here (http://www.blazonry.com/javascript/windows.php) for some light reading on a popup.
Hope that helps.
Ronny
01-05-2007, 08:52 PM
Thank you.
I know about the javascript. I´m just not sure what files to edit.
I´ve been trying to put the javascript in languageas/product_info.php and made it somewhat work but I either get errormessages or a blank popup.
The url that to me seames to be defined as "%s" in that file is causing me a headache and the the interaction of files doesn´t make it easier :queasy:
In other words. I can make the script work but not make the url show as it´s up to another file (so to speak) to deside what the url is.
All I know is that link is in languages/product_info.php so that´s where I´ve been roaming lately :)
I´m probably giving you a headache now as I try to understand something my competance will not let me :D
bpat1434
01-06-2007, 01:25 AM
well %s is a holder for a string (much like in the PHP functions sprintf). So that is just a generalized function. Now, if every pop-up is going to be the same way (no toolbar / menubar) then you should just be able to modify that. If you post the code here, we could help you out.
Ronny
01-06-2007, 06:46 AM
Thank you. I have seen the "sprintf" in the product_info.php witch this file si dependent on but didn´t know what it meant.
Here´s the code with the link:
<?php
define('TEXT_PRODUCT_NOT_FOUND', 'Produktet finnes ikke!');
define('TEXT_CURRENT_REVIEWS', 'Omtaler:');
define('TEXT_MORE_INFORMATION','For å se siden, <a href="%s" target="_blank"><b>Klikk her</b></a>');
define('TEXT_DATE_ADDED', 'Dette produktet ble lagt inn i vår katalog %s.');
define('TEXT_DATE_AVAILABLE', '<font color="#ff0000">Ventet inn %s.</font>');
define('TEXT_ALSO_PURCHASED_PRODUCTS', 'Kunder som kjøpte dette produktet, kjøpte også');
define('TEXT_PRODUCT_OPTIONS', 'Alternativer:');
define('TEXT_CLICK_TO_ENLARGE', 'Trykk for</br>større bilde');
?>
There are as I said other files witch this file depends on but none of them has "<a href=" in them so I´m guessing the code above is the one you need. Please tell me if you need me to to post the other codes.
bpat1434
01-06-2007, 09:06 AM
There's an issue with just that code snippet. You think that's it, but in looking at the code, it's not.
If you go to your example page (click on the Test 2 product) then look at the HTML for the more information button which is the little (?) button, correct?, it's something like:
<a href="javascript:popupWindow
('http://eterya.com/popup_info_help.php?osCsid=e1a5115313331da073b923ec3b5f6111')"><img src="images/help.gif" alt="" border="0"></a>
In your code, there should be a 'target="black"' attribute to the link. Here there isn't one. So here's what we need to find:
The popupWindow function.
Okay, so if you open up /catalog/product_info.php and look at the top, you'll see this:
<?php
/*
$Id: product_info.php,v 1.97 2003/07/01 14:34:54 hpdl 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');
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO);
$product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
$product_check = tep_db_fetch_array($product_check_query);
?>
<!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; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<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=100,height=100,screenX=150,screenY=150,top=150,left=150')
}
//--></script>
</head>
Kaboom!! There's the function we need!! So, in looking at that, now what you need to do is compare the function information from the previous linked pages I gave you, and this one to see exactly how to make it do what you want.
[EDIT]
I do have to say, that from the looks of it, there should be nothing but just the window and the content (no statusbars, no toolbars). So if there is, then I think now it becomes an issue between the browsers, and not the javascript.
Okay, totally misunderstood you. But anyway, since you want to open it in a new window, just change the TEXT_MORE_INFORMATION variable to be define('TEXT_MORE_INFORMATION', '<a href="javascript:popupWindow(\'%s\');">Klikk her</a>';
and that should open all more information links in a pop-up with no menubars and toolbars and such.
Ronny
01-06-2007, 09:55 AM
BEATIFUL!!!!
Thank you sooo much. Works as a charm.
Since I want a different a size to the product url I copied the javascript and named it popupWindow2 and edited the size.
I now understand a bit more on how things work :)
Thanks again!
bpat1434
01-06-2007, 09:57 AM
Not a problem. Glad we could work through and get it figured out!!
PHP Builder
Copyright Internet.com Inc. All Rights Reserved.