Results 1 to 10 of 11

Hybrid View

  1. #1
    Join Date
    Jan 2009
    Location
    Ipswich, Suffolk UK
    Posts
    6
    Plugin Contributions
    0

    Default Need to display different alt text for additional images on product info page

    We sell plants, often these have varieties, each of which has its own image with its own alt tag.

    What I am trying to achieve is the alt text for additional images to reflect their full correct and full file name as it does for the main image.

    On the product info page for a particular plant, Zen Cart displays the same alt txt as for the main image, which is confusing for customers.

    I have replaced:

    $products_name
    with
    str_replace(array($products_image_base,$products_image_extension),'',$file)

    as per thread 180191

    which gets me half way there:

    http://www.shrublandparknurseries.co...oducts_id=1224

    shows the problem - ideally I need the 2 images at the bottom to show:

    Justicia carnea & Justicia carnea 'Alba' respectively.


    I also need the same solution for the pop up images for these additional images.

    Any help would be much appreciated. My knowledge of php is very basic!

  2. #2
    Join Date
    Aug 2009
    Location
    Bedford, England
    Posts
    966
    Plugin Contributions
    0

    Default Re: Need to display correct alt text for additional images on product info page

    Quote Originally Posted by GillS View Post
    We sell plants, often these have varieties, each of which has its own image with its own alt tag.

    What I am trying to achieve is the alt text for additional images to reflect their full correct and full file name as it does for the main image.

    On the product info page for a particular plant, Zen Cart displays the same alt txt as for the main image, which is confusing for customers.

    I have replaced:

    $products_name
    with
    str_replace(array($products_image_base,$products_image_extension),'',$file)

    as per thread 180191

    which gets me half way there:

    http://www.shrublandparknurseries.co...oducts_id=1224

    shows the problem - ideally I need the 2 images at the bottom to show:

    Justicia carnea & Justicia carnea 'Alba' respectively.


    I also need the same solution for the pop up images for these additional images.

    Any help would be much appreciated. My knowledge of php is very basic!
    I dont htink you will ever achive what you are trying to achive. simply becasue additional images are show based on files name.

    so you would have main image:
    Justicia carnea.jpg
    then additionals would be
    Justicia carnea_a.jpg
    Justicia carnea_b.jpg

    the only way you could have custom alt text is as per the method you are tring which is to use the text fom an image name, however as soon as you start renaming stuff and loose a file naming convetion whatever it may be you will loose the additional images..

    what is it so imporatant that your alt text is set in this way? what do you feel you will gain from this?
    Phil Rogers
    A problem shared is a problem solved.

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

    Default Re: Need to display correct alt text for additional images on product info page

    This is not possible with the current Additional Images system - which regards the additional images as supplementary (supportive) of the main image. Typically they are used to show a product from a different view / perspective (such as "front" and "back" of a garment).

    You may get a better result by looking at a cross-sell module, which will showcase the variant as a separate product, on the product info page in question.

    Scott Wilson (swguy) has written some cross-sell modules and a PM to him may suggest a way forward.
    19 years a Zencart User

  4. #4
    Join Date
    Jan 2009
    Location
    Ipswich, Suffolk UK
    Posts
    6
    Plugin Contributions
    0

    Default Re: Need to display correct alt text for additional images on product info page

    Thanks schoolboy, I see what you mean. I am (probably incorrectly) using additional images to display different products/plants rather than attributes of a single product. When I get some time I'll check out the cross-sell module.

  5. #5
    Join Date
    Jan 2009
    Location
    Ipswich, Suffolk UK
    Posts
    6
    Plugin Contributions
    0

    Default Re: Need to display correct alt text for additional images on product info page

    Thankyou Phil - even "Justicia carnea_a.jpg" would do, perhaps you could point me in the right direction for doing this? I'd like it to be more obvious to the prospective customer to see that there are different varieties of the same plant, in most cases different flowers colours. I think this is more important to them, than it is to me. Just a thought - on our home page the featured plants (products) at the bottom have the correct alt text, that's what put me in mind for doing the same on the prod info page.

  6. #6
    Join Date
    Aug 2009
    Location
    Bedford, England
    Posts
    966
    Plugin Contributions
    0

    Default Re: Need to display correct alt text for additional images on product info page

    Quote Originally Posted by GillS View Post
    Thankyou Phil - even "Justicia carnea_a.jpg" would do, perhaps you could point me in the right direction for doing this? I'd like it to be more obvious to the prospective customer to see that there are different varieties of the same plant, in most cases different flowers colours. I think this is more important to them, than it is to me. Just a thought - on our home page the featured plants (products) at the bottom have the correct alt text, that's what put me in mind for doing the same on the prod info page.
    you could just use the filename and use string replace to remove the .jpg ?

    but as schoolboy has pointed out, additinal images are intended as additional views of the same item generally, but I guess if you are selling different variations using attributes that could work too. I am assuming this is what you are trying to do? trying to match the image to an attribute option?

    if so, it would probbaly be better to as well as using alt text maybe output some text under the image aswell.

    so for your alt you probably want to do something like:

    PHP Code:
    $products_name str_replace(".jpg","",$file);

    $script_link '<script language="javascript" type="text/javascript"><!--' "\n" 'document.write(\'' . ($flag_display_large '<a href="javascript:popupWindow(\\\'' str_replace($products_image_largeurlencode(addslashes($products_image_large)), $large_link) . '\\\')">' $thumb_slashes '<br />' TEXT_CLICK_TO_ENLARGE '<br />' $products_name '</a>' $thumb_slashes) . '\');' "\n" '//--></script>';

        
    $noscript_link '<noscript>' . ($flag_display_large '<a href="' zen_href_link(FILENAME_POPUP_IMAGE_ADDITIONAL'pID=' $_GET['products_id'] . '&pic=' $i '&products_image_large_additional=' $products_image_large) . '" target="_blank">' $thumb_regular '<br /><span class="imgLinkAdditional">' TEXT_CLICK_TO_ENLARGE '</span><br />' $products_name '</a>' $thumb_regular ) . '</noscript>'
    not tested.. backup before you try this..
    Phil Rogers
    A problem shared is a problem solved.

  7. #7
    Join Date
    Aug 2009
    Location
    Bedford, England
    Posts
    966
    Plugin Contributions
    0

    Default Re: Need to display correct alt text for additional images on product info page

    alternativly, never used it before but pretty sure you can assign images to attributes and display them? maybe someone else that has done that before can advise you on that one..
    Phil Rogers
    A problem shared is a problem solved.

  8. #8
    Join Date
    Jan 2009
    Location
    Ipswich, Suffolk UK
    Posts
    6
    Plugin Contributions
    0

    Default Re: Need to display correct alt text for additional images on product info page

    As per my reply to schoolboy, I'm using the additional images to display different plants/products rather then attributes of one product. These plants are separate entities, just biologically related.

    I'll try the code - in which file and where do I put the code? I will back up first!

  9. #9
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,262
    Plugin Contributions
    3

    Default Re: Need to display correct alt text for additional images on product info page

    I don't think the "alt" tag is populated within attribute image swatches - so it is not a viable alternative.

    I still think the best way to go is a cross-sell module. Mainly because it is good for business. You can showcase related products against each other and either up-sell the customer, or point them to the second / third / fourth variant.

    As Cross-sell uses product data, it will create an appropriate ALT tag for its image.
    19 years a Zencart User

 

 

Similar Threads

  1. Replies: 2
    Last Post: 3 Sep 2013, 10:19 PM
  2. Alt text for product images
    By Kyra in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 4 Feb 2011, 01:44 AM
  3. Error in product info display additional images
    By ilmarchez in forum Templates, Stylesheets, Page Layout
    Replies: 9
    Last Post: 17 Dec 2010, 12:49 AM
  4. Different product info display page for each category
    By pjb923 in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 17 Sep 2008, 07:33 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

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