Results 1 to 7 of 7
  1. #1
    Join Date
    Sep 2008
    Location
    Cleethorpes
    Posts
    1,227
    Plugin Contributions
    6

    red flag Alt tags in category images

    Does anyone know how I would go about adding the category name into category images that have been uploaded through the admin?

    I know this has been asked before and I'm aware that it may not be critical for SEO but there are some situations where it would help.

    Currently my image code is like this:

    <img src="images/categories/my-category-name.png" alt="" width="680" height="304" />

    for the category image. Zen Cart does not seem to add an alt tag by default to category images.


    What I would like is:

    <img src="images/categories/my-category-name.png" alt="My Category Name" width="680" height="304" />

    There must be some way of doing this easily by adding the category name inside an alt tag in the code that generates <img src="images/categories/my-category-name.png" alt="" width="680" height="304" />

    Thanks

    Nick
    Nick Smith - Venture Design and Print
    https://venturedesignandprint.co.uk

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Alt tags in category images

    I am not sure what file you are in for that, but for the default code for Categories you can customize the file:
    /includes/templates/your_template_dir/tpl_index_categories.php

    with the code in RED:
    Code:
    // categories_image
      if ($categories_image = zen_get_categories_image($current_category_id)) {
        $cat_name = zen_get_category_name($current_category_id, (int)$_SESSION['languages_id']);
    ?>
    <div id="categoryImgListing" class="categoryImg"><?php echo zen_image(DIR_WS_IMAGES . $categories_image, $cat_name, SUBCATEGORY_IMAGE_TOP_WIDTH, SUBCATEGORY_IMAGE_TOP_HEIGHT); ?></div>
    <?php
    and the file:
    /includes/templates/your_template_dir/tpl_index_product_listing.php

    Code:
    // categories_image
        $cat_name = zen_get_category_name($current_category_id, (int)$_SESSION['languages_id']);
      if ($categories_image = zen_get_categories_image($current_category_id)) {
    ?>
    <div id="categoryImgListing" class="categoryImg"><?php echo zen_image(DIR_WS_IMAGES . $categories_image, $cat_name, CATEGORY_ICON_IMAGE_WIDTH, CATEGORY_ICON_IMAGE_HEIGHT); ?></div>
    <?php
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Sep 2008
    Location
    Cleethorpes
    Posts
    1,227
    Plugin Contributions
    6

    Default Re: Alt tags in category images

    THanks Linda will give this a go :-)
    Nick Smith - Venture Design and Print
    https://venturedesignandprint.co.uk

  4. #4
    Join Date
    Sep 2008
    Location
    Cleethorpes
    Posts
    1,227
    Plugin Contributions
    6

    Default Re: Alt tags in category images

    How would I go about adding title tags into the navMain links that appear usually at the top of a zen site? (Home, Log in, My Account etc)

    I've changed the name of the 'home' link to a search term. So 'Home' has become 'My Search Term' and I'd also like to put 'My Search Term' in the title tag of the 'Home' link.
    Nick Smith - Venture Design and Print
    https://venturedesignandprint.co.uk

  5. #5
    Join Date
    Apr 2017
    Location
    Netherlands
    Posts
    20
    Plugin Contributions
    0

    Default Re: Alt tags in category images

    Why is this solution for proper alt tages on categories names not incorporated in standard zen-cart release?
    Do you also have similar solution for manufacturers?

  6. #6
    Join Date
    Jul 2012
    Posts
    16,734
    Plugin Contributions
    17

    Default Re: Alt tags in category images

    Quote Originally Posted by bramf View Post
    Why is this solution for proper alt tages on categories names not incorporated in standard zen-cart release?
    Do you also have similar solution for manufacturers?
    Possibly because no one has submitted the code to the core team for incorporation. Such discussion and action can occur at https://github.com/zencart/zencart. Additionally, no response was provided that the suggestion was a success. Further, not sure why an image is being presented that doesn't have an alt tag. I don't mean technically (the code), but why it was not considered necessary to include or why if there was a specific reason to not include the alt tag...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  7. #7
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,494
    Plugin Contributions
    88

    Default Re: Alt tags in category images

    @bramf, I don't know what Zen Cart version you're asking about, but certainly the most recent (Zen Cart 1.5.5a and later) includes those alt tags on category-listings; see my demo site for verification.

    If you're not seeing them on your site, check your current template for those omissions.

 

 

Similar Threads

  1. Missing alt tags on category images
    By BoydBreen in forum General Questions
    Replies: 8
    Last Post: 30 Sep 2014, 08:27 PM
  2. Alt tags for images
    By dustbowl in forum General Questions
    Replies: 1
    Last Post: 9 Aug 2012, 02:00 PM
  3. Keywords in Alt tags for Sub Category images?
    By tparvaiz in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 14 Jul 2011, 10:23 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