Zen Cart Logo

attribute pop up images

Views: 61,589

Results 21 to 40 of 221
6 Jun 2007, 3:07 PM
#21
blag avatar

blag

Zen Follower

Join Date:
May 2007
Location:
Leicester, England
Posts:
165
Plugin Contributions:
0

attribute pop up images

A friend has helped me to add a margin around the pop-up image. The 'backgorund' colour can be adjusted so that the margin can appear to be a border.

Here's the revised file:

7 Jun 2007, 5:25 PM
#22
ckosloff avatar

ckosloff

Totally Zenned

Join Date:
Feb 2007
Location:
South Florida, USA
Posts:
1,375
Plugin Contributions:
0

Re: attribute pop up images

blag:

I modified the script so that it now works using the corresponding images in the /images/large/ subdirectory rather than images/attributes/medium

I did this because the 'large' directory already exists in the default zen cart set-up (I believe) AND I have already uploaded a significant number of the attributes 'large' images there!

In this mod of the mod, the required large image 'suffix' follows the Zen cart convention i.e. image_name_LRG*.xxx

*I hope that it may be of use to someone.
Blag,
Please allow me to correct an inaccuracy in this post.
The correct path is images/medium/attributes.
images/medium/ is created upon installation, you only create the attributes subfolder.
I think that it will also work if you put your large image in images/large/attributes and use the _LRG at the end of the file's name, Zen Cart scans both directories by default.
I am very interested in your research, please submit everything to the downloads --> other section, I think this contrib really belongs there.
Respectfully.

