Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Popup images again - nothing helps!


stefan_p

Recommended Posts

I Have tried everything!!! My popus are the same size all the time, they are to small! My site is: www.doczysta.pl. There might be problem with transaltion on the site. Just check the popup images!!! Thanks!!!

Link to comment
Share on other sites

Lets first try decaf.

 

 

Now here is your error msg.

 

Warning: main(includes/languages/english/popup_add_image.php): failed to open stream: No such file or directory in /home/sklep/catalog/popup_add_image.php on line 32

Fatal error: main(): Failed opening required 'includes/languages/english/popup_add_image.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/sklep/catalog/popup_add_image.php on line 32

 

So go to the .php file and go down to line 32 and find the problem. PM me with your contact information and I'll try to help you.

Link to comment
Share on other sites

What is it you are trying to change? The size of the popup? Show me the entire source for the above mentioned folder, in polish and english if you don't mind. I'd like to see the changes you've made to it.

Link to comment
Share on other sites

This my popup_add_image.php from catalog/

 

<?php

/*

$Id: popup_add_image.php,v 2.0 2007/02/15 14:40:27 surfalot Exp $

 

Designed for: osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

v2.0 Copyright © 2006 Todd Holforty - [email protected]

 

AUTHOR: Zaenal Muttaqin <[email protected]>

MODIFIED BY: Todd Holforty mtholforty(at)surfalot(dot)com

Released under the GNU General Public License

 

This program is free software; you can redistribute it and/or modify

it under the terms of the GNU General Public License as published by

the Free Software Foundation; either version 2 of the License, or

(at your option) any later version.

 

This program is distributed in the hope that it will be useful,

but WITHOUT ANY WARRANTY; without even the implied warranty of

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

GNU General Public License for more details.

 

You should have received a copy of the GNU General Public License

along with this program; if not, write to the Free Software

Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

 

*/

 

require('includes/application_top.php');

 

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

 

$navigation->remove_current_page();

 

if (!empty($_GET['imagesID'])) {

$products_query = tep_db_query( "SELECT ai.products_id, ai.images_description, ai.thumb_images, ai.medium_images, ai.popup_images, p.products_image, p.products_image_med, p.products_image_pop, p.products_image_description FROM " . TABLE_ADDITIONAL_IMAGES . " ai, " . TABLE_PRODUCTS . " p WHERE ai.products_id=p.products_id and ai.additional_images_id = '".(int)$_GET['imagesID']."'");

$selected_image = tep_db_fetch_array($products_query);

} elseif (!empty($_GET['pID'])) {

$products_query = tep_db_query( "SELECT products_id, products_image, products_image_med, products_image_pop, products_image_description FROM " . TABLE_PRODUCTS . " WHERE products_id = '".(int)$_GET['pID']."'");

$selected_image = tep_db_fetch_array($products_query);

}

 

$imagemenu = new displaypopupimagemenu ( $selected_image['products_id'] );

 

// calculate menu size in pixels

$extra_window_width = 30; // space for web browser

$extra_window_height = 130; // space for web browser

 

if (ADDIMAGES_POPUP_SHOW_ON_POPUP == 'true' && ($imagemenu->addimages_count > 1)) {

list ($menu_width, $menu_height) = $imagemenu->boxsize();

if (ADDIMAGES_POPUP_TABLE_LOCATION == 'sides') {

$extra_window_width += $menu_width;

if ($imagemenu->maximageheight < $menu_height) { $imagemenu->maximageheight = $menu_height; }

}

if (ADDIMAGES_POPUP_TABLE_LOCATION == 'above' || ADDIMAGES_POPUP_TABLE_LOCATION == 'below') {

$extra_window_height += $menu_height;

if ($imagemenu->maximagewidth < $menu_width) { $imagemenu->maximagewidth = $menu_width; }

}

}

$imagemenu->maximageheight += 22; // add space for large image description text height

 

 

?>

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

<html <?php echo HTML_PARAMS; ?>>

<head>

<title><?php echo $selected_image['images_description']; ?></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"><!--

var i=0;

function resize() {

if (window.navigator.userAgent.indexOf('MSIE 6.0') != -1 && window.navigator.userAgent.indexOf('SV1') != -1) {

i=23; //IE 6.x on Windows XP SP2

} else if (window.navigator.userAgent.indexOf('MSIE 6.0') != -1) {

i=50; //IE 6.x somewhere else

} else if (window.navigator.userAgent.indexOf('MSIE 7.0') != -1) {

i=0; //IE 7.x

} else if (window.navigator.userAgent.indexOf('Firefox') != -1 && window.navigator.userAgent.indexOf("Windows") != -1) {

i=38; //Firefox on Windows

} else if (window.navigator.userAgent.indexOf('Mozilla') != -1 && window.navigator.userAgent.indexOf("Windows") != -1 && window.navigator.userAgent.indexOf("MSIE") == -1) {

i=45; //Mozilla on Windows, but not IE7

} else if (window.opera && document.childNodes) {

i=50; //Opera 7+

} else if (navigator.vendor == 'KDE' && window.navigator.userAgent.indexOf("Konqueror") != -1) {

i=-4; //Konqueror- this works ok with small images but not so great with large ones

//if you tweak it make sure i remains negative

} else {

i=0; //All other browsers

}

 

imgWidth = <?php echo $imagemenu->maximagewidth; ?>+<?php echo $extra_window_width; ?>;

imgHeight = <?php echo $imagemenu->maximageheight; ?>+<?php echo $extra_window_height; ?>-i;

var width = screen.width;

var height = screen.height;

var leftpos = width / 2 - imgWidth / 2;

var toppos = height / 2 - imgHeight / 2;

window.moveTo(leftpos, toppos);

 

if (document.getElementById("mainimage")) window.resizeTo(<?php echo (!empty($imagemenu->maximagewidth)?$imagemenu->maximagewidth:'document.getElementById("mainimage").width'); ?>+<?php echo $extra_window_width; ?>, <?php echo (!empty($imagemenu->maximageheight)?$imagemenu->maximageheight:'document.getElementById("mainimage").height'); ?>+<?php echo $extra_window_height; ?>-i);

self.focus();

}

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');

}

function showImage(img,width,height) {

if (document.getElementById("mainimage")) {

document.getElementById("mainimage").src = img;

document.getElementById("mainimage").height = height;

document.getElementById("mainimage").width = width;

}

}

//--></script>

</head>

<!-- © stat24 / podstrony -->

<script type="text/javascript">

<!--

document.writeln('<'+'scr'+'ipt type="text/javascript" src="http://s4.hit.stat24.com/_'+(new Date()).getTime()+'/script.js?id=ByA7Wa9.nDU3N7fb.o2G2cVH.M41F9ilJzb.klZDBBP.L7/l=11"></'+'scr'+'ipt>');

//-->

</script>

<body onLoad="resize();">

<?php

if (ADDIMAGES_POPUP_TABLE_LOCATION=='above' && ADDIMAGES_POPUP_SHOW_ON_POPUP=='true' && ($imagemenu->addimages_count > 1)) {

echo '<table border="0" cellspacing="0" cellpadding="0" width="100%"><tr><td valign="middle" align="center" class="pageHeading">' . TEXT_MENU_TITLE . '</td></tr><tr><td valign="middle" align="center">' . $imagemenu->altgroupoutput() . '</td></tr></table>';

}

 

echo '<table border="0" cellspacing="0" cellpadding="0" width="100%"><tr>';

if (ADDIMAGES_POPUP_TABLE_LOCATION=='sides' && (ADDIMAGES_POPUP_TABLE_ALIGNMENT=='left' || ADDIMAGES_POPUP_TABLE_ALIGNMENT=='center') && ADDIMAGES_POPUP_SHOW_ON_POPUP=='true' && ($imagemenu->addimages_count > 1)) {

echo '<td valign="middle" align="center" class="pageHeading">' . TEXT_MENU_TITLE . '<br>' . $imagemenu->groupoutput() . '</td>';

}

 

echo '<td valign="middle" align="center" width="100%">';

if (!empty($_GET['imagesID'])) {

echo tep_image(DIR_WS_IMAGES . (!empty($selected_image['popup_images'])?$selected_image['popup_images']:(!empty($selected_image['medium_images'])?$selected_image['medium_images']:(!empty($selected_image['thumb_images'])?$selected_image['thumb_images']:''))), $selected_image['images_description'], (ADDIMAGES_POPUP_RESTRICT_IMAGE_SIZE=='true'?POPUP_IMAGE_WIDTH:''), (ADDIMAGES_POPUP_RESTRICT_IMAGE_SIZE=='true'?POPUP_IMAGE_HEIGHT:''), 'id="mainimage"') . (!empty($selected_image['images_description'])?$selected_image['images_description']:'');

} elseif (!empty($_GET['pID'])) {

echo tep_image(DIR_WS_IMAGES . (!empty($selected_image['products_image_pop'])?$selected_image['products_image_pop']:(!empty($selected_image['products_image_med'])?$selected_image['products_image_med']:(!empty($selected_image['products_image'])?$selected_image['products_image']:''))), $selected_image['products_image_description'], (ADDIMAGES_POPUP_RESTRICT_IMAGE_SIZE=='true'?POPUP_IMAGE_WIDTH:''), (ADDIMAGES_POPUP_RESTRICT_IMAGE_SIZE=='true'?POPUP_IMAGE_HEIGHT:''), 'id="mainimage"') . (!empty($selected_image['products_image_description'])?$selected_image['products_image_description']:'');

}

