Forums / Setting Up Categories, Products, Attributes / larger image link beneath product image

larger image link beneath product image

Locked

Views: 4,423

Results 1 to 18 of 18
This thread is locked. New replies are disabled.
21 Jul 2009, 12:21 AM
#1
kismetdesign avatar

kismetdesign

Zen Follower

Join Date:
May 2009
Location:
Junction City, Oregon
Posts:
315
Plugin Contributions:
0

larger image link beneath product image

Right now beneath my product images I have a 'larger image' link that displays a slightly larger picture of my thumbnail.

Is there a way to gain more control over what this link does?

I'd like it to say 'Look Inside' instead of 'larger image'. And I'd like that link to go to an inside fold of the book.

Any chance I can get some help on this?

Thanks! :P

KismetDesign

21 Jul 2009, 9:16 PM
#2
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: larger image link beneath product image

If you just want to edit the words then you'll find a line in english.php that reads:```
define('TEXT_CLICK_TO_ENLARGE', 'larger image');


Just edit it to what you want.

If you want to get more adventurous then you need to edit tpl_modules_main_product_image.php  You are interested in line 15 or thereabouts.

Oh, and you probably want to adjust the noscript version lower down the page too!

You can determine what the 'larger' image is.  Zen cart uses three image folders - large, medium and default.  So, there are three versions of the image possible on the server.  They do not have to be all the same.  So, the image in the large folder might be of the inside of the book while the image in the medium and default might be of the cover of the book.

Nick
iszent.com

21 Jul 2009, 11:37 PM
#3
kismetdesign avatar

kismetdesign

Zen Follower

Join Date:
May 2009
Location:
Junction City, Oregon
Posts:
315
Plugin Contributions:
0

Re: larger image link beneath product image

Okay, I found the first item you mentioned and changed it to read "Look Inside Book", which is perfect. Thank you!

Next, I found the tpl_modules_main_product_image.php and found the lines you were talking about. I see right now that window opens up to the medium size image. Before I start messing with it, I have two questions...

1 - Can I create another directory that is titled inside_fold and somehow upload images to that? or

2 - Can I switch the med with the large images and just use all the images classified as large to be the ones I use for the inside fold?

Which would make more sense to you?

Thank you so much for your help.

KismetDesign

22 Jul 2009, 8:51 AM
#4
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: larger image link beneath product image

  1. Don't know. Everything is possible but this sounds like it is going to take some work.

  2. Well, yes, but...

I read the code the same way as you do, that it should call the medium image. However, on the site that I have played with this what actually happens is the small image is used for the product listing. The medium image is used for the product info and the large image is used for the 'larger image'.

So, in your case you would have pictures of the cover in small and medium and an inside fold as large.

I'm sure that the code makes sense and that I just need to look again and also have a look a function zen_image to see why it behaves this way :smile:

I'll PM you a link to the page where it is working

Nick
iszent.com

22 Jul 2009, 12:47 PM
#5
kismetdesign avatar

kismetdesign

Zen Follower

Join Date:
May 2009
Location:
Junction City, Oregon
Posts:
315
Plugin Contributions:
0

Re: larger image link beneath product image

Your page looks really nice. That is exactly what I'm hoping to do with mine.

I guess I can just use the 'larger image' for now and not worry about naming it anything else. I still have a couple last questions. :blink:

  1. How do you upload the image you want specifically into the 'large' folder and get it to show up?

  2. There is a margin on the pop up page in the lower right hand corner that shows the page has a black background. Is there any way to change this to a different background color or get rid of the margins?

  3. Is there a place in my admin panel that I can resize the pop up window or does it just go automatically by the size of my larger image?

Thanks so much for your help. I was really impressed with your site. :smile:

22 Jul 2009, 1:43 PM
#6
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: larger image link beneath product image

  1. I believe that the way it works is that Zen Cart uses the filename that you have given it when you first uploaded the image (productimage.jpg). Then, where appropriate it looks in the large folder for a corresponding image called (productimage_LRG.jpg). I think that you can change the naming protocol but have never bothered. What I do is edit three versions of the file before uploading anything. (productimage.jpg productimage_MED.jpg and product_image_LRG.jpg) Then i upload the small one using the admin panel, so that this is associated to the product. Then I just use FTP to put the others in the right folders in the images folder. And then it just works (Zen Cart is pretty amazing)

If you want to automate this a little bit a graphics program called IRFANVIEW is superb at batch processing ( as a linux user it is the only thing that I run under windows emulation ). Its free and it a great lightweight image viewer and editor too.

  1. I don't quite understand I am afraid. I do not see this but I am using firefox maybe it is a browser thing. If you send a link I'll have a look at your site.

  2. Not sure. I think I am right in saying that zen does not resize the large image (but I've been wrong before :smile: ) I think that the window will be the size of the image unless you are using proportional sizing, which I am. But as I say, I am a bit vague on this :unsure: so, you may get a better answer from someone else or by further searching.

Thanks for your kind comments about the site!

Nick
iszent.com

28 Jul 2009, 7:47 PM
#7
kismetdesign avatar

kismetdesign

Zen Follower

Join Date:
May 2009
Location:
Junction City, Oregon
Posts:
315
Plugin Contributions:
0

Re: larger image link beneath product image

Hmmm.... would you take a look at my code for the tpl_modules_main_product_image.php?

I've attached it to this post.

I changed everything from medium to large, then uploaded a copy of a sample large image into my images/large folder, named it the same only with _LRG at the end, and then rechecked my page.

Doesn't seem to be any different. :wink:

I'm sure it's operator error... on my part somewhere!

28 Jul 2009, 8:03 PM
#8
kismetdesign avatar

kismetdesign

Zen Follower

Join Date:
May 2009
Location:
Junction City, Oregon
Posts:
315
Plugin Contributions:
0

Re: larger image link beneath product image

Okay, I just did some playing around with this... and here's what happened...

I figured out that the image I originally saved into the 'large' folder was missing a letter, so it was misspelled. I resaved it into the 'large' folder and uploaded it.

Then I checked the page to see what happened, and the main image on the product page had changed to the large image! And when I clicked on the 'Look Inside' link beneath it, it also displayed the large image.

Very weird! So I had to delete the large image off the server for them both to revert back to the main product image. I couldn't figure out a way to separate the two out and have the main product image show up on the product page, and the LRG image I saved show up in the pop-up window. :blink:

28 Jul 2009, 8:03 PM
#9
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: larger image link beneath product image

Sorry, I must have been having a bad hair day when I said that about the medium images. The 'medium' in that file is relating to the image that is displayed on the product_info page itself.

The large image is called using the variable FILENAME_POPUP_IMAGE which has been set elsewhere (I assume to the path of the larger image)

So, revert to the default version of the file. My mistake.

Then try again and let me know. It should play the game without any alterations as long as you have the appropriate image in your large folder and it is named correctly.

By the way there was no attachment to the previous post.

Nick
iszent.com

28 Jul 2009, 8:05 PM
#10
kismetdesign avatar

kismetdesign

Zen Follower

Join Date:
May 2009
Location:
Junction City, Oregon
Posts:
315
Plugin Contributions:
0

Re: larger image link beneath product image

Okay I'll attach...

28 Jul 2009, 8:06 PM
#11
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: larger image link beneath product image

@your last post. Yes, this is what would have happened. revert to the unedited version of the tpl_ file and then upload the large image with the right name.

It will work....

Nick
iszent.com

28 Jul 2009, 8:10 PM
#12
kismetdesign avatar

kismetdesign

Zen Follower

Join Date:
May 2009
Location:
Junction City, Oregon
Posts:
315
Plugin Contributions:
0

Re: larger image link beneath product image

It worked! You're AWESOME! Woo Hoo! First major success I've had all day.

Now I'd still like to find a way to get rid of the margins on the right and bottom (or borders, not sure which on it is, only showing up on those two sides).

Do you know if there is a CSS style that could be doing this?

Thank you so much! Even if this doesn't work with the margins, still is a major success. :clap:

KismetDesign

28 Jul 2009, 8:53 PM
#13
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: larger image link beneath product image

I think that the javascript that creates the popup is loaded from :

includes/modules/pages/product_info/jscript_main.php

You'll be able to see the window sizes pretty clearly.

Nick
iszent.com

28 Jul 2009, 9:10 PM
#14
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: larger image link beneath product image

Oh and you need to edit

templates/yourtemplate/popup_image/main_page.php

a bit too!

But you need to work out how you are going to do this before jumping in. Are all your large images the same size?

If not then the resize that happens as default might be the best route.

Nick
iszent.com

29 Jul 2009, 12:27 AM
#15
kismetdesign avatar

kismetdesign

Zen Follower

Join Date:
May 2009
Location:
Junction City, Oregon
Posts:
315
Plugin Contributions:
0

Re: larger image link beneath product image

I would like the window to be an auto for the size. Having said that, I can keep most of these images the same width and height so if we need to define the size we can.

I am using a custom template folder, but the tpl_main_page.php is located only in my default_template folder. Should I edit it from there or copy/paste this file into my custom template folder?

I always wondered how this works, as there are alot of the same folders/files in both the default template file and the custom template file, but I know some are very different from each other. ???

As for the margins, which is really the only issue I have left, I'm wondering if the body id (popupImage) may be edited in the CSS file associated with it instead of here in the php or jscript file. I just don't see anything in either of these files that refers to margins or borders. :cool:

KismetDesign

29 Jul 2009, 12:31 AM
#16
kismetdesign avatar

kismetdesign

Zen Follower

Join Date:
May 2009
Location:
Junction City, Oregon
Posts:
315
Plugin Contributions:
0

Re: larger image link beneath product image

I just found the #popupImage in the CSS file in the default_template folder. It just says #popupImage {margin: 0em; padding: 0em; }

but..

in the CSS file in the custom_template folder, it doesn't have anything listed under the #popupImage. It just says #popupImage {
}

