Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2008
    Posts
    85
    Plugin Contributions
    0

    Default How to Link to External Images for Products - Solved

    Hello There,

    I had a post a while ago that I was trying to display images hosted on another server and I figured out how, but it was after 5am and need to get some sleep, but I'm back to explain.

    You edit the tpl_modules_main_product_image file which is located in /includes/templates/template_default/templates (after editing the file it is good practice to put the edited file in your custom template folder)

    The file stock looks like this (after the credits)

    PHP Code:
    <?php require(DIR_WS_MODULES zen_get_module_directory(FILENAME_MAIN_PRODUCT_IMAGE)); ?> 
    <div id="productMainImage" class="centeredContent back">
    <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_mediumaddslashes($products_name), MEDIUM_IMAGE_WIDTHMEDIUM_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_nameMEDIUM_IMAGE_WIDTHMEDIUM_IMAGE_HEIGHT) . '<br /><span class="imgLink">' TEXT_CLICK_TO_ENLARGE '</span></a>';
    ?>
    </noscript>
    </div>
    modified to grab pictures from an external source it looks like this:

    PHP Code:
    <div id="productMainImage" class="centeredContent back">
    <?php
      
    echo '<img src="http://content.com/images/'.$products_model.'.jpg">';
    ?>
    <script language="javascript" type="text/javascript"><!--
    document.write('<?php echo '<a href="http://content.com/images/'.$products_model.'.jpg" target="_blank">' zen_image($products_image_mediumaddslashes($products_name), MEDIUM_IMAGE_WIDTHMEDIUM_IMAGE_HEIGHT) . '<br /><span class="imgLink">' TEXT_CLICK_TO_ENLARGE '</span></a>'?>');
    //--></script>
    <noscript>
    <?php
      
    echo '<a href="http://content.com/images/'.$products_model.'.jpg" target="_blank">' zen_image($products_image_medium$products_nameMEDIUM_IMAGE_WIDTHMEDIUM_IMAGE_HEIGHT) . '<br /><span class="imgLink">' TEXT_CLICK_TO_ENLARGE '</span></a>';
    ?>
    </noscript>
    </div>
    As you can see, the file name is dynamically filled in by the model number, which can be the part number or whatever, also I could have taken out more code, but it works so I left it in.
    If you have any questions, please let me know.

    thank you,
    Steve

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: How to Link to External Images for Products - Solved

    stevenlee,

    Only will work if the donor systems' DB is structured with ".$products_model"
    in their DB table definitions
    Zen-Venom Get Bitten

  3. #3
    Join Date
    Jan 2004
    Posts
    66,380
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: How to Link to External Images for Products - Solved

    ... and means that you have to already have all images properly sized, since you won't be able to use any of Zen Cart's built-in image-size-protection features.
    .

    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.

 

 

Similar Threads

  1. v150 External link to images get Error 404 page no found
    By DArnaez in forum General Questions
    Replies: 17
    Last Post: 4 Jun 2013, 04:02 PM
  2. Products Webpage external link error
    By Two Wheel Trekkers in forum Setting Up Categories, Products, Attributes
    Replies: 12
    Last Post: 22 Mar 2011, 08:52 AM
  3. Displaying External Images for products
    By dmbaa in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 7 Jul 2009, 04:05 AM
  4. External Link within Products Description
    By gabstero in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 22 Jan 2008, 03:36 AM

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