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

    Default Creating Custom Layouts for Categories

    A store I'm building for a client requires specially tailored category pages. I searched through the forums for a good hour and couldn't find anything about anyone facing a similar issue. So I created something that would do the trick.

    I'll provide code below. The use of this mod is really only pertinent when a client or store owner has a fixed set or very slowly changing set of categories / sub categories that they want to display in a way that is unique from other categories or the default way categories are displayed. For example my client wanted one section to have very large graphical links to sub-categories in one top category and in another category have text links that are mixed with flash. So I came to the conclusion that it would be most easily accomplished by creating static pages that are inserted when the right category is needed as it is far more trouble some to hack at the stylesheet and template files to conditionally render the appropriate template. As I said earlier this is only a useful method if the product categories change slowly or not at all. As each change in category structure requires you to update the template files for each category page you have made.

    If this sounds like something you would be interested in doing here is how you can do it:

    Locate the tpl_index_categories.php file for your template or make one if it already doesnt exist.

    at Line 45 (ver 1.3.7) there will be a " } " Comment this brace out. As we will be inserting more code here to change the behaviour.

    around line 43 there is a "} else {" Below this statement insert the following:

    Code:
    /**
         *
         * Modification that looks up a category define page for the active category
         * If the active category has a define page, and the define page
         * is set to be active.  The system displays that
         * Otherwise it displays the dynamic content from the database.
         * 
         **/
         
         // Select the define page for the Current value of $cPath 
         // Which is always the current category.
        $define_page = zen_get_file_directory(DIR_WS_LANGUAGES . $_SESSION['language'] . '/html_includes/', 'define_cat_' . $cPath, 'false');
        
        if( file_exists($define_page) ){ //test to see if there is such a file?
            include($define_page);
        } else { //Proceed as normal and render the dynamic content
    This will look for a file called define_cat_XX.php where XX is the current category/ sub category.

    if this file is found it includes it other wise the page is dynamically drawn as normal.

    to finish off everything there is one more snippet of code. At line 116 of the original file is " } // !EOF " Before this statement insert the following:

    Code:
     } //end while
     } //end load define page.
    This will complete all your braces and everything will be great. If anyone has any questions or needs a completed file let me know and I'll do my best.

  2. #2
    Join Date
    Jun 2005
    Location
    Hertfordshire, UK
    Posts
    9,922
    Plugin Contributions
    3

    Default Re: Creating Custom Layouts for Categories

    You should be studying the "Customised Pages by CSS" section (or something like that...)

    You can have specific sections of your store look completely different from others - its all in this Page-Based CSS idea.

    I don't know enough about it, but I do know it's possible...
    Did my post help you fix something? You can show your gratitude by buying the the dev team coffee.

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

    Default Re: Creating Custom Layouts for Categories

    I've already done as much as I could with CSS on those pages. My problem was needing to put very specific content into the pages. For example Flash movies, overly large images on one sub category but not on another. Currently zen cart doesn't allow you to do this (flash movies for sure) but I needed to so I made the above modifications.

  4. #4
    Join Date
    Aug 2004
    Location
    Fountain Hills, AZ
    Posts
    516
    Plugin Contributions
    1

    Default Re: Creating Custom Layouts for Categories

    I'm trying to imagine what you are doing here. It sound interesting. Would you post a link so I could take a peek.

    Thanks

  5. #5
    Join Date
    Apr 2004
    Location
    UK
    Posts
    5,860
    Plugin Contributions
    2

    Default Re: Creating Custom Layouts for Categories

    Dezina ZenCart Templates
    Please do not PM for support queries..Post in forums..help others

 

 

Similar Threads

  1. Creating and calling a custom page
    By tqualizer_man in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 20 Nov 2006, 04:24 AM
  2. Creating Custom Shipping Module
    By beasleybub in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 5 Nov 2006, 01:50 AM
  3. Creating Custom Tables
    By pvon34 in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 8 Sep 2006, 09:21 PM
  4. Creating Custom Pages Instead of Using Cart
    By null in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 19 Jun 2006, 10:20 PM
  5. Creating A Custom Template...Help Please
    By bobbyt in forum Templates, Stylesheets, Page Layout
    Replies: 7
    Last Post: 15 May 2006, 11:45 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
  •