Results 1 to 9 of 9
  1. #1
    Join Date
    Sep 2008
    Location
    Cleethorpes
    Posts
    1,106
    Plugin Contributions
    5

    red flag Alt text in attributes images

    Does anybody know how I can get alt text into my attributes images please?

    Currently they output like this:

    HTML Code:
    <img src="images/attributes/single-block.png" alt="" width="270" height="41">
    As you can see the alt text is missing.
    Nick Smith - Venture Design and Print
    https://venturedesignandprint.co.uk

  2. #2
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    8,214
    Plugin Contributions
    111

    Default Re: Alt text in attributes images

    Admin > Configuration > Product Info - Show Option Values Name Below Attributes Image
    https://docs.zen-cart.com/user/admin...tributes_image
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  3. #3
    Join Date
    Sep 2008
    Location
    Cleethorpes
    Posts
    1,106
    Plugin Contributions
    5

    red flag Re: Alt text in attributes images

    Quote Originally Posted by swguy View Post
    Admin > Configuration > Product Info - Show Option Values Name Below Attributes Image
    https://docs.zen-cart.com/user/admin...tributes_image
    That is already set to '1'

    It doesn't apply it to the ALT TAG
    Nick Smith - Venture Design and Print
    https://venturedesignandprint.co.uk

  4. #4
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    8,214
    Plugin Contributions
    111

    Default Re: Alt text in attributes images

    Ah you're right. OK. Take includes/modules/attributes.php and copy to includes/modules/YOUR_TEMPLATE/attributes.php.
    Then go through that file. Everywhere you see the config flag I mentioned PRODUCT_IMAGES_ATTRIBUTES_NAMES
    right before that you will see a call to zen_image. It's in 6 places.

    Change those zen_image calls so that the second parameter to zen_image is $products_options->fields['products_options_values_name']
    (this is the value which is shown when PRODUCT_IMAGES_ATTRIBUTES_NAMES = 1).
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  5. #5
    Join Date
    Sep 2008
    Location
    Cleethorpes
    Posts
    1,106
    Plugin Contributions
    5

    red flag Re: Alt text in attributes images

    Quote Originally Posted by swguy View Post
    Ah you're right. OK. Take includes/modules/attributes.php and copy to includes/modules/YOUR_TEMPLATE/attributes.php.
    Then go through that file. Everywhere you see the config flag I mentioned PRODUCT_IMAGES_ATTRIBUTES_NAMES
    right before that you will see a call to zen_image. It's in 6 places.

    Change those zen_image calls so that the second parameter to zen_image is $products_options->fields['products_options_values_name']
    (this is the value which is shown when PRODUCT_IMAGES_ATTRIBUTES_NAMES = 1).
    Sorry if I am misunderstanding here.
    PHP Code:
    $products_options->fields['products_options_values_name'
    already exists. So where would I change it in the below?

    PHP Code:
    if (!empty($products_options->fields['attributes_image'])) {                        $tmp_attributes_image .= '<div class="custom-control custom-checkbox attribImg">' zen_draw_checkbox_field('id[' $products_options_id ']['.$products_options_value_id.']'$products_options_value_id$selected_attribute'id="' $inputFieldId '" ' $data_properties $field_disabled) . '<br>' zen_image(DIR_WS_IMAGES $products_options->fields['attributes_image']) . '<label class="custom-control-label attribsCheckbox" for="' $inputFieldId '">' . (PRODUCT_IMAGES_ATTRIBUTES_NAMES == '1' '<br>' $products_options->fields['products_options_values_name'] : '') . (!empty($products_options_details_noname) ? '<br>' $products_options_details_noname '') . '</label></div>' "\n";                    } else {                        $tmp_attributes_image .= '<div class="custom-control custom-checkbox attribImg">' zen_draw_checkbox_field('id[' $products_options_id ']['.$products_options_value_id.']'$products_options_value_id$selected_attribute'id="' $inputFieldId '" ' $data_properties $field_disabled) . '<br />' '<label class="custom-control-label attribsCheckbox" for="' $inputFieldId '">' $products_options->fields['products_options_values_name'] . (!empty($products_options_details_noname) ? '<br>' $products_options_details_noname '') . '</label></div>' "\n";                    }                    break; 
    Nick Smith - Venture Design and Print
    https://venturedesignandprint.co.uk

  6. #6
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    8,214
    Plugin Contributions
    111

    Default Re: Alt text in attributes images

    Change

    zen_image(DIR_WS_IMAGES . $products_options->fields['attributes_image'])

    to

    zen_image(DIR_WS_IMAGES . $products_options->fields['attributes_image'], $products_options->fields['products_options_values_name'])

    in each place it's next to the check of PRODUCT_IMAGES_ATTRIBUTES_NAMES (because that's where the attributes image is shown).
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  7. #7
    Join Date
    Sep 2008
    Location
    Cleethorpes
    Posts
    1,106
    Plugin Contributions
    5

    Default Re: Alt text in attributes images

    Quote Originally Posted by swguy View Post
    Change

    zen_image(DIR_WS_IMAGES . $products_options->fields['attributes_image'])

    to

    zen_image(DIR_WS_IMAGES . $products_options->fields['attributes_image'], $products_options->fields['products_options_values_name'])

    in each place it's next to the check of PRODUCT_IMAGES_ATTRIBUTES_NAMES (because that's where the attributes image is shown).
    Brilliant, thank you!

    I thought that was what you meant but wasn't sure which is why I came back to you.

    That worked. Now I don't have missing ALT TAGS on my product pages :-)
    Nick Smith - Venture Design and Print
    https://venturedesignandprint.co.uk

  8. #8
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    8,214
    Plugin Contributions
    111

    Default Re: Alt text in attributes images

    If you know how to submit a PR, this would be a good fix to add to 1.5.8.
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  9. #9
    Join Date
    Sep 2008
    Location
    Cleethorpes
    Posts
    1,106
    Plugin Contributions
    5

    red flag Re: Alt text in attributes images

    Quote Originally Posted by swguy View Post
    If you know how to submit a PR, this would be a good fix to add to 1.5.8.
    Even better if the attributes images could also have an alt text box in the admin when images are uploaded to attributes. This could be useful for SEO purposes as they could then contain keywords that are relative to the product. Obviously without Keyword Stuffing.

    Where would I do that then?
    Nick Smith - Venture Design and Print
    https://venturedesignandprint.co.uk

 

 

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. Change the alt text for images?
    By maxy007 in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 25 Jan 2011, 09:38 PM
  4. How to Add Alt Text to Images in a Sidebox?
    By ScriptJunkie in forum General Questions
    Replies: 8
    Last Post: 12 Sep 2008, 06:09 AM
  5. Alt text on product images
    By kiddykool1 in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 10 Jul 2008, 03:21 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