echo '</td>';

 

if (ADDIMAGES_POPUP_TABLE_LOCATION=='sides' && ADDIMAGES_POPUP_TABLE_ALIGNMENT=='right' && ADDIMAGES_POPUP_SHOW_ON_POPUP=='true' && ($imagemenu->addimages_count > 1)) {

echo '<td valign="middle" align="center" class="pageHeading">' . TEXT_MENU_TITLE . '<br>' . $imagemenu->groupoutput() . '</td>';

}

if (!empty($imagemenu->maximagewidth) && !empty($imagemenu->maximageheight)) { echo '<td>' . tep_draw_separator('pixel_trans.gif', '4', $imagemenu->maximageheight) . '</td>'; }

echo '</tr></table>';

 

if (ADDIMAGES_POPUP_TABLE_LOCATION=='below' && ADDIMAGES_POPUP_SHOW_ON_POPUP=='true' && ($imagemenu->addimages_count > 1)) {

echo '<table border="0" cellspacing="0" cellpadding="0" width="100%"><tr><td valign="middle" align="center" class="pageHeading">' . TEXT_MENU_TITLE . '</td></tr><tr><td valign="middle" align="center">' . $imagemenu->altgroupoutput() . '</td></tr></table>';

}

?>

 <br>

<center><a href="java script:window.close();"><?php echo TEXT_CLOSE_WINDOW; ?></a></center>

<!-- stat24 clickMap -->

<script type="text/javascript" src="http://s4.hit.stat24.com/scriptxy.js?id=zapAUqcg6xfjfEep690CudVrrtI1vAM8uiyXOKkD2S3.A7/align=center/type=percent">

</script>

</body>

</html>

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

---------------------------------------------------------------------------------------

 

This is popup_add_image.php from languages/polish.php

 

 

<?php

/*

$Id: popup_add_image.php,v 1.00 2006/10/22 01:48:08 surfalot Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2002 osCommerce

 

Released under the GNU General Public License

*/

 

define('TEXT_MENU_TITLE', '');

define('TEXT_CLICK_TO_ENLARGE', 'Kliknij aby powiększyć');

define('TEXT_CLOSE_WINDOW', '[ Zamknij okno ]');

?>

Link to comment
Share on other sites

If I get that right, your problem is that the popup windows are not resizing rather then displaying the images all at the same size. That's a problem of the script ypu're using and should be easy to solve by adding a javascript that resizes the window to the pic size.

Link to comment
Share on other sites

<script language="javascript"><!--
var i=0;
function resize() {
 if (navigator.appName == 'Netscape') i=40;
 if (document.images[0]) window.resizeTo(document.images[0].width +30, document.images[0].height+60-i);
 self.focus();
}
//--></script>

 

and

 

<body onload="resize();">

 

will do the trick.

Link to comment
Share on other sites

I'm having the same issue on my site with the pop up image that you click when you want to 'view the product in a larger size'. When the pop up pops up, the window remains at a fixed size, no matter how big the image is, so to see the larger size you actually have to drag the corners of the window to resize the pop up window in order to see the image. This even happens with smaller pictures, you just don't have to drag it as much as for larger images.

 

All of that javascript is within the popup_image.php file, so it's already there and I don't know how to fix this problem in order to have the pop up window resize to the size of the image.

 

Can anyone help with this?

 

Thanks very much.

 

 

 

 

 

 

<script language="javascript"><!--
var i=0;
function resize() {
 if (navigator.appName == 'Netscape') i=40;
 if (document.images[0]) window.resizeTo(document.images[0].width +30, document.images[0].height+60-i);
 self.focus();
}
//--></script>

 

and

 

<body onload="resize();">

 

will do the trick.

Link to comment
Share on other sites

It's been two days since I posted this message and no response. I just upgraded to make sure I had the most recent version and still the same issue with pop ups.

 

Does anyone know how to resize that pop up window to fit the image?

 

Surely it can be done.

 

 

I'm having the same issue on my site with the pop up image that you click when you want to 'view the product in a larger size'. When the pop up pops up, the window remains at a fixed size, no matter how big the image is, so to see the larger size you actually have to drag the corners of the window to resize the pop up window in order to see the image. This even happens with smaller pictures, you just don't have to drag it as much as for larger images.

 

