Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2007
    Location
    Ontario, Canada
    Posts
    1,455
    Plugin Contributions
    18

    Idea or Suggestion Twitch Left/Right Nav Category Sidebox Select

    Due to popular demand - it's time to branch this off...

    https://www.zen-cart.com/showthread....29#post1349529

    Exclusively built for the Responsive Classic 1.55f template - categories sidebox:


    Twitch Left/Right Nav Category Sidebox Select
    This module uses a simple pre-filter with the existing code to maintain the look/feel/function of a stock Responsive Classic L/R navigation. It maintains the on-page-load structure (instead of Javascript). That means it is simple and compatible with all other Twitch modules... and it's plug and play compatible with any plugin/template still using the stock nav.


    Updated Function:
    First Load - Display all categories (enabled - status)

    First click - Load only selected category/subcategories/products as they are found

    Next click - Continue and display unselected 'clickable' folders within the category - clients can click a logical visual categories to return or use the back button


    CSS updates to make it easier on the eyes while navigating and highlight or shadow return links

    Maintain Category Count switch and function on child categories



    Working Example using Right Nav Sidebox:
    http://sheldrakeautomotive.com/shop/



    includes/templates/YOUR_TEMPLATE/templates/sideboxes/tpl_categories.php
    Merge or replace the file with this:

    PHP Code:
    <?php
    /**
     * Side Box Template
     *
     * @package templateSystem
     * @copyright Copyright 2003-2016 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: picaflor-azul Sun Dec 13 16:32:43 2015 -0500 New in v1.5.5 $
     */

    // bof Twitch Left/Right Nav Category Sidebox Select - Beta - September 26.2018
      
    for ($i=0;$i<sizeof($box_categories_array);$i++) {
          if (
    $box_categories_array[$i]['current'] == '1') {
                
    // category has been selected
              //echo ' run current 1 ' ;
              
    $catSelected 'yes';
          }

          if (
    $catSelected == '') {
                
    // this is the first pass
              //echo ' first pass ' ;
              
    $catSelected 'first pass';
          }
          if (
    $box_categories_array[$i]['top'] == 'true') {
                
    // do nothing - for future use
              //echo ' run top ' ;
          
    }
    }

     if (
    $catSelected == 'first pass') {
    // First code pass block - Display all active categories found in $box_categories_array
    $content '';
    $content .= '<div id="' str_replace('_''-'$box_id 'Content') .  '" class="sideBoxContent"><ul class="list-links">' "\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';
            break;
        }
                 
    $content .= '<li><a class="' $new_style '"  href="' zen_href_link(FILENAME_DEFAULT,  $box_categories_array[$i]['path']) . '">';
                
    $content .= $box_categories_array[$i]['name'];
        }

                 
    $content .= '</a>';
                 
    $content .= '</li>' "\n";
                 
    $content .= '</ul></div>';
                 
    //$content .= '</ul>first pass complete</div>';
                
         
    }
    // eof Twitch Left/Right Nav Category Sidebox Select - Beta - September 26.2018


    if ($catSelected == 'yes') {  // Twitch L/R Nav Cat Sidebox Select
    // Selected category code pass block - Display only selected category/sub categories/products
    //echo ' run using yes ';
      
    $content "";

      
    $content .= '<div id="' str_replace('_''-'$box_id .  'Content') . '" class="sideBoxContent"><ul class="list-links">'  "\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';
            break;
          }
         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 {
    //        $content .= '<li><a class="' . $new_style . '"  href="' . zen_href_link(FILENAME_DEFAULT,  $box_categories_array[$i]['path']) . '">';

          
    if ($box_categories_array[$i]['current'] == '1') {
            if (
    $box_categories_array[$i]['has_sub_cat']) {
                
    $content .= '<li><a class="' $new_style '"  href="' zen_href_link(FILENAME_DEFAULT,  $box_categories_array[$i]['path']) . '">';
                
    $content .= '<span class="category-subs-parent">' $box_categories_array[$i]['name'] . '</span>';
            } else {
                
    $content .= '<li><a class="' $new_style '"  href="' zen_href_link(FILENAME_DEFAULT,  $box_categories_array[$i]['path']) . '">';
                  
    $content .= '<span class="category-subs-selected">' $box_categories_array[$i]['name'] . '</span>';
            }
          } else {
          if (
    $box_categories_array[$i]['top'] == 'true') {
          } else {
                
    $content .= '<li><a class="' $new_style '"  href="' zen_href_link(FILENAME_DEFAULT,  $box_categories_array[$i]['path']) . '">';
                
    $content .= $box_categories_array[$i]['name'] ;
    // Twitch add category counts to last child
          
    if (SHOW_COUNTS == 'true') {
            if ((
    CATEGORIES_COUNT_ZERO == '1' and  $box_categories_array[$i]['count'] == 0) or  $box_categories_array[$i]['count'] >= 1) {
              
    $content .= '<span class="notforward cat-count">' .  CATEGORIES_COUNT_PREFIX $box_categories_array[$i]['count'] .  CATEGORIES_COUNT_SUFFIX '</span>';
            }
          }
          }}

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


          
    $content .= '</a>';
          
    $content .= '</li>' "\n";
        }
      }
    }  
    // Twitch L/R Nav Cat Sidebox Select


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

    Proposed Updates:
    - Tie the $new_style CSS values together in one control
    - Addition of thumbnail images in the display list
    Twitch.
    http://www.twitchtoo.com - Do you work for free? Please donate.
    Twitch Wholesale + Attributes, ZC 1.38 - 1.56a - Professional - New Site Upgrades!

  2. #2
    Join Date
    Apr 2007
    Location
    Ontario, Canada
    Posts
    1,455
    Plugin Contributions
    18

    Idea or Suggestion Re: Twitch Left/Right Nav Category Sidebox Select

    This code can be used for any Responsive Classic Template using the stock categories sidebox, I've build it into Twitch Left/Right Nav Category Sidebox Select moving forward.


    Twitch Add Link Back to Reset Categories - Categories Sidebox Heading - (goes to index by default)
    19g for Zen Cart 1.55f
    February 11.2019

    includes/modules/sideboxes/YOUR_TEMPLATE/categories.php
    replace this:
    require($template->get_template_dir('tpl_categories.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_categories.php');

    $title = BOX_HEADING_CATEGORIES;
    $title_link = false;

    with this:
    require($template->get_template_dir('tpl_categories.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_categories.php');

    $title = '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">' . BOX_HEADING_CATEGORIES . '</a>'; /* Twitch add link back to reset categories (goes to index) */
    $title_link = false;

    Working example on a live site:
    http://germanwholesaleparts.ca/

    Codes for Coffees...
    Last edited by twitchtoo; 12 Feb 2019 at 04:44 AM.
    Twitch.
    http://www.twitchtoo.com - Do you work for free? Please donate.
    Twitch Wholesale + Attributes, ZC 1.38 - 1.56a - Professional - New Site Upgrades!

  3. #3
    Join Date
    Apr 2007
    Location
    Ontario, Canada
    Posts
    1,455
    Plugin Contributions
    18

    css problem Re: Twitch Left/Right Nav Category Sidebox Select

    To add some colour control add this to includes/templates/YOUR_TEMPLATE/css/stylesheet.css:


    /* Twitch Left/Right Nav Category Sidebox Select */
    span.category-subs-parent {font-style: italic; font-weight: bold; color: #A69B89; }
    a.category-top :hover {color: white;}
    a.category-products {font-weight: bold;}
    a.category-products :last-child {font-style: normal; color: black; }
    .cat-count {font-weight:normal;}


    Then perhaps clear these settings in Admin > Configuration > Layout Settings to clean up the look a bit more...

    Categories Separator between the Category Name and Count
    from this:
    -&gt;

    to this:
    &nbsp;


    Categories Separator between the Category Name and Sub Categories
    from this:
    |_&nbsp;

    to this:
    &nbsp;

    You may also want to see if Show Category Counts is turned on in Admin > Configuration > My Store
    Twitch.
    http://www.twitchtoo.com - Do you work for free? Please donate.
    Twitch Wholesale + Attributes, ZC 1.38 - 1.56a - Professional - New Site Upgrades!

 

 

Similar Threads

  1. Left and Right nav disappeared after upgrade
    By danilyn22 in forum Upgrading from 1.3.x to 1.3.9
    Replies: 2
    Last Post: 19 Nov 2010, 01:42 AM
  2. Move the sidebox left to right and right to left(shrink the site)
    By navido in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 30 Nov 2009, 08:51 PM
  3. Left Nav Different Layout for Each Category
    By phpmike in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 9 Jul 2007, 07:23 PM
  4. nav column left & right
    By Prellyan in forum Templates, Stylesheets, Page Layout
    Replies: 7
    Last Post: 28 Mar 2007, 02:42 PM
  5. right sidebox isn't aligned with left sidebox
    By zc-newbie in forum Basic Configuration
    Replies: 0
    Last Post: 3 Sep 2006, 03:40 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