Page 2 of 224 FirstFirst 12341252102 ... LastLast
Results 11 to 20 of 2240
  1. #11
    Join Date
    Jun 2007
    Posts
    16
    Plugin Contributions
    0

    Default Re: Categories Dressing

    sorry about that, here is my code for the code for the modified tpl_categories.php file, i'm using the non linked headers, let mek now what you think.


    <?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 v1.0 by Glenn Herbert (gjh42) 2007-06-06
    */
    //$content_tm = '';
    //$content_head = tm_box_head(BOX_HEADING_CATEGORIES,'','style3');
    $content_tm .= '<ul class="ul2">
    ';

    $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';
    }
    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 and) heading above a cat
    if ($box_categories_array[$i]['path'] == 'cPath=26') { //replace number with your desired cPath
    $content .= '<br>' . "\n"; // to add divider uncomment this line
    $content .= '<span class="catBoxHeading1"><strong>Room</strong></span><br />' . "\n";
    }
    // categories dressing - add (divider and) heading above a cat
    if ($box_categories_array[$i]['path'] == 'cPath=19') { //replace number with your desired cPath
    $content .= '<br>' . "\n"; // to add divider uncomment this line
    $content .= '<span class="catBoxHeading1"><strong>Categories</strong></span><br />' . "\n";
    }
    // categories dressing - add (divider and) heading above a cat
    if ($box_categories_array[$i]['path'] == 'cPath=31') { //replace number with your desired cPath
    $content .= '<br>' . "\n"; // to add divider uncomment this line
    $content .= '<span class="catBoxHeading1"><strong>Prices</strong></span><br />' . "\n";
    }
    $content .= '<a class="' . $new_style . '" href="' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">';

    // categories dressing - display images for category names
    $cat_name_display = $box_categories_array[$i]['name'];
    if(in_array(str_replace("cPath=","",$box_categories_array[$i]['path']), explode(",",''))) { //replace numbers with your cat ids separated by commas
    $cat_name_display = '<img src="' . HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_TEMPLATE . 'images/catimg' . str_replace("cPath=","",$box_categories_array[$i]['path']) . '.gif" alt="Category ' . str_replace("cPath=","",$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 . '</span>';
    } else {
    $content .= '<span class="category-subs-selected">' . $cat_name_display . '</span>';
    }
    } else {
    $content .= $cat_name_display;
    } // images for category names

    if ($box_categories_array[$i]['has_sub_cat']) {
    $content .= CATEGORIES_SEPARATOR;
    }
    $content .= '</a>';

    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 .= '<br />' . "\n";
    }
    }

    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') {
    $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>' . '<br />' . "\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 .= '<a class="category-links" href="' . zen_href_link(FILENAME_PRODUCTS_NEW) . '">' . CATEGORIES_BOX_HEADING_WHATS_NEW . '</a>' . '<br />' . "\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 .= '<a class="category-links" href="' . zen_href_link(FILENAME_FEATURED_PRODUCTS) . '">' . CATEGORIES_BOX_HEADING_FEATURED_PRODUCTS . '</a>' . '<br />' . "\n";
    }
    }
    if (SHOW_CATEGORIES_BOX_PRODUCTS_ALL == 'true') {
    $content .= '<a class="category-links" href="' . zen_href_link(FILENAME_PRODUCTS_ALL) . '">' . CATEGORIES_BOX_HEADING_PRODUCTS_ALL . '</a>' . "\n";
    }
    }
    $content .= '</div>';
    ?>

  2. #12
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,013
    Plugin Contributions
    25

    Default Re: Categories Dressing

    You have replaced all of TM's code in this file, except for the opening
    $content_tm .= '<ul class="ul2">
    ';
    which is now not closed. This would cause an error if $content_tm were being applied at the end.. TM uses $content_tm to accumulate the list instead of $content, so the heading code will need to be modified to work with this.
    Also, the <ul> is not going to play nice with a non-list item tossed in the middle, so we will have to end the list, add the heading and start another list.

    You need to go back to the original TM file, and add just the heading code, as shown here in its modified form.

    Immediately after this bit:
    PHP Code:
    // skip if this is for the document box (==3)
    } else { 
    add this:
    PHP Code:
    // categories dressing - add (divider and) heading above a cat
    if ($box_categories_array[$i]['path'] == 'cPath=26') { //replace number with your desired cPath
    $content_tm .= '</ul>';
    $content_tm .= '<br>' "\n"// to add divider uncomment this line
    $content_tm .= '<span class="catBoxHeading1"><strong>Room</strong></span><br />' "\n";
    $content_tm .= '<ul class="ul2" >' "\n";
    }
    // categories dressing - add (divider and) heading above a cat
    if ($box_categories_array[$i]['path'] == 'cPath=19') { //replace number with your desired cPath
    $content_tm .= '</ul>';
    $content_tm .= '<br>' "\n"// to add divider uncomment this line
    $content_tm .= '<span class="catBoxHeading1"><strong>Categories</strong></span><br />' "\n";
    $content_tm .= '<ul class="ul2" >' "\n";
    }
    // categories dressing - add (divider and) heading above a cat
    if ($box_categories_array[$i]['path'] == 'cPath=31') { //replace number with your desired cPath
    $content_tm .= '</ul>';
    $content_tm .= '<br>' "\n"// to add divider uncomment this line
    $content_tm .= '<span class="catBoxHeading1"><strong>Prices</strong></span><br />' "\n";
    $content_tm .= '<ul class="ul2" >' "\n";


  3. #13
    Join Date
    Jun 2007
    Posts
    16
    Plugin Contributions
    0

    Default Re: Categories Dressing

    I'm already confused.... This code you sent.

    // skip if this is for the document box (==3)
    } else {

    Does not exist in the orignal code I sent you.......

  4. #14
    Join Date
    Jun 2007
    Posts
    16
    Plugin Contributions
    0

    Default Re: Categories Dressing

    alright nevermind, I found it, and it worked! Thanks!

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

    Default Re: Categories Dressing

    Categories Dressing version 1.1 is now available in Downloads.

    Added two new functions, example files, and more directions for use of built-in functions.

    - You can replace any desired category names with background image links which swap on hover.
    - You can add a custom bullet to top categories, which changes when a cat opens to subs.

    The examples are configured to display with Zen Cart demo products to quickly illustrate their use. A sample stylesheet is included, from which to copy CSS code for your main stylesheet.

  6. #16
    Join Date
    Jun 2007
    Posts
    7
    Plugin Contributions
    0

    Default Re: Categories Dressing

    Do you have an example Site for the hover Images? This is exactly what i'ver requested!
    The only problem is the lack of Documentation...

    Anyway Thanks

  7. #17
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,013
    Plugin Contributions
    25

    Default Re: Categories Dressing

    I have tested this on my local server and don't currently have an extra database available to install a demo on my live server.

    The example is set up to display the hover swap on category id 25 ("Test 10&#37; by Attrib" in Demo products). If you have a category with cPath=25, it will automatically work there, using the example image files.
    If you don't have a category 25, you can change the number in the tpl_categories.php and stylesheet_categories_dressing.css files (per the instructions in the readme) to one you want to use, and rename the two image files in /your_template/images/ from catimg25.gif and catimg25hover.gif to match.

  8. #18
    Join Date
    Jun 2007
    Posts
    7
    Plugin Contributions
    0

    Default Re: Categories Dressing

    Ok i figured it out but i have a Problem with the CSS file.
    There is the line with
    Code:
    margin-bottom: -21px;/*compensates for extra line break introduced by display: block;*/
    But this looks very ugly on the IE.

    This is how it looks in IE:




    And here is how it looks on Firefox



    Is there a way to get it working in both Browsers?

  9. #19
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,013
    Plugin Contributions
    25

    Default Re: Categories Dressing

    That IE bug shows for me, too, sometimes, but nowhere near as severely. You will need to follow the directions near the bottom of the readme:


    - Directions for using the function built into tpl_categories.php to display all top categories as colored boxes:

    Find in tpl_categories.php:

    $content .= '<br />' . "\n"; //comment out this line for a.category-top display: block
    /*$content .= "\n";*/ //uncomment this line for a.category-top display: block

    and change to:

    /*$content .= '<br />' . "\n";*/ //comment out this line for a.category-top display: block
    $content .= "\n"; //uncomment this line for a.category-top display: block

    [ The rest may not be applicable directly to you... ]
    Add to your stylesheet:

    a.category-top {
    background-color: #aabbff;
    color: #112233;
    padding: 0.5em 0.3em;
    display: block;
    }

    adjusting numbers and adding or deleting properties as you desire (such as font or background-image).
    If your stylesheet already has a.category-top, just add display: block; to it and adjust.

    - For a "rollover" effect to change the appearance on hovering, add to your stylesheet:

    a.category-top:hover {
    background-color: #ccddee;
    color: #332211;
    }

    adjusting as desired. You can also swap background images by including

    background-image: url(../images/categorybghover.gif);



    *** And remove the
    margin-bottom: -21px;

    I will include this explicitly in the instructions for the next version.
    Last edited by gjh42; 21 Jun 2007 at 09:52 PM.

  10. #20
    Join Date
    Jun 2007
    Posts
    7
    Plugin Contributions
    0

    Default Re: Categories Dressing

    Perfect. This works flawlessly for me.
    Thank u for your always helpful and fast replies.

    I really appreciate it.

 

 
Page 2 of 224 FirstFirst 12341252102 ... LastLast

Similar Threads

  1. Better Categories Contrib & ezpages
    By heavenlynights in forum All Other Contributions/Addons
    Replies: 184
    Last Post: 26 Oct 2012, 02:36 AM
  2. Show Top level Categories and 1st sub level categories in side box
    By airtime in forum Templates, Stylesheets, Page Layout
    Replies: 10
    Last Post: 3 Mar 2011, 06:03 PM
  3. link 1 product to several categories at once
    By dedj in forum Setting Up Categories, Products, Attributes
    Replies: 10
    Last Post: 29 Sep 2007, 11:17 PM
  4. 2 different kinds of categories?
    By rstevenson in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 6 Nov 2006, 08:42 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
  •