Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2007
    Posts
    166
    Plugin Contributions
    1

    Default Display categories top level on a custom page... How?

    I need to have a custom page with the top level of categories because simple seo does not like

    index.php?main_page=index&cPath=0

    Instead of diplaying all my categories , I get kicked back to the homepage..

    So what I'm trying to do is display all the categories on a custom page called, similar to ez pages...

    Well I followed the how to make a custom page, that was easy, but trying to dissect the code and functions is tough.. All I need is my categories displayed for cPath=0 on a custom page..

    Does anyone know which variables to change, do I have to include something like $_GET[cPath]=0; ? .. what's the correct way to fix this? I've seen some other people with similar problems but no answers.

    Thanks, I'm looking for an answer, but just some suggestions would be a great help too!
    AIM edwardtilbury
    GoogleTalk edwardtilbury

  2. #2
    Join Date
    Sep 2004
    Location
    Western Massachusetts
    Posts
    2,945
    Plugin Contributions
    5

    Default Re: Display categories top level on a custom page... How?

    You shouldn't need to any special coding to show the top-level categories on the main page - what's your setting for Admin > Configuration > Layout Settings > Categories - Always Show on Main Page?
    Neville
    An assumption is what you arrive at when you get tired of thinking...

  3. #3
    Join Date
    Sep 2007
    Posts
    166
    Plugin Contributions
    1

    Idea or Suggestion Re: Display categories top level on a custom page... How?

    actually its different, the categories on the main page work fine, but my main page is too cluttered, when the user clicks on "Products" he goes to this URL that shows all the different categories we have products for:

    index.php?main_page=index&cPath=0

    .. but you did give me an idea.. what's the PHP code that opens up the categories on the main page? I can probably take this and use it instead of the regular category code, since the index.php page doesn't request a _GET variable.
    AIM edwardtilbury
    GoogleTalk edwardtilbury

  4. #4
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,023
    Plugin Contributions
    32

    Default Re: Display categories top level on a custom page... How?

    Quote Originally Posted by bunyip View Post
    You shouldn't need to any special coding to show the top-level categories on the main page - what's your setting for Admin > Configuration > Layout Settings > Categories - Always Show on Main Page?
    That's very true.. However, if you are using the main page to create a "splash page", you probably would NOT display the categories there. You may want to create a separate "landing page" with just the top level categories.


    And yes I could create a very separate page and link it to Zen.. Though I've done it once, I prefer not to create a "splash/opening page" outside of Zen Cart. (Makes things messy IMO) So I'll often use the main page to create a "splash/opening page" and the top level category to create a "landing page".


    Like edwardtilbury, I have always used: http://www.yourdomain.com/index.php?...=index&cPath=0 to create this "landing page".


    However both edwardtilbury and I have recently discovered that SEO apps will undo this. Some treat http://www.yourdomain.com/index.php?...=index&cPath=0 as being = to http://www.yourdomain.com/. Which leaves us to seek out another option to achieve the same end result..

    So here's what I did:

    I used the "ZenCart Define Page Generator" application
    (http://www.zen-cart.com/index.php?ma...roducts_id=804)

    Using this tool, I created a defined page called "store_main"

    These are the files the "ZenCart Define Page Generator" application generated:
    includes/extra_datafiles/store_main_filenames.php
    includes/languages/english/extra_definitions/custom_template/store_main.php
    includes/languages/english/html_includes/define_store_main.php
    includes/languages/english/html_includes/custom_template/define_store_main.php
    includes/languages/english/custom_template/store_main.php
    includes/modules/pages/store_main/header_php.php
    includes/templates/custom_template/templates/tpl_store_main_default.php

    I edited the "includes/templates/custom_template/templates/tpl_store_main_default.php" file and just below this code:
    Code:
            <?php
            /**
            * require the html_define for the store_main page
            */
            require($define_page);
            ?>
            </div>
    I added the following:
    Code:
    <?php
    $cat_id=0;
     
        $categories_query = "SELECT c.categories_id, cd.categories_name, c.categories_image, c.parent_id
                              FROM   " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd
                              WHERE      c.parent_id = :parentID
                              AND        c.categories_id = cd.categories_id
                              AND        cd.language_id = :languagesID
                              AND        c.categories_status= '1'
                              ORDER BY   sort_order, cd.categories_name";
      
        $categories_query = $db->bindVars($categories_query, ':parentID', $cat_id, 'integer');
        $categories_query = $db->bindVars($categories_query, ':languagesID', $_SESSION['languages_id'], 'integer');
        $categories = $db->Execute($categories_query);
        $number_of_categories = $categories->RecordCount();
      
     require($template->get_template_dir('tpl_modules_category_row.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_category_row.php');
    ?>
    I uploaded everything to my site, added whatever text I wanted added to the new defined page, and that was it..

    The only other tasks after this were making sure I changed the various menus (I'm using a dropdown menu and a site map in the footer..) and editing the breadcrumbs so that the "Home" link pointed to my new landing page.. Though I'm not using them for the site I am working on now, if I was using EZPages or the navMain links the "home" links would have to be edited as well to point to the new landing page..

    Hope this all makes sense..

    BTW, for anyone who stumbles across this who might ask why this can't be done with an EZ Page.. You can't add PHP code to an EZ Page.

    See this in action:
    http://clients.overthehillweb.com/hairisle/ - Main Page
    http://clients.overthehillweb.com/hairisle/store_main - New Landing Page

    Add top level categories to another page
    Insert top level categories
    Last edited by DivaVocals; 17 Sep 2009 at 10:28 AM.

 

 

Similar Threads

  1. Replies: 4
    Last Post: 1 Jul 2015, 06:51 PM
  2. v150 How to display all products in top level category page
    By vmarty123 in forum General Questions
    Replies: 0
    Last Post: 17 Feb 2014, 03:58 PM
  3. Display top level categories on "custom" page
    By hyperspeed9 in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 1 Mar 2010, 03:51 AM
  4. Display Products and Sub-Categories in Top Level Category Page
    By numinix in forum Templates, Stylesheets, Page Layout
    Replies: 9
    Last Post: 27 Oct 2008, 04:04 AM
  5. Top Level Categories display graphically
    By monkeytown in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 2 Jan 2008, 08:22 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