Forums / Templates, Stylesheets, Page Layout / How would I change default image from the small to the medium or large

How would I change default image from the small to the medium or large

Started by l0st1 on 23 Apr 2014, 1:28 PM · Views: 1,391

Results 1 to 9 of 9
23 Apr 2014, 1:28 PM
#1
l0st1 avatar

l0st1

New Zenner

Join Date:
Mar 2012
Posts:
11
Plugin Contributions:
0

How would I change default image from the small to the medium or large

Hi there, this is not an image size management question - I understand the sizing, etc...
I use 3 completely different images for the main product image in a cart I am setting up.
I am afraid I am stuck on this silly little "simple" thing.:frusty:

I need the image that displays on the product page and details page to be one image - the (medium) photo that the person would order to be placed on the product and then the image that ends up in the shopping cart to be a second image - the small photo I have merged with the product so that they and the store owner see a preview what they are getting.
I went around and around yesterday trying to accomplish this through the back end and couldn't.

I can't figure out how to edit either the shopping cart templates to use the medium image.Alternately i would have to modify several of the product pages which again - not sure how to change. None of my blind guesses worked.
Then I thought that I could simply define the default image as the medium image, but was unable to find where I might do that. Can any of you point me in the right directions or suggest what I might do? I have been staring at it too long and it seems like it should be a very simple task. I must have missed something.

I do have image handler installed and 1.51 and i am currently playing with stirling_grand responsive template. It's not up yet so can't provide a link, sorry.

Thanks in advance.

23 Apr 2014, 1:53 PM
#2
l0st1 avatar

l0st1

New Zenner

Join Date:
Mar 2012
Posts:
11
Plugin Contributions:
0

Re: How would I change default image from the small to the medium or large

this is what I thought I could edit, but I don't htink that will work unless I do after Iadd all of the products```

<?php /** * main_product_image module * * @package templateSystem * @copyright Copyright 2003-2006 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: main_product_image.php 4663 2006-10-02 04:08:32Z drbyte $ */ if (!defined('IS_ADMIN_FLAG')) { die('Illegal Access'); } $products_image_extension = substr($products_image, strrpos($products_image, '.')); $products_image_base = str_replace($products_image_extension, '', $products_image); $products_image_medium = $products_image_base . IMAGE_SUFFIX_MEDIUM . $products_image_extension; $products_image_large = $products_image_base . IMAGE_SUFFIX_LARGE . $products_image_extension; // check for a medium image else use small if (!file_exists(DIR_WS_IMAGES . 'medium/' . $products_image_medium)) { $products_image_medium = DIR_WS_IMAGES . $products_image; } else { $products_image_medium = DIR_WS_IMAGES . 'medium/' . $products_image_medium; } // check for a large image else use medium else use small if (!file_exists(DIR_WS_IMAGES . 'large/' . $products_image_large)) { if (!file_exists(DIR_WS_IMAGES . 'medium/' . $products_image_medium)) { $products_image_large = DIR_WS_IMAGES . $products_image; } else { $products_image_large = DIR_WS_IMAGES . 'medium/' . $products_image_medium; } } else { $products_image_large = DIR_WS_IMAGES . 'large/' . $products_image_large; } /* echo 'Base ' . $products_image_base . ' - ' . $products_image_extension . '<br>' . 'Medium ' . $products_image_medium . '<br><br>' . 'Large ' . $products_image_large . '<br><br>'; */ // to be built into a single variable string ?>
23 Apr 2014, 2:01 PM
#3
drbyte avatar

drbyte

Sensei

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

Re: How would I change default image from the small to the medium or large

You said you want the main product image as shown on the product-details page to be the medium image. Good. That's what Zen Cart does normally out-of-the-box.
Everywhere else it uses the smaller thumbnail image.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

23 Apr 2014, 2:12 PM
#4
l0st1 avatar

l0st1

New Zenner

Join Date:
Mar 2012
Posts:
11
Plugin Contributions:
0

Re: How would I change default image from the small to the medium or large

I need the "small" image that is sent to the cart to be different from the image shown everywhere else, so want to use it only as the image to go through to the cart. thought that I could simply change the cart page and switch the line to ['products_image_medium'] but that didn't work. not sure why.

  </td>
       <td class="cartProductDisplay">
<a href="<?php echo $product['linkProductsName']; ?>"><span id="cartImage" class="back"><?php echo $product['products_image']; ?></span><span id="cartProdTitle"><?php echo $product['productsName'] . '<span class="alert bold">' . $product['flagStockCheck'] . '</span>'; ?></span></a>
<br class="clearBoth" />
23 Apr 2014, 2:24 PM
#5
l0st1 avatar

l0st1

New Zenner

Join Date:
Mar 2012
Posts:
11
Plugin Contributions:
0

Re: How would I change default image from the small to the medium or large

I am sorry - very confusing and hard to explain. the small and medium images in my case are the same size. The medium image that displays on the product details page is a preview of the merged product which is fine, but I want either to send that medium image to the cart, or to change the image that displays everywhere else to be the medium image. Does that make sense?

23 Apr 2014, 3:56 PM
#6
l0st1 avatar

l0st1

New Zenner

Join Date:
Mar 2012
Posts:
11
Plugin Contributions:
0

Re: How would I change default image from the small to the medium or large

Think I got it by editing the modules/product_listing.php as follows. Still checking to see that it does not break anything else. Seems to work. suppose I will have to reapeat other places as well

            $lc_text = '<a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . 'medium/' . $listing->fields['products_image'], $listing->fields['products_name'], IMAGE_PRODUCT_LISTING_WIDTH, IMAGE_PRODUCT_LISTING_HEIGHT, 'class="box_image"') . '</a>';
          }
        }
24 Apr 2014, 2:03 AM
#7
l0st1 avatar

l0st1

New Zenner

Join Date:
Mar 2012
Posts:
11
Plugin Contributions:
0

Re: How would I change default image from the small to the medium or large

EEEEEEEK ! whatever I did, don't do it. I broke the template. :-( can't get past 3 products in a category and all of the images go away. renamed, retried 100 times, deleted categories, retried with different names, Not sure what happened. It seemed to work great until I tried to populate the products. Ugh.

Don't do what I did, maybe Dr. Byte should delete this?

24 Apr 2014, 3:17 PM
#8
drbyte avatar

drbyte

Sensei

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

Re: How would I change default image from the small to the medium or large

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

25 Apr 2014, 2:11 AM
#9
l0st1 avatar

l0st1

New Zenner

Join Date:
Mar 2012
Posts:
11
Plugin Contributions:
0

Re: How would I change default image from the small to the medium or large

lol, well not 'til later.
It worked I think until I uploaded an image this am to test ih- oops forgot and left it like that- I think that it worked becuase I had emptied the _MED directory setting in the back end to see what would happen, so it worked because it was having an error and displaying the LRG image instead...I think. Actually it worked just the way I wanted except for the file sizes and duplicated folders I encountered. I didn't intend to upload with it like that.
I am trying to duplicate a site for a friend that creates a product with a on-the-fly pasted on image from a choice of a few hundred photos. It then sends this picture to the owner who creates and ships it. I can't do such a thing. It's way beyond even playing with. I can not figure out how to get the photo that is to be selected as the main photo, but have the email send the "merged" image. I am just playing with it, though - not live and won't be if I can't figure out how to go about that. I think I have to maybe make an extra database table, but was trying to get around it. It just seems like such a simple thing and sometimes I start off in the wrong direction and can't get straightened out. Thanks.