Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2007
    Posts
    32
    Plugin Contributions
    0

    Default Can I use image for category link?

    Hi, Does anyone know if I can use an image for a category link, instead of text?
    I have 2 categories that I want to stand out from the rest of the categories, by using an image for the links.
    Thank you, Karole

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: Can I use image for category link?

    If you look at the file in includes/templates/template_default/sideboxes/tpl_categories.php you will find this entry that basically explains this - and when there is a class defined for it you can apply a background image to it in the stylesheet
    Code:
    // to make a specific category stand out define a new class in the stylesheet example: A.category-holiday
    // uncomment the select below and set the cPath=3 to the cPath= your_categories_id
    // many variations of this can be done
    Zen-Venom Get Bitten

  3. #3
    Join Date
    Feb 2007
    Posts
    32
    Plugin Contributions
    0

    Default Re: Can I use image for category link?

    I don't understand how to do that. I tried and failed. I found the solution below, in an old thread. It works, but it puts the same image by all the subcategory names. It looks really strange because of all the repeated images. Does anyone have any ideas how to adjust anything to make it show the image only by the top category name?
    Thank you, Karole

    includes/templates/MY_TEMPLATE/sideboxes/tpl_categories.php
    (Uses Template Override System. You may need to open the same file from the template_default folder and resave in your custom template folder.)

    Find (near line 34):
    [FONT=Courier New]$content .= '<a class="' . $new_style . '" href="' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">';

    [/FONT]
    After that, add:
    [FONT=Courier New]// for adding image beside category name[/FONT]

    [FONT=Courier New]// categories_image [/FONT]
    [FONT=Courier New]$categorySelect = str_replace('cPath=','',$box_categories_array[$i]['path']);[/FONT]
    [FONT=Courier New]$categories_image = zen_get_categories_image($categorySelect);[/FONT]
    [FONT=Courier New]$myCategoryImage = zen_image(DIR_WS_IMAGES . $categories_image, '', '50', '75');[/FONT]
    [FONT=Courier New]// categories_image[/FONT]

    [FONT=Courier New]$content .= $myCategoryImage;[/FONT]

    [FONT=Courier New]// end adding image code

    [/FONT]
    **Notice the '50'. You can replace this with your number of choice to set the width of the sidebox category image. And/Or put a number in place of the '75' to set the height of the sidebox category image. Or set either to '' and the images orginal sizes will be used. You can also set one to a number and the other to '' if you just need to set one dimension and you want the image dimensions kept in tact.

 

 

Similar Threads

  1. v139h Attribute image swatches - can I use the same image file for all?
    By jgold723 in forum General Questions
    Replies: 0
    Last Post: 16 Sep 2013, 09:46 PM
  2. Use image files for sidebox category items?
    By Bobo_Brazil in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 4 Mar 2010, 05:41 AM
  3. Ez Page Links (sidebox) - Is there a way to use an image for the link?
    By sfklaas in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 2 Dec 2009, 05:05 AM
  4. Can I use a background image for entire pages?
    By bluealice in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 25 Jan 2007, 10:56 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