Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2006
    Posts
    24
    Plugin Contributions
    0

    Default replace product name text with images - possible??

    Since the product names are used to populate the breadcrumbs, header and sideboxes I have a feeling the short answer is 'no'. But I was just wondering if anyone has developed a way to insert images for the product and page titles.

    I had thought that maybe I could set the text in the css to be the same as my background color (so it would appear invisible) but then not sure how I would go ahead and insert my image url's.

    Any advice or thoughts would be appreciated. I may just turn this into a pet project. Would be great if the admin area let you specify an image that would override title text.

  2. #2
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: replace product name text with images - possible??

    That functionality is not built-in, but you could customize your templates to produce it.

    Since you didn't talk about which pages you wanted this for, it's hard to give you any specifics.

    However, here's a start, assuming you're talking about the product-info page.

    (remember, this affects content which normally appears inside H1 tags, which are important for SEO benefits ... so, you may want to rethink things slightly ... food for thought)

    If you look at your tpl_product_info_display.php template file, you'll see a section that looks like this:
    Code:
    <!--bof Product Name-->
    <h1 id="productName" class="productGeneral"><?php echo $products_name; ?></h1>
    <!--eof Product Name-->
    Note the reference to $products_name

    Normally the $products_name variable is set to be the product name contained in the database.

    To override what normally appears in place of $products_name, go to:
    /includes/modules/pages/product_info/main_template_vars_product_type.php

    If you add code, as shown below, to this file, you'll be able to use the product image setting to locate a matching image for the product name instead:
    Code:
    // Nothing special to do here for primary product_info type
    replaced by:
    Code:
      $title_image_suffix = '_TITLE';
      if ($products_image != PRODUCTS_IMAGE_NO_IMAGE && $products_image != '') {
        $products_image_extension = substr($products_image, strrpos($products_image, '.'));
        $products_image_base = str_replace($products_image_extension, '', $products_image);
        $new_title_image = $products_image_base . $title_image_suffix . $products_image_extension;
    		if (file_exists($new_title_image)) $products_name = zen_image($new_title_image);
    	}
    Using this, if you have /images/t44yellow.jpg as your primary product image, then you can create another file called /images/t44yellow_TITLE.jpg (yes, literal _TITLE) for the title to display instead of the name.

    If you don't like _TITLE, then choose another suffix and enter it in the code above, and name your images accordingly.
    .

    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.

  3. #3
    Join Date
    Sep 2006
    Posts
    24
    Plugin Contributions
    0

    Default Re: replace product name text with images - possible??

    Ah Ha! I had a feeling that someone would already have it covered. And in a much better way than I would have been able to figure out. I will give it a try!

    I am curious t oknow wbout SEO benefits, though, it is a term I am not familiar with. Looks like I have some homework - thanks again for the advice.

    Matt

  4. #4
    Join Date
    Sep 2006
    Posts
    24
    Plugin Contributions
    0

    Default Re: replace product name text with images - possible??

    One thing that I just thought of - this code may not work for User Defined Pages and EZ Pages - they do not have photos set up in the same way that products do. Any advice there? I am wondering if I could somehow have images that correspond to the title and then override the title if present? Let me know if you have any ideas...

  5. #5
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: replace product name text with images - possible??

    You have H1 tags in all your templates. You'll have to replace all those with an image instead.

    Again, search engines will not find the data for the all-important H1 tag if you don't have any text in it. Thus your search-engine-rankings may suffer as a result.
    .

    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. How to replace sidebox text headers with images?
    By SimplyDelightful in forum Addon Sideboxes
    Replies: 1
    Last Post: 7 Nov 2009, 02:17 AM
  2. Replace product images with swf
    By mdc in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 16 Aug 2007, 06:55 PM
  3. How to replace category/product name with image?
    By Rotkale in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 19 Dec 2006, 03:59 PM
  4. How do I replace SOLD OUT Images with text?
    By DavidRambo in forum Basic Configuration
    Replies: 6
    Last Post: 24 Jul 2006, 04:49 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