Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Jun 2009
    Location
    Australia
    Posts
    20
    Plugin Contributions
    0

    help question How to add an id tag to Main Product Image?

    Hi all,

    I'm using Zen Cart 1.3.8a.

    This seems like an easy tweak, but I've been going around in circles for hours just trying to find where the HTML string is formed.

    I'm trying to add an ID tag to the main product image displayed on a product page. I can't figure out/find where the code is being parsed to resultant HTML.


    The file templates\My custom\templates\tpl_modules_main_product_image.php contains the code;

    [FONT="Courier New"]<?php echo zen_image($products_image_medium, $products_name, MEDIUM_IMAGE_WIDTH, MEDIUM_IMAGE_HEIGHT);?>[/FONT]


    which outputs the HTML

    [FONT="Courier New"]<img src="images/range/CC596.jpg" alt="Slip" title="Slip" width="250" height="341" />[/FONT]


    I'd like my HTML to include an ID tag as follows;

    [FONT="Courier New"]<img src="images/range/CC596.jpg" alt="Slip" title="Slip" width="250" height="341 ID='PIC' />[/FONT]


    Where can I find the code which builds/parses this resultant HTML?

    Hope this makes sense. Any help is appreciated.

    Thanks in advance.

    Regards
    erko

  2. #2
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: How to add an id tag to Main Product Image?

    Why do you believe you need an id for this image? It is the only image inside
    <div id="productMainImage" class="centeredContent back">
    so can be uniquely addressed in the stylesheet with

    #productMainImage img {what: ever;}

  3. #3
    Join Date
    Jun 2009
    Location
    Australia
    Posts
    20
    Plugin Contributions
    0

    Default Re: How to add an id tag to Main Product Image?

    Hi Glenn, thanks for the response..

    What I'm trying to do is a simple mouseover (on another link/image) to change the main product image..

    I.e. My code on the other link is as follows;

    [FONT="Courier New"]
    <img src="CC596_1.jpg" onmouseover="document.images['PIC'].src='CC596_1.jpg';" width="80" height="60" alt="Slip" />
    [/FONT]

    Basically I'm trying to tweak the original additional images code - to do a mouseover instead of a new popup.

    Any ideas?

    Eric

  4. #4
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,267
    Plugin Contributions
    3

    Default Re: How to add an id tag to Main Product Image?

    I believe there is an image swapper module that does this already. You can:

    1. just use that module
    2. look at the module's code to see if it has any pointers for your intended script.
    20 years a Zencart User

  5. #5
    Join Date
    Jun 2009
    Location
    Australia
    Posts
    20
    Plugin Contributions
    0

    Default Re: How to add an id tag to Main Product Image?

    Thanks Schoolboy...

    Yep I've seen the AJAX Image Swapper - http://www.zen-cart.com/index.php?ma...roducts_id=801.

    I only saw this after I had tinkered around with my code

    Just need to add a simple id='PIC'. Will scout around abit more and if no luck - I'll swallow my pride & effort and install the image swapper.

    Thanks again.

    Anyone?

    erko

  6. #6
    Join Date
    Jun 2009
    Location
    Australia
    Posts
    20
    Plugin Contributions
    0

    Default Re: How to add an id tag to Main Product Image?

    Thanks Glenn & Schoolboy for their comments.

    Managed to solve this bugger

    In the CUSTOM\templates\tpl_modules_main_product_image.php file, added the parameter (in bold) from

    [FONT="Courier New"]zen_image($products_image_medium, $products_name, MEDIUM_IMAGE_WIDTH, MEDIUM_IMAGE_HEIGHT);[/FONT]

    to

    [FONT="Courier New"]zen_image($products_image_medium, $products_name, MEDIUM_IMAGE_WIDTH, MEDIUM_IMAGE_HEIGHT, $idPic);[/FONT]

    And declared a new var as;

    [FONT="Courier New"]$idPic = 'id="Pic"'[/FONT]

    Coming from a non-technical background - not sure if this is the cleanest way of doing it, but it works..

 

 

Similar Threads

  1. v150 How do I swap main product image with an attribute image?
    By bazza_87 in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 1 May 2012, 08:30 AM
  2. Need to add code below </head> tag and above <body> tag in product page
    By Danielle in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 11 Apr 2010, 07:53 PM
  3. How to add image on main page?
    By sfklaas in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 28 Jun 2008, 02:40 PM
  4. how do i add an image to main page
    By saaliha in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 8 Jun 2008, 12:44 AM
  5. How to remove alt tag of additional image in product info page
    By opelben in forum Basic Configuration
    Replies: 1
    Last Post: 11 May 2006, 06:14 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