Originally Posted by
bunyip
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
Bookmarks