All of that javascript is within the popup_image.php file, so it's already there and I don't know how to fix this problem in order to have the pop up window resize to the size of the image.

 

Can anyone help with this?

 

Thanks very much.

Link to comment
Share on other sites

  • 5 weeks later...

Add me to the list of folk with this problem. I see it in Firefox, Seamonkey and Konqueror on Linux. I've tried the improved_popup_image contribution and also tried editing the popup_image.php file by hand as suggested elsewhere. I've made sure that javascript and popups are not blocked.

 

The popup is always a tiny thing just about the size of the thumbnail image.

 

The browser page source for popup_image.php looks like this:

 

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html dir="LTR" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>"My Life" Geocacher's T-Shirt, Extra Large</title>
<base href="http://egeocache.com/catalog/">
<script language="javascript"><!--
var i=0;
function resize() {
 if (navigator.appName == 'Netscape') i=40;
 if (document.images[0]) window.resizeTo(document.images[0].width +30, document.images[0].height+60-i);
 self.focus();
}
//--></script>
</head>
<body onload="resize();">
<img src="images/my_life_shirt_graphic.jpg" border="0" alt=""My Life" Geocacher's T-Shirt, Extra Large" title=" "My Life" Geocacher's T-Shirt, Extra Large " width="200" height="238"></body>
</html>

Link to comment
Share on other sites

I Have tried everything!!! My popus are the same size all the time, they are to small! My site is: www.doczysta.pl. There might be problem with transaltion on the site. Just check the popup images!!! Thanks!!!

 

Hey Stefan,

I had the same problem with popups. And in the forum there are loads of "solutions" none seemed to help. So this is what I did. I simply wrote in my own javascript in the header of the product_info.php pages like this: around line 16 you get:

<html <?php echo HTML_PARAMS; ?>>

<head>

 

so in the <head> section of product_info.php you add:

 

<script type="text/javascript">

 

function popUp(URL) {

day = new Date();

id = day.getTime();

eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=65

0,height=550');");

}

</script>

 

see in the parameters you can adjust the size of the window. That script is full functioning right now as we speak you can see it here: http://www.hogueprophecy.com/store/product...?products_id=36 -- click on the "Look inside this book" link. What you have to do to make that work is use this code in your item description as a link code for anything you want to appear in a popup:

<a href="java script:popUp('filepath_to_your_/XXX.html')"></a>

 

Then you need to prepare the html page or jpeg image that javascript link calls, and voila. Make sure to get the file path correct to the html page or image your popup calls and it is guaranteed to work. OK! It's a work around requiring more work that what it should be - BUT it works!

 

cheers,

Jamie1955

Jamie/Boulder

Link to comment
Share on other sites

Well, I made a little bit of progress here. Near the top of product_info.php is the following function definition:

 

<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>

 

The popup is apparently supposed to be resizable with "width=100,height=100" as the default but, as far as I can see, the code that calls popup_image.php and the code in popup_image.php fails to resize the popup.

 

My workaround is to set "width=100,height=100" to the size of the largest images I will use. It's a little ugly but at least the user doesn't have to repeatedly drag windows open to see the images.

Link to comment
Share on other sites

Well, I made a little bit of progress here. Near the top of product_info.php is the following function definition:

 

<script language="javascript"></script>

 

The popup is apparently supposed to be resizable with "width=100,height=100" as the default but, as far as I can see, the code that calls popup_image.php and the code in popup_image.php fails to resize the popup.

 

My workaround is to set "width=100,height=100" to the size of the largest images I will use. It's a little ugly but at least the user doesn't have to repeatedly drag windows open to see the images.

 

 

Why not just get rid of javascript pop-up windows altogether (most users have pop-up blockers anyway these days) and use CSS hover-up instead?

 

You can see it in action here:

http://www.apnea.co.uk/product_info.php?cP...products_id=313

* * * * * * * * * * * * * * * * * * * * *

Porpoises are most happy when wet!

\ _ \ _ \ _ \ _ \ _ \ _ \ _ \ _ \ _ \ _ \ _ \ _

Link to comment
Share on other sites

Why not just get rid of javascript pop-up windows altogether (most users have pop-up blockers anyway these days) and use CSS hover-up instead?

 

You can see it in action here:

http://www.apnea.co.uk/product_info.php?cP...products_id=313

 

That looks and acts really nice. I'll do that as soon as I can. I'm trying to get things started with as vanilla an osCommerce as possible. See, when I touch stuff, it tends to break :blush:

 

Is that in an existing contribution? I see a "thumbnail" class being used. Is that the CSS Image Gallery from the Dynamic Drive CSS library? Do you have to pay royalties?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...