Page 4 of 7 FirstFirst ... 23456 ... LastLast
Results 31 to 40 of 70
  1. #31
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Parent Categories Separated In 3 sideboxes

    This will strip off the subcategory numbers (if any) before testing for categories to display. You will only need to list the top categories, and all of their subs will be included.
    PHP Code:
         if (in_array(str_replace(strstr($box_categories_array[$i]['path'],"_"),"",str_replace("cPath=","",$box_categories_array[$i]['path'])), explode(",",'3,21,27'))) { 

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

    Default Re: Parent Categories Separated In 3 sideboxes

    With either multiple category boxes or Categories Dressing, you could add code to the appropriate copy of tpl_categories.php to say "if category equals ##, $content = '<a href=your_external_link etc.>' ". Simple, though of course the statement has to be written just right and put in the right location.

    You would have "dummy" categories for each of these, which nobody would ever actually be visiting, as their links would go offsite instead.

  3. #33
    Join Date
    May 2007
    Posts
    41
    Plugin Contributions
    0

    Default Re: Parent Categories Separated In 3 sideboxes

    Quote Originally Posted by gjh42 View Post
    With either multiple category boxes or Categories Dressing, you could add code to the appropriate copy of tpl_categories.php to say "if category equals ##, $content = '<a href=your_external_link etc.>' ". Simple, though of course the statement has to be written just right and put in the right location.

    You would have "dummy" categories for each of these, which nobody would ever actually be visiting, as their links would go offsite instead.
    That makes sense, I just have no idea how to write it. I'm not sure how complicated it would be, but if you (or anyone) get a chance to help me out, I would appreciate it.

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

    Default Re: Parent Categories Separated In 3 sideboxes

    In /includes/templates/your_template/sideboxes/tpl_categories.php, around line 31 find
    PHP Code:
         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 .= '<a class="' $new_style '" href="' zen_href_link(FILENAME_DEFAULT$box_categories_array[$i]['path']) . '">'
    and add elseif sections to get this
    PHP Code:
         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)

          
    } elseif ($box_categories_array[$i]['path'] == 'cPath=23') {
          
    $content .= '<a class="exLink" href="your_MuscleNOW.com_url" target="_blank">Muscle Building Program</a><br />' "\n";
          } elseif (
    $box_categories_array[$i]['path'] == 'cPath=24') {
          
    $content .= '<a class="exLink" href="your_FatVanish.com_url" target="_blank">Weight Loss Program</a><br />' "\n";

          } else {
          
    $content .= '<a class="' $new_style '" href="' zen_href_link(FILENAME_DEFAULT$box_categories_array[$i]['path']) . '">'
    Replace 23 and 24 with the appropriate category id's, and

    your_MuscleNOW.com_url

    with the actual URL.

    I haven't tested this, so if anything needs tweaking, let me know.
    You may want to style
    .exLink { }
    in your stylesheet.

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

    Default Re: Parent Categories Separated In 3 sideboxes

    You could use a variant of this code to display ez-page links at desired points in the list.

    Create a dummy category for each block of links you want, and give it a sort order to put it in the proper place in the list. Then use the elseif snippets to display the links:
    PHP Code:
         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)

          
    } elseif ($box_categories_array[$i]['path'] == 'cPath=23') {
          
    $content .= '<a class="ezpLink" href="' zen_ez_pages_link(6) . '" target="_blank">EZ-Page Number 6</a><br />' "\n";
          
    $content .= '<a class="ezpLink" href="' zen_ez_pages_link(7) . '" target="_blank">EZ-Page Number 7</a><br />' "\n";
          } elseif (
    $box_categories_array[$i]['path'] == 'cPath=24') {
          
    $content .= '<a class="ezpLink" href="' zen_ez_pages_link(9) . '" target="_blank">EZ-Page Number 9</a><br />' "\n";

          } else {
          
    $content .= '<a class="' $new_style '" href="' zen_href_link(FILENAME_DEFAULT$box_categories_array[$i]['path']) . '">'
    (Scrap the target="_blank" if you don't want the ez-pages to open in a new window.)
    Last edited by gjh42; 4 Nov 2007 at 07:46 PM.

  6. #36
    Join Date
    May 2006
    Location
    Texas
    Posts
    565
    Plugin Contributions
    4

    Default Re: Parent Categories Separated In 3 sideboxes

    Quote Originally Posted by webomat View Post
    Hi,

    I'm coming late to this discussion, but there's a pretty simple way to my mind... something similar to what I've done with a site that had special needs re displaying the categories. Simply modify a function/query in the \includes\classes\category_tree.php to select based on the top level category.

    Here's an overview....

    1. Set up an Adult Category that contains all the categories of adult clothing; set up one for Teens and one for Children.

    2. Write down the Category ID # for each of them.

    3. In \includes\classes\category_tree.php you need to duplicate the entire "function zen_category_tree" section, renaming the function... for instance, "function zen_adult_tree".

    4. Find this section and add the text in red, replacing the # with your number from Step 2 above:
    Code:
        if ($product_type == 'all') { // added c.categories_id specific here bpeters
          $categories_query = "select c.categories_id, cd.categories_name, c.parent_id, c.categories_image
                                 from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd
                                 where c.parent_id = 0
                                 and c.categories_id = #
                                 and c.categories_id = cd.categories_id
                                 and cd.language_id='" . (int)$_SESSION['languages_id'] . "'
                                 and c.categories_status= 1
                                 order by sort_order, cd.categories_name";
        } else
    5. Duplicate the Categories Sidebox, title it Adult or whatever... change the function call to call the newly defined "tree" in \includes\modules\sideboxes\[your template]\categories.php as shown in red text:
    Code:
    // don't build a tree when no categories
        $check_categories = $db->Execute("select categories_id from " . TABLE_CATEGORIES . " where categories_status=1 limit 1");
        if ($check_categories->RecordCount() > 0) {
          $box_categories_array = $main_category_tree->zen_adult_tree();
        }
    Of course changing adult to whatever you need for each box.

    6. I don't know if you'll need to change anything if you're using the Site Map contrib or not, so you might want to check if that applies to your site.

    7. Be aware that the categories may not be expanded in the sidebox to display the subcategories all the time, and the boxes would have one link to "Adult Clothing" and not show anything else until you click on the category link itself. I can't remember what the upshot of this was, because I made additional changes beyond this for that site to meet their specific needs. But that sticks in my mind for some reason.

    ** Be advised that the mod to the class file will be overwritten during an upgrade, so be sure to save a copy of that file elsewhere -- there is no override in that section. And modifying core code is not always best, but this works and is easy. "-)

    I got this from digging around in the forum, found an old post by Ajeh I think that mentioned this method of doing something similar. Anyway, just an idea in case you don't get the other thing working.

    Just my two cents!

    Cheers,

    Becky
    I know its close to a year after you posted this, but THANK YOU! I modified the category tree function (after cloning it) so that I don't have to make more than one copy of it. Basically, I pass in a parameter along with the "zen_custom_tree" function.. and it auto fills the part of the query for me.

    Also, if you want it to show all the sub categories instead of the top level only, change the following code:

    Code:
     $categories_query = "select c.categories_id, cd.categories_name, c.parent_id, c.categories_image
                                 from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd
                                 where c.parent_id = #
                                 and c.categories_id = cd.categories_id

  7. #37
    Join Date
    Oct 2006
    Posts
    5,477
    Plugin Contributions
    11

    Default Re: Parent Categories Separated In 3 sideboxes

    Or you can use simple category tree, which allows you to build just any branch of the category tree you want, given the category id. That way you can divide the tree and put in in multiple blocks.

    On my site i put the parent cat on the header, and the sub-cats on the left column.
    I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

  8. #38
    Join Date
    Jun 2007
    Posts
    54
    Plugin Contributions
    0

    Default Re: Parent Categories Separated In 3 sideboxes

    Anybody that know how to get this fuction working would love the Help, I have 3 cats and would like subs showing in each cat. But All I can get to show is one cat in the first cat but the others are blank. Even tried making my subs as top cats and call them in but the code only seems to call in the cpath and nothing after it. But nothing in my following 2 cat boxes

    my code from tpl_catergories_rock_roll.php
    $cPTest = $box_categories_array[$i]['path'];
    if (in_array(str_replace(strstr($box_categories_array[$i]['path'],"_"),"",str_replace("cPath=","",$box_categories_array[$i]['path'])), explode(",",'111,112,75'))) {

    Any ideas thanks who can spare some time for me

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

    Default Re: Parent Categories Separated In 3 sideboxes

    Coming from your other thread (3 catergories in different sideboxes - Help), my first comment would be that if you want the boxes all in one column as your site shows now, you could have done it much easier by tweaking Categories Dressing than by cloning the sideboxes. Since you have done that work, it will now be easier to complete the category sorting in your new sideboxes.

    To recap the basic sorting code, since there are so many incomplete or inaccurate versions in previous posts, this will execute the code if the category being evaluated is in the list of cPaths in the explode function.
    PHP Code:
    $cPTest str_replace("cPath=","",$box_categories_array[$i]['path']);
    if(
    in_array($cPTestexplode(",",'3,7,7_25'))) {
      
    // code to be executed

    Note that the numbers are in one string, separated by commas and no spaces, and surrounded by one pair of quotes ' '.

    I will address your case next.
    Last edited by gjh42; 4 Apr 2008 at 06:52 AM.

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

    Default Re: Parent Categories Separated In 3 sideboxes

    Since your setup has one top category per box, and you won't want to display that as a category, only the subcategories below it, you will need to use an expanded categories mod. One that has proven reliable for situations like yours is fragfutter's Uncollapsed Categories Tree, hosted on his own site.

    Another possibility is to use yellow1912's Simple Category Tree mod (see his sig above). This would also include the ability to directly control the categories being displayed in each box.

    For either of these you will need to get help from their creators or people who have used them, as I have not used either of them myself. Once you have worked this out, come back and I will have some display code for your situation.

    A third option, since you presumably will not be displaying the top categories themselves but only their subs, would be to move the subs to become top categories themselves, keeping the current tops only as names on the boxes. Then you can display all of the first level of categories with no further coding required.
    Last edited by gjh42; 4 Apr 2008 at 07:13 AM.

 

 
Page 4 of 7 FirstFirst ... 23456 ... LastLast

Similar Threads

  1. Category Filter - Display Parent categories
    By djdavedawson in forum General Questions
    Replies: 1
    Last Post: 5 Oct 2010, 10:08 PM
  2. Subcategories products in Parent Categories
    By fightthefourwalls in forum Setting Up Categories, Products, Attributes
    Replies: 21
    Last Post: 14 Jun 2010, 07:58 PM
  3. Enable Links for Parent Categories in Categories Sidebox
    By MrsQ in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 11 Sep 2009, 08:25 PM
  4. Parent... Child... Sub.... CATEGORIES
    By eliza-bee in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 12 May 2009, 03:03 PM
  5. Parent categories in dropdown filter
    By Ben in forum Customization from the Admin
    Replies: 3
    Last Post: 15 Aug 2006, 02:38 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