Thread: Sub Categories

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

    red flag Sub Categories

    Hi I have a cart set up with 5 categories and sub categories below them.

    The sub categories are the full alphabet A,B,C,D,E,F etc

    Each letter will contain a list of plants.

    I'm trying to display the sub categories in a horizontal line across the main category page and on the sub category pages. I would like to know which piece of code I need in order to do this.

    So in effect you will have something like

    A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

    Each will link each plant type sub category.

    Thanks

    Nick

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

    Default Re: Sub Categories

    You might try another approach - -
    Try making the manufacturer "A" - "B" - etc

    You will have to change the language from manufacturer to ?? but you can do that later if this appears to work as intended
    Zen-Venom Get Bitten

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

    red flag Re: Sub Categories

    I see what your saying, however I need an ABC system in each category.

    So

    Perennials > ABCDEFGHIJKLMNOPQRSTUVWXYZ

    Shrubs > ABCDEFGHIJKLMNOPQRSTUVWXYZ

    Vegetable Plants > ABCDEFGHIJKLMNOPQRSTUVWXYZ

    Fruit Trees > ABCDEFGHIJKLMNOPQRSTUVWXYZ

    Trees > ABCDEFGHIJKLMNOPQRSTUVWXYZ


    They have to be sub categories of each product due to the way they're being entered.

    I've resorted to editing the code in category_row.php as this places the categories on each page and the ABC categories don't need an image.

    This is where I'm at with the code -

    <?php
    /**
    * index category_row.php
    *
    * Prepares the content for displaying a category's sub-category listing in grid format.
    * Once the data is prepared, it calls the standard tpl_list_box_content template for display.
    *
    * @package page
    * @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: category_row.php 4084 2006-08-06 23:59:36Z drbyte $
    */
    if (!defined('IS_ADMIN_FLAG')) {
    die('Illegal Access');
    }
    $title = '';
    $num_categories = $categories->RecordCount();

    $row = 0;
    $col = 0;
    $list_box_contents = '';
    if ($num_categories > 0) {
    if ($num_categories < MAX_DISPLAY_CATEGORIES_PER_ROW || MAX_DISPLAY_CATEGORIES_PER_ROW == 0) {
    $col_width = floor(100/$num_categories);
    } else {
    $col_width = floor(100/MAX_DISPLAY_CATEGORIES_PER_ROW);
    }

    while (!$categories->EOF) {
    if (!$categories->fields['categories_image']) !$categories->fields['categories_image'] = 'pixel_trans.gif';
    $cPath_new = zen_get_path($categories->fields['categories_id']);

    // strip out 0_ from top level cats
    $cPath_new = str_replace('=0_', '=', $cPath_new);

    // $categories->fields['products_name'] = zen_get_products_name($categories->fields['products_id']);

    $list_box_contents[$row][$col] = array('params' => '',
    'text' => '<li>' . '<a href="' . zen_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . zen_image(DIR_WS_IMAGES . $categories->fields['categories_image'], $categories->fields['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '' . $categories->fields['categories_name'] . '</a>' . '</li>');

    $col ++;
    if ($col > (MAX_DISPLAY_CATEGORIES_PER_ROW -1)) {
    $col = 0;
    $row ++;
    }
    $categories->MoveNext();
    }
    }
    ?>


    My plan is to use CSS to force the <li> tags I've added to display inline. However, there is a problem I'm struggling to work around and thats the fact that there's a <br class="clearBoth" /> in the code. I think this is coming from tpl_columnar_display.php but I can't edit this as this will affect other files associated with it.

    So my thoughts are to put a CSS around the code OR a table with CSS in it to eliminate the <br class="clearBoth" /> tag and force the <li> tags to display inline.

    What do you think?

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

    red flag Re: Sub Categories

    or do you know where i can find the document that controls the amount of category columns? The default is 3 so how would I set it to 24? If I can do this then it will save me alot of hassle

  5. #5
    Join Date
    Sep 2008
    Location
    Cleethorpes
    Posts
    1,229
    Plugin Contributions
    6

    Default Re: Sub Categories

    I believe I've sorted this now. Will post my solution shortly :-)

 

 

Similar Threads

  1. Sub-categories and their Sub-categories Styling
    By imperialmusic in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 3 Aug 2011, 05:03 AM
  2. Replies: 1
    Last Post: 12 Mar 2011, 07:18 AM
  3. Sub Categories under sub categories, can that be done?
    By pebblecrossing in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 9 Feb 2011, 09:46 PM
  4. Show sub-sub categories underneath sub-categories on the category page?
    By tomrice in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 18 Jun 2009, 03:05 AM
  5. Skip Page showing sub categories, go straight to first sub category
    By HelenSama in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 8 May 2009, 05:16 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