[argentiniansupermarket.com

](http://argentiniansupermarket.com)

8 Jun 2007, 6:54 AM
#23
blag avatar

blag

Zen Follower

Join Date:
May 2007
Location:
Leicester, England
Posts:
165
Plugin Contributions:
0

Re: attribute pop up images

ckosloff:

Blag,
Please allow me to correct an inaccuracy in this post.
The correct path is images/medium/attributes.
images/medium/ is created upon installation, you only create the attributes subfolder.
I think that it will also work if you put your large image in images/large/attributes and use the _LRG at the end of the file's name, Zen Cart scans both directories by default.
I am very interested in your research, please submit everything to the downloads --> other section, I think this contrib really belongs there.
Respectfully.
ckosloff

I haven't yet finalised my mods, so they are not 'ready' to be submitted to the download section.

Having reviewed the code for the mod, I can assure you that the mod, as originally posted will work only with images of suffix _MED in the folder you describe - no other variations will work. (Unless, that is, I have completely misread the code)

8 Jun 2007, 1:22 PM
#24
ckosloff avatar

ckosloff

Totally Zenned

Join Date:
Feb 2007
Location:
South Florida, USA
Posts:
1,375
Plugin Contributions:
0

Re: attribute pop up images

blag:

ckosloff

I haven't yet finalised my mods, so they are not 'ready' to be submitted to the download section.

Having reviewed the code for the mod, I can assure you that the mod, as originally posted will work only with images of suffix _MED in the folder you describe - no other variations will work. (Unless, that is, I have completely misread the code)
Point taken, and thanks for clarifying that.
I'll try to do a test to verify precisely that, if you are right won't add anything.
Please continue your research, this is an important contribution to Zen Cart.

[argentiniansupermarket.com

](http://argentiniansupermarket.com)

9 Jun 2007, 5:50 AM
#26
blag avatar

blag

Zen Follower

Join Date:
May 2007
Location:
Leicester, England
Posts:
165
Plugin Contributions:
0

Re: attribute pop up images

blag:

ckosloff

I have finally sorted the module, and here it is in zipped including a 'Read Me' text file.
OOPS!

The zip file is utterly confusing, because there are superseded files included. Please ingnore and download the updated version from Downloads/Other Modules/Attribute Pop-up (Large Images)

9 Jun 2007, 3:46 PM
#27
ckosloff avatar

ckosloff

Totally Zenned

Join Date:
Feb 2007
Location:
South Florida, USA
Posts:
1,375
Plugin Contributions:
0

Re: attribute pop up images

blag:

OOPS!

The zip file is utterly confusing, because there are superseded files included. Please ingnore and download the updated version from Downloads/Other Modules/Attribute Pop-up (Large Images)
Good job!
Just one question here.
When I upload an attribute image swatch (a thumbnail), Zen Cart by default will try to upload it to ROOT/images/attributes.
In the old version of this contrib, Zen Cart was scanning in ROOT/images/medium/attributes for the larger image.
Now, where exactly will Zen Cart scan in your mod:

  1. ROOT/images/large/
  2. ROOT/images/large/attributes (I create this subfolder).
  3. Both
    ?
    Thanks for the hard work.

[argentiniansupermarket.com

](http://argentiniansupermarket.com)

10 Jun 2007, 2:15 AM
#28
btetra avatar

btetra

New Zenner

Join Date:
Jun 2007
Posts:
2
Plugin Contributions:
0

Re: attribute pop up images

ckosloff, the information you are looking for is in the attributes.php file. You can easily modify the path for it to work wherever you wish.

this is the line you need to change: $path = DIR_WS_IMAGES . '/large/'

blag, have you thought about adding lightbox support to this as well? Thanks for your hard work.

10 Jun 2007, 3:46 AM
#29
ckosloff avatar

ckosloff

Totally Zenned

Join Date:
Feb 2007
Location:
South Florida, USA
Posts:
1,375
Plugin Contributions:
0

Re: attribute pop up images

btetra:

ckosloff, the information you are looking for is in the attributes.php file. You can easily modify the path for it to work wherever you wish.

this is the line you need to change: $path = DIR_WS_IMAGES . '/large/'

blag, have you thought about adding lightbox support to this as well? Thanks for your hard work.
gotcha, thanks.

[argentiniansupermarket.com

](http://argentiniansupermarket.com)

10 Jun 2007, 4:19 AM
#30
blag avatar

blag

Zen Follower

Join Date:
May 2007
Location:
Leicester, England
Posts:
165
Plugin Contributions:
0

Re: attribute pop up images

ckosloff & btetra

The revised files in my version look here, and here ONLY: ROOT/images/large/

(as explained in the Read Me File - I though I had made this absolutely clear)

I suppose it would be possible to script it so that it looked in a secondary folder, but since I have declared that the files must be in a certain location and in a specific format, I believe that is sufficient

SO you can use existing 'large' files for the pop-up (In some case, including me, this will avoid duplication of these files in different locations)

If you want to modify the file locations setting open the file attributes.php and search for 'Mike Scott 070606'

Once found you will see that the next 'section' of the PHP file looks like this:

$array_filename = split("[/\\.]", $products_options->fields['attributes_image']) ;
                    $filename = $array_filename[count($array_filename)-2];
                    $extension = '.'.$array_filename[count($array_filename)-1];
                    $filename = $filename.'_LRG';
                    $path = DIR_WS_IMAGES . '/large/';
                    $attribute_image_lrg = $path . $filename. $extension;
                    $selected_attrname = $products_options_names->fields['products_options_name'] . ': '.$products_options->fields['products_options_values_name'];

As btetra rightly suggested, you can edit the line ```
$path = DIR_WS_IMAGES . '/large/';



To change the border sizes you need to modify the following lines in the javascript file : ```
writeln('<html><head><title>Loading...</title><style>body{margin-bottom:32px;margin-left:8px;margin-right:8px;margin-top:8px;font-family:tahoma, arial, helvetica, Geneva, sans-serif;}</style>')
writeln('width=parseInt(document.images[0].width)+16;');
writeln('height=parseInt(document.images[0].height)+40;');
writeln('window.resizeTo(width+12,height+84);}');writeln('if (isNN){');       
writeln('window.innerWidth=document.images["George"].width+16;');

But note that Internet Explorer does funny things: that is why the line writeln('window.resizeTo(width+12,height+84) doesn't seem to make sense, it seems to be that the additional value for the height needs to be twice the 'real' value plus 4 pixels, whilst the value for the additional width is 4 pixels less than its 'real' value!

To change the font for the text, modify it here: ```
writeln('<html><head><title>Loading...</title><style>body{margin-bottom:32px;margin-left:8px;margin-right:8px;margin-top:8px;font-family:tahoma, arial, helvetica, Geneva, sans-serif;}</style>');


To change the background colour of the image i.e. the borders, you need to chnage the hex value in this line: ```
else writeln('</head><body bgcolor=ffffff scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
writeln('<img name="George" src='+imageURL+' style="display:block"> <center>' + imageDesc + '<br/><a href="#" onclick=" self.close();">Close Window</a></center></body>
``` after 'bgcolor=".


I don't know anything about Lightbox - so I would have to look into that. What IS lightbox? (BTW I am not a programmer and I have never previously dabbled with either php or javascript - this was just beginner's luck.

FOOTNOTE:

My motivation to produce this was the fact that I am convinced that I can produce far better-looking thumbnails than the auto-generated thumbnail software does, and, it goes without saying that the page load time must be reduced because the browser is only loading the thumbnail, not the whole large file, and then processing it for display purposes - even if some or all of the image processing is done server-side.

I have just realised that the Attributes.php file is probably not the original for 1.3.7, I think that it may be the 'Products with Attributes' version.
10 Jun 2007, 5:00 AM
#32
blag avatar

blag

Zen Follower

Join Date:
May 2007
Location:
Leicester, England
Posts:
165
Plugin Contributions:
0

Re: attribute pop up images

ckosloff:

Blag,
http://www.zen-cart.com/index.php?main_page=product_contrib_info&cPath=40_47&products_id=273
check that for Lightbox
ckosloff

I am probably very dense.

I still don't 'get' this lightbox thing. I'd like to see a working example.

If it's what I 'think' it is, then I am not sure what features btetra wants added to it.

Mike

10 Jun 2007, 12:49 PM
#33
btetra avatar

btetra

New Zenner

Join Date:
Jun 2007
Posts:
2
Plugin Contributions:
0

Re: attribute pop up images

blag,

instead of opening up a new window, the lightbox function overlays the image on the screen.

there's an example of the lightbox in action here (not my site):

http://throughmylensphotography.com/store/christmas-at-the-williamsburg-inn-p-66.html

if you click on the picture it will give you an example of lightbox in action.

like yourself i'm not much of a programmer but i can kludge code together from time to time. i'm trying to see if i can get the lightbox to work on my own, if i do i'll be happy to send you the code to review. thanks for your input

11 Jun 2007, 7:44 AM
#34
blag avatar

blag

Zen Follower

Join Date:
May 2007
Location:
Leicester, England
Posts:
165
Plugin Contributions:
0

Re: attribute pop up images

btetra:

blag,

instead of opening up a new window, the lightbox function overlays the image on the screen.

there's an example of the lightbox in action here (not my site):

http://throughmylensphotography.com/store/christmas-at-the-williamsburg-inn-p-66.html

if you click on the picture it will give you an example of lightbox in action.

like yourself i'm not much of a programmer but i can kludge code together from time to time. i'm trying to see if i can get the lightbox to work on my own, if i do i'll be happy to send you the code to review. thanks for your input
Ho-hum.

I understand: the 'Lightbox' effect is very professional.

The Lightbox adds text to the bottom of the image, It has a close box, and it uses 'onblur' (I presume) to close the pop-up window in the event that the user clicks back in the main window.

I suppose btetra wants to get this to work with Attributes!!

The key is to establish the 'arguments' that the Lightbox 'function' requires and to pass those arguments to the lightbox. Using an image handler for the products listing image is slightly easier in that the products images dimensions are, I believe, stored with the image as part of the Zen Cart upload process. The Lightbox may well use the dimensional data to figure out what size is required for the pop-up. It would appear that the attributes images' dimensions are not stored during the Zen CARt attributes upload process, and so this data cannot be derived from the databse, and hence cannot be passed to the Lightbox.

This is why the solution that I modified uses another pop-up script!

In any event I would be happy to review your code if you make any progress.

26 Jun 2007, 2:35 AM
#35
ckosloff avatar

ckosloff

Totally Zenned

Join Date:
Feb 2007
Location:
South Florida, USA
Posts:
1,375
Plugin Contributions:
0

Re: attribute pop up images

blag,
I ran into trouble with your mod after installing Image Handler, the pop-up when hovering over images stopped working and resumed upon uninstalling the mod.
Any clue how to fix this?
Thanks.

[argentiniansupermarket.com

](http://argentiniansupermarket.com)

26 Jun 2007, 9:46 AM
#36
blag avatar

blag

Zen Follower

Join Date:
May 2007
Location:
Leicester, England
Posts:
165
Plugin Contributions:
0

Re: attribute pop up images

ckosloff

Sorry to hear about your problem.

As you know I am not the author of the 'original' version of this - all I have done is add a few embellishments and I have changed the default directory from being yet another directory full of images to one that uses the 'large' images folder.

As I understand things, and please bear in mind that I am no expert, the mod works in the following way:

  1. Because the modified 'attributes.php' file is located in includes\modules\YOUR_TEMPLATE subdirectory, it is, effectively, an 'override' which means that this file will supersede the original 'attributes' file.
  2. In order to establish whether there are any qualifying images, when Zen Cart invokes the 'attributes.php' file from the store's includes\modules\YOUR_TEMPLATE subdirectory, the attributes file searches through the 'page' that is being loaded and finds all the relevant attributes images, and checks to see whether there are any corresponding images with the suffix _LRG in the 'large' folder.
  3. The 'attributes' php file puts all the data into an array, and adds the product option name text below the thumbnail and adds 'Click to Enlarge' above the thumbnail.
  4. When the page loads the, the array of attributes images is loaded, including the additional text.
  5. The Javascript file, 'jscript_dynamic_window_popup.js' located in \includes\templates\YOUR_TEMPLATE \jscript is, I believe, fairly benign in that it is only invoked once the imaged is clicked on.
  6. When the user clicks on the attributes image the Javascript opens a new window and displays the _LRG image and the additional text.In your message you do not make it clear what you are using to 'get' your hover effect. Would I be right in assuming that the effect is generated by Image Handler 2? If not, please be so good as to identify what mod you are using to achieve the 'hover' effect on attributes images.

The Attribute Pop Up Images Large mod should not affect any images other than the attributes images: I am fairly certain that there isn't any code in the mod that will affect any other image.

It is worth noting, however, that the modified 'attributes.php' file included in the mod may not be based on the 'original' Zen Cart 'attributes.php' file. In this case it could be that another mod is affecting the behaviour of the 'attributes.php' file. Having said this, as far as I can tell, the base attributes file into which my mod has been inserted appears to be the Zen Cart original, but you may care to email to me a copy of your base 'attributes.php' file and I'll check it out.

I hope this helps - even though it would appear that it doesn't solve your problem!!

blag

26 Jun 2007, 12:43 PM
#37
ckosloff avatar

ckosloff

Totally Zenned

Join Date:
Feb 2007
Location:
South Florida, USA
Posts:
1,375
Plugin Contributions:
0

Re: attribute pop up images

blag,
Thank you very much for the very detailed and super fast response!
Really impressive.
Yes, I am using Image Handler 2 to generate the hover effect.
Since all these effects are happening on a local test site, I decided to clone again (this time on a different server), so will email you the base attributes.php as soon as I get that done.
Thanks again.

[argentiniansupermarket.com

](http://argentiniansupermarket.com)

2 Jul 2007, 9:54 PM
#38
sonicparke avatar

sonicparke

Zen Follower

Join Date:
Jul 2006
Posts:
120
Plugin Contributions:
0

Re: attribute pop up images

Man. I've read through this entire thread more than once and this is just not working on my site.

It doesn't look like the javascript is workign on the images. So therefore no popup. I have IH2 installed. Am I missing something?

thanks,

Brad

3 Jul 2007, 12:20 AM
#39
ckosloff avatar

ckosloff

Totally Zenned

Join Date:
Feb 2007
Location:
South Florida, USA
Posts:
1,375
Plugin Contributions:
0

Re: attribute pop up images

sonicparke:

Man. I've read through this entire thread more than once and this is just not working on my site.

It doesn't look like the javascript is workign on the images. So therefore no popup. I have IH2 installed. Am I missing something?

thanks,

Brad
Unbeknownst to this thread I have been working with blag on this issue.
There is a new version of the contrib, 1.0.2, published today in the download section.
Or you can simply move your javascript to root/includes/templates/template_default/jscript/
It will conflict with IH2 in the custom folder.

[argentiniansupermarket.com

](http://argentiniansupermarket.com)

3 Jul 2007, 3:05 AM
#40
sonicparke avatar

sonicparke

Zen Follower

Join Date:
Jul 2006
Posts:
120
Plugin Contributions:
0

Re: attribute pop up images

ckosloff:

Unbeknownst to this thread I have been working with blag on this issue.
There is a new version of the contrib, 1.0.2, published today in the download section.
Or you can simply move your javascript to root/includes/templates/template_default/jscript/
It will conflict with IH2 in the custom folder.

I've actually got that one installed and in the correct directories and it's still not working. The only other contribs I've got installed are IH2 & the one for IE conditional comments.

Any other thoughts?