Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2012
    Posts
    106
    Plugin Contributions
    0

    Default If no product image, display default image

    Is there a way to display a default image if there is no image added for that product instead of listing the product name?

    Thanks,

    Clint

  2. #2
    Join Date
    Oct 2011
    Location
    AZ
    Posts
    384
    Plugin Contributions
    0

    Default Re: If no product image, display default image

    The default is to show "No Picture Available" which is actually an image itself - no_picture.gif in the /images folder. So if you replaced that with an image of your choice it would show up any place the image doesn't exist.

  3. #3
    Join Date
    Aug 2012
    Posts
    106
    Plugin Contributions
    0

    Default Re: If no product image, display default image

    Thanks. What about for products that have an image file included but can't find the file? Such as file misnamed?

    Thanks,

    Clint

  4. #4
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: If no product image, display default image

    Quote Originally Posted by clint6998 View Post
    if there is no image added for that product instead of listing the product name?
    Um ... that "listing the product name" is coming from the browser: when an image doesn't load, some browsers simply display the ALT text in the image's place.

    Plus, you can't have a misnamed image when you upload your images via the Zen Cart admin console, because it stores exactly the image you upload.
    .

    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.

  5. #5
    Join Date
    Mar 2007
    Posts
    249
    Plugin Contributions
    6

    Default Re: If no product image, display default image

    Quote Originally Posted by joejoejoe View Post
    Thanks. What about for products that have an image file included but can't find the file? Such as file misnamed?
    I just needed something simliar, just wanted cart to show the no_picture image if a mispelt image name occured, or image was deleted off server etc by accident, so made changes as follows:

    copy across main_product_image.php from includes/modules/ to your includes/modules/YOUR_TEMPLATE_NAME

    then find

    Code:
    if (!defined('IS_ADMIN_FLAG')) {
      die('Illegal Access');
    }
    and underneath put
    Code:
    if (!file_exists(DIR_WS_IMAGES . $products_image)) {
    $products_image ="no_picture.gif";
    }
    then copy across product_listing.php from includes/modules/ to your includes/modules/YOUR_TEMPLATE_NAME

    then find:
    Code:
     
    if ($listing->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) {
              $lc_text = '';
            } else {
    and underneath add

    Code:
    if (!file_exists(DIR_WS_IMAGES . $listing->fields['products_image'])) {
    $products_listing_image = DIR_WS_IMAGES . "no_picture.gif";
    }
    else
    {
    $products_listing_image = DIR_WS_IMAGES . $listing->fields['products_image'];
    }
    then just below that you will find two occurances of code

    Code:
    'products_id=' . $listing->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $listing->fields['products_image'], $listing->fields['products_name'], IMAGE_PRODUCT_LISTING_WIDTH,
    to change to

    Code:
    'products_id=' . $listing->fields['products_id']) . '">' . zen_image($products_listing_image, $listing->fields['products_name'], IMAGE_PRODUCT_LISTING_WIDTH,

    thats it.

 

 

Similar Threads

  1. Image Handler: Can not get image to display on product info page
    By weezee in forum Setting Up Categories, Products, Attributes
    Replies: 8
    Last Post: 24 Oct 2010, 04:31 AM
  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. MED image takes place of default image
    By TecBrat in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 26 May 2009, 05:20 PM
  4. Can I display a default product image if no image available?
    By bearaman in forum Templates, Stylesheets, Page Layout
    Replies: 7
    Last Post: 9 Feb 2009, 03:26 PM
  5. making product detail display small image and have image handler rollover come up
    By bgingras in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 13 Apr 2008, 11:24 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR