Results 1 to 10 of 2267

Hybrid View

  1. #1
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Categories Dressing

    The file to edit will be /includes/modules/your_template/categories_tabs.php, as this is where the output is originally built.

    It shouldn't be too hard to adapt the Cat Dressing code to this. I'll look at it and get back.

  2. #2

    Default Re: Categories Dressing

    Free Call Stuff A Top Level Cat
    SubLevel 2 A
    SubLevel 2 B
    Sub Sub Cat 2B1
    Sub Sub Cat 2B2
    Sub Sub Cat 2B3
    SubLevel 2 C


    this mod is great! but when my zc have 3 sublevel Categories ,how hide 3 sub_categories :example Sub Sub Cat 2B1 etc...
    thanks.

  3. #3
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Categories Dressing

    You're saying you never want to show the links for level 3 or deeper subcats in the sidebox?

    You can do that by finding this in tpl_categories.php
    PHP Code:
        $current_path str_replace("cPath=","",$box_categories_array[$i]['path']);
        if (
    zen_get_product_types_to_category($box_categories_array[$i]['path']) == or ($box_categories_array[$i]['top'] != 'true' and SHOW_CATEGORIES_SUBCATEGORIES_ALWAYS != 1)) {
          
    // skip if this is for the document box (==3) 
        
    } else { 
    and adding
    (substr_count($current_path,'_') > 2) or
    to get
    PHP Code:
        $current_path str_replace("cPath=","",$box_categories_array[$i]['path']);
        if ((
    substr_count($current_path,'_') > 2) or zen_get_product_types_to_category($box_categories_array[$i]['path']) == or ($box_categories_array[$i]['top'] != 'true' and SHOW_CATEGORIES_SUBCATEGORIES_ALWAYS != 1)) {
          
    // skip if this is for the document box (==3) or deeper than level 2 subcat
        
    } else { 
    The number of underscores _ in $current_path equals the subcat level.

  4. #4
    Join Date
    Mar 2008
    Posts
    51
    Plugin Contributions
    0

    Default Re: Categories Dressing

    Hello, I just recently installed this contrib so that I can use image links in place of text category links, and for the hover image swaps.

    This contrib works perfectly for my needs except for one part, which I'm not sure of how to code. I would like the hover image to remain in it's hover state when browsing the corresponding category. And when the user clicks another category, the image reverts back to it's normal state.

    Any help is welcome and thanks for the great mod. The readme.txt is very in-depth.. as if the code wasn't self-explanetory enough

  5. #5
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Categories Dressing

    Zen Cart has a pair of classes for active categories, .category-subs-parent and .category-subs-selected, but they will only operate when the category displays as text. You can add the test for current category elsewhere and get a class you will be able to apply the hover bg image to.

    Add this code
    PHP Code:
        //mark current category
        
    if ($box_categories_array[$i]['current']) {
          
    $new_style .= '-current';
        }
        
    // /mark current category 
    as shown to get persistent hover on subcats as well as top cats
    PHP Code:
          case ($box_categories_array[$i]['top'] == 'true'):
            
    $new_style 'category-top';
            break;
          case (
    $box_categories_array[$i]['has_sub_cat']):
            
    $new_style 'category-subs';
            break;
          default:
            
    $new_style 'category-products';
        }
        
    //mark current category
        
    if ($box_categories_array[$i]['current']) {
          
    $new_style .= '-current';
        }
        
    // /mark current category
        
    $current_path str_replace("cPath=","",$box_categories_array[$i]['path']); 
    or as shown here to get persistent hover on top cats only
    PHP Code:
          case ($box_categories_array[$i]['top'] == 'true'):
            
    $new_style 'category-top';
            
    //mark current category
            
    if ($box_categories_array[$i]['current']) {
              
    $new_style .= '-current';
            }
            
    // /mark current category
            
    break;
          case (
    $box_categories_array[$i]['has_sub_cat']):
            
    $new_style 'category-subs';
            break;
          default:
            
    $new_style 'category-products';
        }
        
    $current_path str_replace("cPath=","",$box_categories_array[$i]['path']); 
    Add to your stylesheet for each category like this
    Code:
    a.catBg25:hover {
        background-image: url(../images/catbg25hover.gif);
        }
    a.category-top-current.catBg25 {
        background-image: url(../images/catbg25hover.gif);
        }
    Try this and let me know how it works.

  6. #6
    Join Date
    Mar 2008
    Posts
    51
    Plugin Contributions
    0

    Default Re: Categories Dressing

    Glenn,

    your code worked perfectly, and it all worked out the first try. Thank you!

    I mainly needed just the TOPCAT to remain hover, just like how the category text behaves.

  7. #7
    Join Date
    Jan 2008
    Posts
    89
    Plugin Contributions
    0

    Default Re: Categories Dressing

    Help Please: site: www.thepurseworld.com

    I am trying to add a dotted line between the categories,

    for some reason , the "Barbara Bui" Category becomes a white box, and the "Gucci" Becomes an image.

    Please see screenshot

    i am not sure what to comment out from the tpl_category
    here is mine:

    ==================
    <?php
    /**
    * Side Box Template
    *
    * @package templateSystem
    * @copyright Copyright 2003-2006 Zen Cart Development Team
    * @copyright Portions Copyright 2003 osCommerce
    * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
    * @version $Id: tpl_categories.php 4162 2006-08-17 03:55:02Z ajeh $
    * Modified for Categories Dressing v2.2 by Glenn Herbert (gjh42) 2008-02-25
    */
    //$disp_block = '';
    $disp_block = ''; //if not using display: block; in stylesheet, uncomment this line
    // $disp_block_head = '';
    //$disp_block_head = '<br />'; // for headings not block uncomment this line
    $content = "";

    $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">' . "\n";
    for ($i=0;$i<sizeof($box_categories_array);$i++) {
    switch(true) {
    // 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
    // case ($box_categories_array[$i]['path'] == 'cPath=3'):
    // $new_style = 'category-holiday';
    // break;
    // case ($box_categories_array[$i]['top'] == 'true'):
    // $new_style = 'category-top';
    // break;
    case ($box_categories_array[$i]['has_sub_cat']):
    $new_style = 'category-subs';
    break;
    default:
    $new_style = 'category-products';
    }
    $current_path = str_replace("cPath=","",$box_categories_array[$i]['path']);
    if (zen_get_product_types_to_category($box_categories_array[$i]['path']) == 3 or ($box_categories_array[$i]['top'] != 'true' and SHOW_CATEGORIES_SUBCATEGORIES_ALWAYS != 1)) {
    // skip if this is for the document box (==3)
    } else {
    // categories dressing - add divider above specified cats
    //9,25,27,62,31,35,60,43,37,29,11,1,3,39,33,41,81,69,5,7,15,17,19,13,45
    if(in_array($current_path, explode(",",''))) { //replace numbers with your cat ids separated by commas
    $content .= '<hr class="catBoxDivider" />';
    }
    // categories dressing - add (divider and) heading above a cat
    //switch ($current_path) {
    //case '': //replace number with your desired cPath
    // $content .= '<hr class="catBoxDivider" />' . "\n"; // to add divider uncomment this line
    // $content .= '<span class="catBoxHeading1">' . (file_exists(DIR_WS_TEMPLATE_IMAGES . 'cathead' . $current_path . '.gif') ? zen_image(DIR_WS_TEMPLATE_IMAGES . 'cathead' . $current_path . '.gif') . $disp_block_head) ;
    //break;
    //}
    // categories dressing - category name mods
    $cat_name_display = $box_categories_array[$i]['name'];
    $cat_name_display = $box_categories_array[$i]['name'];
    // $subcat_level = (substr_count($current_path, '_'); //strip out subcat indent
    // $cat_name_display = substr_replace($cat_name_display,'',0,($subcat_level*strlen(CATEGORIES_SUBCATEGO RIES_INDENT)));
    $cat_img_bg = '';
    // categories dressing - display image if exists for category name - with title tag
    if (file_exists(DIR_WS_TEMPLATE_IMAGES . 'catimg' . $current_path . '.gif')) {
    $cat_name_display = zen_image(DIR_WS_TEMPLATE_IMAGES . 'catimg' . $current_path . '.gif', '', '', '', 'title="' . $box_categories_array[$i]['name'] . '"');
    // categories dressing - display background image if exists for category name - with title tag
    } elseif (file_exists(DIR_WS_TEMPLATE_IMAGES . 'catbg' . $current_path . '.gif')) {
    $cat_name_display = zen_image(DIR_WS_TEMPLATE_IMAGES . 'pixel_trans.gif', '', '100%', '100%', 'title="' . $box_categories_array[$i]['name'] . '"');
    $cat_img_bg = ' catBg' . $current_path;
    } else {
    $cat_img_bg = '-text';//append to main classname
    }
    $content .= '<a class="' . $new_style . $cat_img_bg . '" href="' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">';
    if ($box_categories_array[$i]['current']) {
    if ($box_categories_array[$i]['has_sub_cat']) {
    $content .= '<span class="category-subs-parent">' . $cat_name_display . ($disp_block == '<br />'?'</span>':'');
    } else {
    $content .= '<span class="category-subs-selected">' . $cat_name_display . ($disp_block == '<br />'?'</span>':'');
    }
    } else {
    $content .= '<span class="category-not-selected">' . $cat_name_display . ($disp_block == '<br />'?'</span>':'');
    } // category name mods

    if ($box_categories_array[$i]['has_sub_cat']) {
    $content .= CATEGORIES_SEPARATOR;
    }
    $content .= ($disp_block == '<br />'?'</a>':''); // categories dressing - adjust link end

    if (SHOW_COUNTS == 'true') {
    if ((CATEGORIES_COUNT_ZERO == '1' and $box_categories_array[$i]['count'] == 0) or $box_categories_array[$i]['count'] >= 1) {
    $content .= CATEGORIES_COUNT_PREFIX . $box_categories_array[$i]['count'] . CATEGORIES_COUNT_SUFFIX;
    }
    }

    $content .= ($disp_block == ''?'</span></a>':'') . $disp_block . "\n"; // categories dressing - adjust link end

    // categories dressing - add subtext below a cat
    // switch ($current_path) {
    // case '23': //replace number with your desired cPath
    // $content .= '<span class="catBoxSubtext">Subtext for cat 23 escape apostrophe\'s</span>' . $disp_block . "\n";
    // break;
    // } // subtext
    }
    }

    if (SHOW_CATEGORIES_BOX_SPECIALS == 'true' or SHOW_CATEGORIES_BOX_PRODUCTS_NEW == 'true' or SHOW_CATEGORIES_BOX_FEATURED_PRODUCTS == 'true' or SHOW_CATEGORIES_BOX_PRODUCTS_ALL == 'true') {
    // display a separator between categories and links
    if (SHOW_CATEGORIES_SEPARATOR_LINK == '1') {
    $content .= '<hr id="catBoxDivider" />' . "\n";
    }
    if (SHOW_CATEGORIES_BOX_SPECIALS == 'true') {
    //$content .= '<span class="catBoxHeading1">' . (file_exists(DIR_WS_TEMPLATE_IMAGES . 'cathead-specials.gif') ? zen_image(DIR_WS_TEMPLATE_IMAGES . 'cathead-specials.gif') . '</span>':'Link Heading</span>' . $disp_block_head) . "\n";// categories dressing - uncomment this line for heading above link
    $show_this = $db->Execute("select s.products_id from " . TABLE_SPECIALS . " s where s.status= 1 limit 1");
    if ($show_this->RecordCount() > 0) {
    $content .= '<a class="category-links" href="' . zen_href_link(FILENAME_SPECIALS) . '">' . CATEGORIES_BOX_HEADING_SPECIALS . '</a>' . $disp_block . "\n";
    }
    }
    if (SHOW_CATEGORIES_BOX_PRODUCTS_NEW == 'true') {
    // display limits
    // $display_limit = zen_get_products_new_timelimit();
    $display_limit = zen_get_new_date_range();

    $show_this = $db->Execute("select p.products_id
    from " . TABLE_PRODUCTS . " p
    where p.products_status = 1 " . $display_limit . " limit 1");
    if ($show_this->RecordCount() > 0) {
    //$content .= '<span class="catBoxHeading1">' . (file_exists(DIR_WS_TEMPLATE_IMAGES . 'cathead-new.gif') ? zen_image(DIR_WS_TEMPLATE_IMAGES . 'cathead-new.gif') . '</span>':'Link Heading</span>' . $disp_block_head) . "\n";// categories dressing - uncomment this line for heading above link
    $content .= '<a class="category-links" href="' . zen_href_link(FILENAME_PRODUCTS_NEW) . '">' . CATEGORIES_BOX_HEADING_WHATS_NEW . '</a>' . $disp_block . "\n";
    }
    }
    if (SHOW_CATEGORIES_BOX_FEATURED_PRODUCTS == 'true') {
    $show_this = $db->Execute("select products_id from " . TABLE_FEATURED . " where status= 1 limit 1");
    if ($show_this->RecordCount() > 0) {
    //$content .= '<span class="catBoxHeading1">' . (file_exists(DIR_WS_TEMPLATE_IMAGES . 'cathead-featured.gif') ? zen_image(DIR_WS_TEMPLATE_IMAGES . 'cathead-featured.gif') . '</span>':'Link Heading</span>' . $disp_block_head) . "\n";// categories dressing - uncomment this line for heading above link
    $content .= '<a class="category-links" href="' . zen_href_link(FILENAME_FEATURED_PRODUCTS) . '">' . CATEGORIES_BOX_HEADING_FEATURED_PRODUCTS . '</a>' . $disp_block . "\n";
    }
    }
    if (SHOW_CATEGORIES_BOX_PRODUCTS_ALL == 'true') {
    $content .= '<span class="catBoxHeading1">' . (file_exists(DIR_WS_TEMPLATE_IMAGES . 'cathead-all.gif') ? zen_image(DIR_WS_TEMPLATE_IMAGES . 'cathead-all.gif') . '</span>':'Link Heading</span>' . $disp_block_head) . "\n";// categories dressing - uncomment this line for heading above link
    $content .= '<a class="category-links" href="' . zen_href_link(FILENAME_PRODUCTS_ALL) . '">' . CATEGORIES_BOX_HEADING_PRODUCTS_ALL . '</a>' . "\n";
    }
    }
    $content .= '</div>';
    ?>
    ==================
    Attached Images Attached Images  

 

 

Similar Threads

  1. categories dressing
    By fw541c in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 19 Nov 2010, 09:29 PM
  2. Categories Dressing
    By wotnow in forum Addon Sideboxes
    Replies: 10
    Last Post: 7 Apr 2010, 03:06 AM
  3. Categories Dressing issue
    By Maynards in forum Addon Sideboxes
    Replies: 0
    Last Post: 13 Mar 2010, 10:51 PM
  4. Categories Dressing
    By Maynards in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 12 Mar 2010, 11:05 PM
  5. Categories Dressing
    By PGlad in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 7 Aug 2007, 07:05 PM

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