Very interesting... Gee I seem to be saying that alot lately! :P

29 Jul 2009, 10:10 AM
#17
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: larger image link beneath product image

Well, you need to understand the 'override system'. I'll PM you later today with a bit more info about how this works and how Zen 'chooses' which file to use. But there are good tutorials about it too!

Look at includes/templates/default template/popup_image/tpl_main_page.php

It has the following:

<body id="popupImage" class="centeredContent" onload="resize();">
<div>
<?php
  // $products_values->fields['products_image']
  echo '<a href="javascript:window.close()">' . zen_image($products_image_large, $products_values->fields['products_name'] . ' ' . TEXT_CLOSE_WINDOW) . '</a>';
?>
</div>
</body>

it is the onload="resize();" that is resizing the popup after it has loaded. You see the popup in one place and then it flicks to another place, right?

resize() is a function that is defined in-- includes/modules/pages/popup_image/javascript_main.php

What it does it attempt to resize the popup to the right size for the image. This is hard to do for every browser (browsers render popups differently) ! And the definitions are a little bit out of date! That's why the windo isn't the right size for your image.

So, either fiddle with this file to try and rectify the issue for the browsers that you care about. Or...

Go back to the code that is quoted further up this post and add some styling straight into the code. For instance:

<body id="popupImage" class="centeredContent" style=""  onload="resize();">
<div style="border:red 1px solid;">
<?php
  // $products_values->fields['products_image']
  echo '<a href="javascript:window.close()">' . zen_image($products_image_large, $products_values->fields['products_name'] . ' ' . TEXT_CLOSE_WINDOW) . '</a>';
?>
</div>
</body>

This file is pretty straight forward html so you can do what you want with it.

But, yes you should leave the default version as is and edit the 'override' version in your template. Edit:

includes/templates/YOURTEMPLATE/popup_image/tpl_main_page.php

If it does not exist then you need to create it by copying it from the default tamplate.

Nick
iszent.com

29 Jul 2009, 2:24 PM
#18
kismetdesign avatar

kismetdesign

Zen Follower

Join Date:
May 2009
Location:
Junction City, Oregon
Posts:
315
Plugin Contributions:
0

Re: larger image link beneath product image

That sounds pretty straightforward. I'm leaving for a meeting in an hour and when I get back I'll play with it. I understand what you mean now about the resizing windows, and why it would be better to lay out the code the way you mentioned. :smile:

KismetDesign