Re: CSS Dropdown menu for your header- With Categories!
Can I do this on the footer and have the options pop up? Or can I move the header down the page. I would like to have these links be on the bottom of the pages to match my existing website.
Re: CSS Dropdown menu for your header- With Categories!
Quote:
Originally Posted by
timdwyer42
Code:
<?php
class zen_categories_ul_generator {
var $root_category_id = 0,
$max_level = 0,
$data = array(),
$root_start_string = '',
$root_end_string = '',
$parent_start_string = '',
$parent_end_string = '',
$parent_group_start_string = '<ul%s>',
$parent_group_end_string = '</ul>',
$child_start_string = '<li%s>',
$child_end_string = '</li>',
$spacer_string = '
',
$spacer_multiplier = 1;
var $document_types_list = ' (3) ';// acceptable format example: ' (3, 4, 9, 22, 18) '
function zen_categories_ul_generator($load_from_database = true)
{
global $languages_id, $db;
$this->data = array();
$categories_query = "select c.categories_id, cd.categories_name, c.parent_id
from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd
where c.categories_id = cd.categories_id
and c.categories_status=1 " .
" and cd.language_id = '" . (int)$_SESSION['languages_id'] . "' " .
" order by c.parent_id, c.sort_order, cd.categories_name";
$categories = $db->Execute($categories_query);
while (!$categories->EOF) {
$this->data[$categories->fields['parent_id']][$categories->fields['categories_id']] = array('name' => $categories->fields['categories_name'], 'count' => 0);
$categories->MoveNext();
}
}
function buildBranch($parent_id, $level = 1, $submenu=false, $parent_link='') {
if ($parent_id != '0') {
$result = sprintf($this->parent_group_start_string, ($submenu==true) ? ' class="level'. ($level) . '"' : '' );
}
if (($this->data[$parent_id])) {
foreach($this->data[$parent_id] as $category_id => $category) {
$category_link = $parent_link . $category_id;
if (($this->data[$category_id])) {
$result .= sprintf($this->child_start_string, ($submenu==true) ? ' class="submenu"' : '');
} else {
if (($this->data[$category_id]) && ($submenu==false)) {
$result .= sprintf($this->parent_group_start_string, ($submenu==true) ? ' class="level'. ($level+1) . '"' : '');
$result .= sprintf($this->child_start_string, ($submenu==true) ? ' class="submenu"' : '');
} else {
$result .= sprintf($this->child_start_string, '');
}
}
if ($level == 0) {
$result .= $this->root_start_string;
}
$result .= str_repeat($this->spacer_string, $this->spacer_multiplier * level1) . '<a href="' . zen_href_link(FILENAME_DEFAULT, 'cPath=' . $category_link) . '">';
$result .= $category['name'];
$result .= '</a>';
if ($level == 0) {
$result .= $this->root_end_string;
}
if (($this->data[$category_id])) {
$result .= $this->parent_end_string;
}
if (($this->data[$category_id]) && (($this->max_level == '0') || ($this->max_level > $level+1))) {
$result .= $this->buildBranch($category_id, $level+1, $submenu, $category_link . '_');
}
$result .= $this->child_end_string;
}
}
if ($level > 0) {
$result .= $this->parent_group_end_string;
}
return $result;
}
function buildTree($submenu=false)
{
return $this->buildBranch($this->root_category_id, '', $submenu);
}
}
?>
The one thing about the code change is that the link to your subcats from the menu does not dispay the full category path. Just the final subcat and product id which means the normal categories sidebox menu doesn't open. I imagine the code could be changed to get it to open the full path but I havn't figured out how.
I added few things to display the full path on sidebox menu.
it seems to work fine to me but not sure if there is an invisable bug. use it for your own risk.
Re: CSS Dropdown menu for your header- With Categories!
doesn't work on my website...when I upload the tpl_header via ftp it stops working
what's the matter?
thanks
Re: CSS Dropdown menu for your header- With Categories!
what should i change on the CSS if i want to center the text on the top level and shift all text to the left on all sublevel.
Thanks in advance!
Re: CSS Dropdown menu for your header- With Categories!
Can some1 answer me this:
i recently installed the css flyout menu 1.5 and the categories ul generator is being used now by a css click-show-hide sidebox from here:
http://www.zen-cart.com/index.php?ma...roducts_id=872
and now the categories are generated only in the sidebox and not the menu.how can i have them generate in both?:blush:
Re: CSS Dropdown menu for your header- With Categories!
Hi, I have a multiple language site and in one of my languages (dutch) i'd like to add a separate link in the dropdown menu.
I've read in an earlier thread that I can add this line: <li><a href="link_here">Link Name Here</a></li>
to my dropdown menu but how can i only show that link in that particular language and exclude it from all the others?
Is there an exeption i can use or do i need to make somekind of language_stylesheet.css to exclude this link from all other languages?
Your help would be greatly appreciated...
Re: CSS Dropdown menu for your header- With Categories!
Hi,
I successfully implemented the menu and its been working great (i am using 1.3.8 fresh install). I was wondering if there is a way to call EZPAGES into the menu with menu options that generate automatically through the Chapter / TOC relationship.
Read that this was done for 1.3.7, however how does it work in 1.3.8
Thanks and regards,
Sumit
Re: CSS Dropdown menu for your header- With Categories!
I've read through this entire thread twice & I can't find a fix for my problem. I've got this installed on a test site. It works great but I have a huge space above the menu. I'm not sure what to edit in the stylesheet to fix this, I've tried a couple of things mentioned throughout the thread as possibilities but nothing seems to affect it. I don't know where the space is coming from, I have the menu on another site & it's not happening there.
This is the test site
I need the menu up higher to touch the bottom edge of the blue header.
Re: CSS Dropdown menu for your header- With Categories!
Anyone got a clue at all? I've been messing with this for 2 days now, nothing I do seems to affect the vertical position :frusty:
Css flyout menu 1.5 category ul generator
Can some1 answer me this:
i recently installed the css flyout menu 1.5 and the categories ul generator is being used now by a css click-show-hide sidebox from here:
http://www.zen-cart.com/index.php?ma...roducts_id=872
and now the categories are generated only in the sidebox and not the menu.how can i have them generate in both?:blush: