Results 1 to 10 of 20

Threaded View

  1. #10
    Join Date
    Aug 2014
    Location
    Lisbon
    Posts
    594
    Plugin Contributions
    0

    Default Re: Browsing through categories

    So, basically, you want to link to the last subcat no matter what ?
    That would be in your:
    \zencart\includes\modules\categories_tabs.php ( I've checked on zc 156)

    Just for test purposes, try this. At least will give you an idea.
    This is for the top tab category list
    If cpath is not set it will link to the last child.
    If is set, it will link to the top category ( I guess ... didn't test all )
    that $subcategories_array has the child's categories ID.
    Maybe this works, if you follow the same category configuration.

    PHP Code:
    while (!$categories_tab->EOF) {
        
    $path $categories_tab->fields['categories_id'];
        
    // currently selected category
        
    if ((int) $cPath == $categories_tab->fields['categories_id']) {
            
    $new_style 'category-top';
            
    $categories_tab_current '<span class="category-subs-selected">' $categories_tab->fields['categories_name'] . '</span>';
        } else {
            
    $new_style 'category-top';
            
    $categories_tab_current $categories_tab->fields['categories_name'];
            
    $subcategories_array = array();
            
    zen_get_subcategories($subcategories_array$categories_tab->fields['categories_id']);
            if (!empty(
    $subcategories_array)) {
                
    $path $categories_tab->fields['categories_id'] . '_' implode('_'$subcategories_array);
            }
        }

        
    // create link to top level category
        
    $links_list[] = '<a class="' $new_style '" href="' zen_href_link(FILENAME_DEFAULT'cPath=' $path) . '">' $categories_tab_current '</a> ';
        
    //$links_list[] = '<a class="' . $new_style . '" href="' . zen_href_link(FILENAME_DEFAULT, 'cPath=' . (int)$categories_tab->fields['categories_id']) . '">' . $categories_tab_current . '</a> ';

        
    $categories_tab->MoveNext();

    And ofcourse , as always, probably there is a better way
    Last edited by mesnitu; 3 Feb 2019 at 02:09 PM.
    “Though the problems of the world are increasingly complex, the solutions remain embarrassingly simple.” ― Bill Mollison

 

 

Similar Threads

  1. Replies: 1
    Last Post: 9 May 2011, 05:12 PM
  2. Something is going wrong when browsing through categories
    By goalsurfer in forum General Questions
    Replies: 7
    Last Post: 7 Nov 2010, 06:00 AM
  3. Replies: 3
    Last Post: 13 Jul 2009, 05:23 PM
  4. Browsing Categories
    By tameboy in forum Templates, Stylesheets, Page Layout
    Replies: 8
    Last Post: 5 Feb 2008, 10:15 PM
  5. having trouble when browsing through categories
    By blackinches in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 20 Dec 2006, 01:05 AM

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