Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / Additional_Images.php Line 16-display link if no large

Additional_Images.php Line 16-display link if no large

Locked

Views: 3,880

Results 1 to 11 of 11
This thread is locked. New replies are disabled.
16 Oct 2007, 11:09 PM
#1
donn avatar

donn

Zen Follower

Join Date:
Oct 2007
Posts:
241
Plugin Contributions:
0

Additional_Images.php Line 16-display link if no large

if (!defined('IMAGE_ADDITIONAL_DISPLAY_LINK_EVEN_WHEN_NO_LARGE')) define('IMAGE_ADDITIONAL_DISPLAY_LINK_EVEN_WHEN_NO_LARGE','Yes');

After seeing this line, I wondered if there was a way to set Zen Cart so that the link that says ' larger image' is ONLY displayed when a LARGE additional image (LRG or whatever suffix & dir you have set!) is present.....

If possible, i'd like to make it so that if there is no large photo, then there is no link for a larger image. Is it a simple setting? If so, where is it?? I looked in Admin/Images but didnt find it.

Thank you!!!!!!!!!!!!!!!!

17 Oct 2007, 3:04 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Additional_Images.php Line 16-display link if no large

That's not an admin switch.

If you want that functionality, create the following new file:

/includes/extra_datafiles/disable_large_image_popups.php

put this inside it:```

<?php define('IMAGE_ADDITIONAL_DISPLAY_LINK_EVEN_WHEN_NO_LARGE','No'); // ?>
17 Oct 2007, 11:45 AM
#3
donn avatar

donn

Zen Follower

Join Date:
Oct 2007
Posts:
241
Plugin Contributions:
0

Re: Additional_Images.php Line 16-display link if no large

DrByte:

That's not an admin switch.

If you want that functionality, create the following new file:

/includes/extra_datafiles/disable_large_image_popups.php

put this inside it:```

<?php define('IMAGE_ADDITIONAL_DISPLAY_LINK_EVEN_WHEN_NO_LARGE','No'); // ?>

Thank you, Dr. Byte!!

That was an easy solution, though I know I wouldn't have found it on my own~!!

:blink:
17 Oct 2007, 8:09 PM
#4
donn avatar

donn

Zen Follower

Join Date:
Oct 2007
Posts:
241
Plugin Contributions:
0

Re: Additional_Images.php Line 16-display link if no large

DrByte:

That's not an admin switch.

If you want that functionality, create the following new file:

/includes/extra_datafiles/disable_large_image_popups.php

put this inside it:```

<?php define('IMAGE_ADDITIONAL_DISPLAY_LINK_EVEN_WHEN_NO_LARGE','No'); // ?>

It worked perfectly.  Thanks for your help.  

The first  product listing image (the first _MED file...NOT an additional image) still has a 'click for larger' or whatever, even when there was none.  I don't know if this is a seperate thread or not....well, new title at least for my comment....lol

**How can I disable the click for larger when not present for the product listing, in the manner shown regarding the additional images?**

AND....how might I learn a LOT more about Zen Cart?  Does the book cover any of this?  Are there tutorials covering this stuff?  Thanks.........!
17 Oct 2007, 9:38 PM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Additional_Images.php Line 16-display link if no large

Donn:

The first product listing image (the first _MED file...NOT an additional image) still has a 'click for larger' or whatever, even when there was none. I don't know if this is a seperate thread or not....well, new title at least for my comment....lol

**How can I disable the click for larger when not present for the product listing, in the manner shown regarding the additional images?**When you say "product listing", are you referring to the "product information" page? or the product-listing page which lists all the products in a given category?

18 Oct 2007, 2:12 AM
#6
donn avatar

donn

Zen Follower

Join Date:
Oct 2007
Posts:
241
Plugin Contributions:
0

Re: Additional_Images.php Line 16-display link if no large

DrByte:

When you say "product listing", are you referring to the "product information" page? or the product-listing page which lists all the products in a given category?

I have to get my terminology str8...........

I mean the page that loads when you click on a particular product in the category or subcat listing. I meant 'prod info' i guess.

18 Oct 2007, 2:47 AM
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Additional_Images.php Line 16-display link if no large

To cause the product image on the "product_info" page to not be clickable, copy the tpl_main_product_image.php template file to your custom template folder, and change these:```

