Forums / All Other Contributions/Addons / Image Swap via Javascript

Image Swap via Javascript

Views: 22,848

Results 61 to 80 of 95
14 Jul 2008, 9:27 PM
#61
triplexxx avatar

triplexxx

New Zenner

Join Date:
May 2008
Posts:
31
Plugin Contributions:
0

Image Swap via Javascript

hi...i install IH2, slimbox, wishlist etc with no problems but why this dont work for me i try to many times and when i look my site all my additional pictures are gone!!!

what im doing wrong??

im running 1.3.8

17 Jul 2008, 6:20 AM
#62
meltdown avatar

meltdown

Totally Zenned

Join Date:
Jun 2006
Location:
My family and I live in Brighton, England
Posts:
947
Plugin Contributions:
0

Re: Image Swap via Javascript

This mod looks like just what the Doctor ordered (over-used pun intened, Chris). However, does it Not work with IH2 installed?

Thanks

17 Jul 2008, 1:54 PM
#63
creativewarrior avatar

creativewarrior

New Zenner

Join Date:
Jun 2008
Posts:
34
Plugin Contributions:
0

Re: Image Swap via Javascript

i love this mod - but now the line that say - click for larger image - is missing and i need my customers to be able to view a larger detailed image.

i got the mouseout to work fine but need this Larger Image line of text to come back?

17 Jul 2008, 2:34 PM
#65
creativewarrior avatar

creativewarrior

New Zenner

Join Date:
Jun 2008
Posts:
34
Plugin Contributions:
0

Re: Image Swap via Javascript

ok your probably sick of me talking to myself now but i figured out how to get the additional image to open a larger version but the main product image is still not clickable and the products with only one image are not clickable/enlargeable at all.

for an example of products with multiple images:
http://eternallycreative.com/index.php?main_page=product_info&cPath=35_36&products_id=145

and single image products:
http://eternallycreative.com/index.php?main_page=product_info&cPath=7&products_id=77

5 Aug 2008, 9:03 AM
#66
poosk avatar

poosk

Totally Zenned

Join Date:
Mar 2005
Location:
Helsinki
Posts:
477
Plugin Contributions:
0

Re: Image Swap via Javascript

Hi,

Thanks for the mod. extremely helpful but still a bit struggling with it. First of all I'm using onmouseclick I don't use large images (thus popups either) since I'm displaying quite large images on the product display page.

THE PROBLEM IS that I'd need the main image (the one set from the admin) to display in the additional images box as well since otherwise it cannot be clicked back on..

Other functionality that I'm missing is to swap through all the product images also by a onmouseclick on the main image..

7 Aug 2008, 2:45 PM
#68
poosk avatar

poosk

Totally Zenned

Join Date:
Mar 2005
Location:
Helsinki
Posts:
477
Plugin Contributions:
0

Re: Image Swap via Javascript

I guess you just need to add the main image twice.. which isn't really smooth but I can't figure out anything else for now..

4 Oct 2008, 10:17 PM
#69
maitaijim avatar

maitaijim

New Zenner

Join Date:
May 2008
Posts:
37
Plugin Contributions:
0

Re: Image Swap via Javascript

creativewarrior:

ok your probably sick of me talking to myself now but i figured out how to get the additional image to open a larger version but the main product image is still not clickable and the products with only one image are not clickable/enlargeable at all.

for an example of products with multiple images:
http://eternallycreative.com/index.php?main_page=product_info&cPath=35_36&products_id=145

and single image products:
http://eternallycreative.com/index.php?main_page=product_info&cPath=7&products_id=77

This version of tpl_modules_main_product_image.php should restore the click to enlarge for both single image and multiple image products.
I suggest keeping the onMouseOut set to true or it may seem as if it's enlarging the wrong image.
I haven't thoroughly tested this but I think it should do the trick.
Jim

<?php
/**
 * Module Template
 *
 * @package templateSystem
 * @copyright Copyright 2003-2005 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: tpl_modules_main_product_image.php 3208 2006-03-19 16:48:57Z birdbrain $
 */
?>
<?php require(DIR_WS_MODULES . zen_get_module_directory(FILENAME_MAIN_PRODUCT_IMAGE)); ?> 
<div id="productMainImage" class="centeredContent back">
<script language="javascript" type="text/javascript"><!--
document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . zen_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $_GET['products_id']) . '\\\')">' . zen_image($products_image_medium, addslashes($products_name), MEDIUM_IMAGE_WIDTH, MEDIUM_IMAGE_HEIGHT, 'name="imageSwap"') . '<br /><span class="imgLink">' . TEXT_CLICK_TO_ENLARGE . '</span></a>'; ?>');
//--></script>
<noscript>
<?php
  echo '<a href="' . zen_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $_GET['products_id']) . '" target="_blank">' . zen_image($products_image_medium, $products_name, MEDIUM_IMAGE_WIDTH, MEDIUM_IMAGE_HEIGHT) . '<br /><span class="imgLink">' . TEXT_CLICK_TO_ENLARGE . '</span></a>';
?>
</noscript>
</div>
18 Oct 2008, 8:12 PM
#70
nosleephotel avatar

nosleephotel

New Zenner

Join Date:
Sep 2008
Location:
Los Angeles, CA
Posts:
67
Plugin Contributions:
0

Re: Image Swap via Javascript

maitaijim,

I used the PHP code you suggested to get both "larger image" under the main and alternate image(s). I see it now under the main but not alternate image. Can you suggest a fix?

18 Oct 2008, 8:54 PM
#72
maitaijim avatar

maitaijim

New Zenner

Join Date:
May 2008
Posts:
37
Plugin Contributions:
0

Re: Image Swap via Javascript

nosleephotel:

maitaijim,

I used the PHP code you suggested to get both "larger image" under the main and alternate image(s). I see it now under the main but not alternate image. Can you suggest a fix?

Just a quick scan of the file "/includes/modules/YOURTEMPLATE/additional_images.php"
Around line 119 change,

this

        if (PRODUCT_IMAGE_SWAP_ON_CLICK !='true') $enlarge_text='';

to this

        if (PRODUCT_IMAGE_SWAP_ON_CLICK !='true') $enlarge_text='<br />' . TEXT_CLICK_TO_ENLARGE;

WARNING - this alteration will not support anyone using this mod for "click", only for mouse rollovers.

I'm not a 100% that this will do it, let me know if it works, it should.
Jim

18 Oct 2008, 9:08 PM
#73
nosleephotel avatar

nosleephotel

New Zenner

Join Date:
Sep 2008
Location:
Los Angeles, CA
Posts:
67
Plugin Contributions:
0

Re: Image Swap via Javascript

Now the alt image and footer are not showing up–means an error in the code, right? You can look at the page to see.

18 Oct 2008, 9:32 PM
#74
maitaijim avatar

maitaijim

New Zenner

Join Date:
May 2008
Posts:
37
Plugin Contributions:
0

Re: Image Swap via Javascript

nosleephotel:

Now the alt image and footer are not showing up–means an error in the code, right? You can look at the page to see.
hmmm....
Did you replace the first line with the second one? These PHP lines should always end with a semicolon. You need to scroll to see all of the second line.

Jim

18 Oct 2008, 9:44 PM
#75
nosleephotel avatar

nosleephotel

New Zenner

Join Date:
Sep 2008
Location:
Los Angeles, CA
Posts:
67
Plugin Contributions:
0

Re: Image Swap via Javascript

Yeah, here's a screen cap of how it is now (on line 119).

18 Oct 2008, 9:54 PM
#76
maitaijim avatar

maitaijim

New Zenner

Join Date:
May 2008
Posts:
37
Plugin Contributions:
0

Re: Image Swap via Javascript

That all looks correct, I'm not sure what would be causing this. I just tested the code switch myself and it has the desired outcome. It's on a local test server or I would post a link.

I assume that changing this line back to the original one fixes the page?

Jim

18 Oct 2008, 10:01 PM
#77
nosleephotel avatar

nosleephotel

New Zenner

Join Date:
Sep 2008
Location:
Los Angeles, CA
Posts:
67
Plugin Contributions:
0

Re: Image Swap via Javascript

Yeah, putting it back to ```php
if (PRODUCT_IMAGE_SWAP_ON_CLICK !='true') $enlarge_text='';


I'm guessing there's a change I've made elsewhere that is having an effect on this.  Should I revert back to original versions of the PHP files?  I'm not sure which these would be.
18 Oct 2008, 10:39 PM
#78
maitaijim avatar

maitaijim

New Zenner

Join Date:
May 2008
Posts:
37
Plugin Contributions:
0

Re: Image Swap via Javascript

Well starting fresh is never a bad idea when trying to solve a mystery. Just backup what you have so far. Maybe start with just replacing "/includes/modules/YOURTEMPLATE/additional_images.php" with the original one from the mod. Then make the change to line 119. If that doesn't do it replace all the files from this mod with the originals, if that doesn't do it my guess would that it's being effected by a file not related to this mod.

Jim

18 Oct 2008, 11:11 PM
#79
nosleephotel avatar

nosleephotel

New Zenner

Join Date:
Sep 2008
Location:
Los Angeles, CA
Posts:
67
Plugin Contributions:
0

Re: Image Swap via Javascript

Phew! Replacing with the mod's additional_images.php did the trick! Then put php if (PRODUCT_IMAGE_SWAP_ON_CLICK !='true') $enlarge_text='<br />' . TEXT_CLICK_TO_ENLARGE; back in. Also took it a step forward and changed TEXT_CLICK_TO_ENLARGE to ALTERNATE_IMAGE_TEXT and put the following in english.php (includes/languages/YOURTEMPLATE/english.php): ```php
define('TEXT_ALTERNATE_IMAGE', 'alternate image');


Thanks for you help thus far, Jim.  Have another question if you don't mind.  How hard would it be to hide the alternate image and put "alternate image" next to "larger image" under the main image?  I started a [thread asking the question](http://www.zen-cart.com/forum/showthread.php?t=110903) but so far no results.
18 Oct 2008, 11:38 PM
#80
maitaijim avatar

maitaijim

New Zenner

Join Date:
May 2008
Posts:
37
Plugin Contributions:
0

Re: Image Swap via Javascript

nosleephotel:

How hard would it be to hide the alternate image and put "alternate image" next to "larger image" under the main image? I started a thread asking the question but so far no results.
Just like DrByte stated, you would need to write a new mod to do this. It would be a nice option for alternate image display.

Jim