Results 1 to 10 of 10
  1. #1
    Join Date
    Dec 2006
    Posts
    20
    Plugin Contributions
    0

    Default subcategories not getting parent category stylesheet

    I've read through the css_readme and searched through the forums but I couldn't find an answer for my problem.

    I have a site I'm developing and each primary category needs it own colour system. Each subcategory in the primary category also needs to inherit this colour system. However, I can't figure out a way (I haven't tried getting messy with the php yet) to make all the subcategories use the parent category's stylesheet.

    for example: c_65 is a parent category, it has c_65_66, c_65_67, and c_65_68 as children. I'm trying to avoid creating a stylesheet for each subcategory, as that creates maintainance issue, and instead have c_65.css apply to the subcategories that c_65 contains.

    So is there anyway to do this? I don't mind getting into the php if that needs to be done.

  2. #2
    Join Date
    Aug 2005
    Posts
    26,057
    Plugin Contributions
    9

    Default Re: subcategories not getting parent category stylesheet

    While I have not double checked this for you - I believe that if you designate a style sheet for a category then it will also be utilized for it's children or subs also

    so have one for the cat c _65, another for a different cat say c_77, etc
    Zen-Venom Get Bitten
    Get Your Business Found

  3. #3
    Join Date
    Dec 2006
    Posts
    20
    Plugin Contributions
    0

    Default Re: subcategories not getting parent category stylesheet

    Thanks for replying so fast kobra. But on my install of 1.3.7 when I go into "index.php?main_page=index&cPath=65_69". The stylesheet c_65.css is not loaded. Also if I target a sub category, it doesn't load in the parent. So should I start poking in the css loader php file.

    thanks again.

  4. #4
    Join Date
    Aug 2005
    Posts
    26,057
    Plugin Contributions
    9

    Default Re: subcategories not getting parent category stylesheet

    I must have missed something....Have you looked at the readme in the /css directory?
    Zen-Venom Get Bitten
    Get Your Business Found

  5. #5
    Join Date
    Jan 2004
    Posts
    58,265
    Blog Entries
    3
    Plugin Contributions
    106

    Default Re: subcategories not getting parent category stylesheet

    At the present time, it pulls for the current category, not for a parent.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  6. #6
    Join Date
    Dec 2006
    Posts
    20
    Plugin Contributions
    0

    Default Re: subcategories not getting parent category stylesheet

    So in the current build there is no standard way to do what I'm attempting to accomplish? If I get any decent results from poking around in the CSS loader files I'll post it here.

  7. #7
    Join Date
    Dec 2006
    Posts
    20
    Plugin Contributions
    0

    Default Re: subcategories not getting parent category stylesheet

    Allright, I figured it out, and it was quite easy.

    In the your_template/common/html_header.php around line 53 an array is created that stores the values of the stylesheet names that will be loaded, here is where we will add a new value for our root category stylesheet.

    First, above the array you have to create a new variable that will store the value of the root category.

    Code:
    $top_category =  substr($cPath, 0, strpos($cPath, '_'));
    Then in the array mentioned before ($sheets_array) needs to be modified to look like the following
    Code:
     $sheets_array = array('/' . $_SESSION['language'] . '_stylesheet', 
                            '/' . $tmp_pagename,  
                            '/' . $_SESSION['language'] . '_' . $tmp_pagename,
                            '/c_' . $top_category, //my top category search.
    			'/c_' . $cPath, 					
                            '/' . $_SESSION['language'] . '_c_' . $cPath, 
                            '/m_' . $manufacturers_id, 
                            '/' . $_SESSION['language'] . '_m_' . (int)$manufacturers_id, 
                            '/p_' . $tmp_products_id,
                            '/' . $_SESSION['language'] . '_p_' . $tmp_products_id 
                            );
    The modified line is the fourth node in the array. It simply makes a node in the array that reflects the current top level category.

    So there you have it, an easy way to load both primary category style sheets and sub-category sheets if you need them.

  8. #8
    Join Date
    Aug 2005
    Posts
    26,057
    Plugin Contributions
    9

    Default Re: subcategories not getting parent category stylesheet

    And this is what is great about OpenSource Projects
    Zen-Venom Get Bitten
    Get Your Business Found

  9. #9
    Join Date
    Dec 2006
    Posts
    20
    Plugin Contributions
    0

    Default Re: subcategories not getting parent category stylesheet

    It certainly is. I'm really impressed with the quality of zen cart and hope that I can contribute more. If I come up with anything else I think others can use, I'll be sure to post it here (not this thread, but in the forums :) )

  10. #10
    Join Date
    Nov 2005
    Location
    Colorado Springs, CO USA
    Posts
    7,039
    Plugin Contributions
    31

    Default Re: subcategories not getting parent category stylesheet

    I've tried out your modification and it works really well - no more multiple c_??_?? stylesheets.

    Congrats.

 

 

Similar Threads

  1. Show all products in subcategories in Main Category page?
    By woodlandsprite in forum Setting Up Categories, Products, Attributes
    Replies: 9
    Last Post: 3 Dec 2009, 08:33 PM
  2. Different Category/ Different Stylesheet?
    By Reesy in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 8 Jan 2007, 10:54 AM
  3. Top Category image size with Subcategories
    By ellivir in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 31 Oct 2006, 10:36 AM
  4. howto show always Top and Subcategories in the category box?
    By wflohr in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 31 May 2006, 06:06 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
  •