<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) . '<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> ```to this:``` <?php echo zen_image($products_image_medium, $products_name, MEDIUM_IMAGE_WIDTH, MEDIUM_IMAGE_HEIGHT); ?> ```
18 Oct 2007, 6:52 AM
#8
donn avatar

donn

Zen Follower

Join Date:
Oct 2007
Posts:
241
Plugin Contributions:
0

Re: Additional_Images.php Line 16-display link if no large

DrByte:

To cause the product image on the "product_info" page to not be clickable, copy the tpl_main_product_image.php template file to your custom template folder, and change these:```

<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) . '<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> ```to this:``` <?php echo zen_image($products_image_medium, $products_name, MEDIUM_IMAGE_WIDTH, MEDIUM_IMAGE_HEIGHT); ?> ``` THanks for the code........!

Will this permit the 'click for larger' popup if the large file is present?

Or will it disable ALL 'click for popup' links, even if there IS a large file??

It looks like it doesn't allow for ANY clickable popups. But as I only recently started learning PHP.............I know I may be WAY off...........

18 Oct 2007, 7:33 AM
#9
donn avatar

donn

Zen Follower

Join Date:
Oct 2007
Posts:
241
Plugin Contributions:
0

Re: Additional_Images.php Line 16-display link if no large

Donn:

THanks for the code........!

Will this permit the 'click for larger' popup if the large file is present?

Or will it disable ALL 'click for popup' links, even if there IS a large file??

It looks like it doesn't allow for ANY clickable popups. But as I only recently started learning PHP.............I know I may be WAY off...........

OK...I changed the PHP file....

And the clickable popup on the product description page is gone. BUT...
That's true even when the largfe file is there. I tried changing it, but had no luck.

Here's what i did...I took some code from the other php file alteration Dr. Byte made for the additional photos MED script......

if (file_exists(DIR_WS_IMAGES . 'large/' . $products_image_large)) {
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>';}

I thought this might work to display a link only when large photos exist.

BUT...this doesnt seem to work. Am I not using the If THEN statement properly? Is this even the correct palce for it? Am I TOTALLY off?!?!

Im clueless but Im trying!!!!!!

18 Oct 2007, 2:05 PM
#10
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Additional_Images.php Line 16-display link if no large

tpl_modules_main_image.php```

<?php require(DIR_WS_MODULES . zen_get_module_directory(FILENAME_MAIN_PRODUCT_IMAGE)); ?> <div id="productMainImage" class="centeredContent back">

[B]<?php if (strstr($products_image_large, 'large/')) { ?>
[/B]

<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) . '<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> [B] <?php } else { echo zen_image($products_image_medium, $products_name, MEDIUM_IMAGE_WIDTH, MEDIUM_IMAGE_HEIGHT); } ?>[/B] </div> ```
18 Oct 2007, 4:10 PM
#11
donn avatar

donn

Zen Follower

Join Date:
Oct 2007
Posts:
241
Plugin Contributions:
0

Re: Additional_Images.php Line 16-display link if no large

DrByte:

tpl_modules_main_image.php```

<?php require(DIR_WS_MODULES . zen_get_module_directory(FILENAME_MAIN_PRODUCT_IMAGE)); ?> <div id="productMainImage" class="centeredContent back">

[B]<?php if (strstr($products_image_large, 'large/')) { ?>
[/B]

<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) . '<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> [B] <?php } else { echo zen_image($products_image_medium, $products_name, MEDIUM_IMAGE_WIDTH, MEDIUM_IMAGE_HEIGHT); } ?>[/B] </div> ```

Thanks again, Dr. Byte! This PHP script worked perfectly.

I see that FIRST of all, I had no else statement, so even if I was otherwise correct, only half the desired result would obtain.

But additionally, Dr. Byte also didn't check for the file itself, but rather a string.

Can anyone simpy tell me..is the 'products_image_large' string the name of the file Zen Cart designates as the 'large image' that will display if the popup feature is on? In other words, does $products_image_large sometimes contain the name of a file that is NOT a large file, but just the base image file in /IMAGES/ which is then handled as such by zencart?

I notice that without 'popups disabled if no large photo' and no large photo is present, ZC will display a smaller image.

I am trying to understand this, Im new to PHP....

I understand that the IF (strstr statement is checking the $products_image_large string.....is it checking to see if the 'large/' subdir is part of the string? (as Im guerssing it would be if a large photo is present)

I am trying to understand this all a bit better....thanks in advance!!!!!!!!!