Results 1 to 9 of 9

Hybrid View

  1. #1
    Join Date
    Mar 2012
    Posts
    11
    Plugin Contributions
    0

    Default 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.

    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.

  2. #2
    Join Date
    Mar 2012
    Posts
    11
    Plugin Contributions
    0

    Default 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
    Code:
    <?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
    
    ?>

  3. #3
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default 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.

  4. #4
    Join Date
    Mar 2012
    Posts
    11
    Plugin Contributions
    0

    Default 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.
    Code:
      </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" />

  5. #5
    Join Date
    Mar 2012
    Posts
    11
    Plugin Contributions
    0

    Default 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?

  6. #6
    Join Date
    Mar 2012
    Posts
    11
    Plugin Contributions
    0

    Default 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
    Code:
                $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>';
              }
            }

 

 

Similar Threads

  1. v151 Zen image preparation 3 (small, medium, large) images folder?
    By gsmsalers in forum General Questions
    Replies: 4
    Last Post: 4 Oct 2013, 05:01 PM
  2. Is there any way to set the medium image(_MED) as the default image of the product?
    By mybiz9999 in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 15 Aug 2010, 05:22 PM
  3. Replies: 1
    Last Post: 19 Oct 2007, 02:39 AM
  4. How to make the medium and large size share the same pic ?
    By OhISeekYou in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 3 Sep 2007, 06:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg