PDA

View Full Version : How to create a vertical left hand menu



AndrewJohn26
05-16-2011, 07:02 AM
How to create a vertical left hand menu

schwa
05-30-2011, 03:32 AM
Ehh, where do you want to put it?

mtthwsmith8
06-04-2011, 05:21 AM
Note: This guide shows you how to create and style your own left category menu. To use the existing left category menu on all pages, including the home page, remove “<?php if (!Mage::registry(’current_category’)) return ?>” from .../template/catalog/navigation/left.phtml and move
1. <reference name="left">
2. ***** ***** ***** ***** ***** ***** <block type="catalog/navigation" name="catalog.leftnav" after="currency" template="catalog/navigation/left.phtml"/>
3. ***** </reference>

up from the catalog_category_default content into the default content in layout/catalog.xml
1) Create vert_nav.phtml in app / design / frontend / base / default /template / catalog / navigation containing this:
1. <div class="vertical-nav-container box base-mini">
2. <div class="vertical-nav">

3. <!--<div class="head">-->
4. *****
5. <!--<h4>-->
6. <div class="block block-cart">
7. ***** ***** <div class="block-title">
8. ***** ***** ***** ***** <strong><span><?php echo $this->__('Categories') ?></span></strong>
9. </div><!--End block block-cart-->
10. *****
11. *****<div class="block-content">
12. *****<!--</h4>-->
13. <!--</div>--><!--End Of head-->
14. *****
15. <h4 class="no-display">
16. <?php echo $this->__('Category Navigation:') ?></h4>
17. <ul id="nav_vert">
18. <?php foreach ($this->getStoreCategories() as $_category): ?>
19. <?php echo $this->drawItem($_category) ?>
20. <?php endforeach ?> </ul>
21. </div>
22. </div><!--End Of vertical-nav-->
23. *****
24. <?php echo $this->getChildHtml('topLeftLinks') ?>
25. *****
26. </div></div><!--End Of vertical-nav-container box base-mini-->

2) in app / design / frontend / default / modern / layout / catalog.xml
Use this section to include there is no deletion of code just commented out!!
1. <!--
2. Category default layout
3. -->
4. *****
5. ***** ***** <catalog_category_default translate="label">
6. ***** ***** ***** ***** <label>Catalog Category (Non-Anchor)</label>
7. ***** ***** ***** ***** <reference name="root">
8. ***** ***** ***** ***** ***** ***** <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
9. ***** ***** ***** ***** </reference>
10. ***** ***** ***** *****
11. ***** ***** ***** ***** <reference name="left">
12. ***** ***** ***** *****
13. <!--***** <block type="catalog/navigation" name="catalog.leftnav" after="currency" template="catalog/navigation/left.phtml"/>-->
14. ***** ***** *****
15. ***** ***** ***** *****<block type="catalog/navigation" before="-" name="catalog.vertnav" template="catalog/navigation/vert_nav.phtml"/>
16. ***** ***** ***** *****
17. ***** ***** ***** ***** </reference>
.......

mtthwsmith8
06-04-2011, 05:23 AM
3) in skin/frontend/default/modern/css/widgets.css
add the following to the bottom of the css
1. *****
2. /**********************************************Vert ical Nav ****************************************/
3. **********
4. #nav { float:left; margin-top:15px; margin-left:15px; font-size:1.1em; }
5. *****
6. /************** ALL LEVELS***** *************/ /* Style consistent throughout all nav levels */
7. #nav li { position:relative;text-transform:uppercase; text-align:left;***** ***** }
8. #nav li.over { z-index:999; }
9. #nav a,
10. #nav a:hover { display:block; line-height:1.3em; text-decoration:none; }
11. #nav span { display:block; cursor:pointer; white-space:nowrap; }
12. #nav li ul span {white-space:normal; }
13. *****
14. /************ 0 LEVEL***** ***************/
15. #nav li { float:left; margin:1px 8px 11px 1px; padding:3px 8px; }
16. #nav li.active a { color:#444; }
17. #nav a { float:left; background:url(../images/nav_top_level_arrow.gif) no-repeat 100% 50%; padding-right:11px; color:#444; font-weight:bold; }
18. #nav li.over a,
19. #nav a:hover { color:#444; }
20. #nav li.over,
21. #nav li.active { margin:0 7px 10px 0; border:1px solid #bbb; background:#ececec; }
22. *****
23. /************ 1ST LEVEL ************/
24. #nav ul li,
25. #nav ul li.active,
26. #nav ul li.over { float:none; border:none; background:none; margin:0; padding:0; padding-bottom:1px; text-transform:none; }
27. #nav ul li.parent { background:url(../images/nav_parent_arrow.gif) no-repeat 100% 50%; }
28. #nav ul li.last { padding-bottom:0; }
29. #nav ul li.active { margin:0; border:0; background:none; }
30. #nav ul a,
31. #nav ul a:hover { float:none; padding:0; background:none; }
32. #nav ul li a { font-weight:normal !important; }
33. *****
34. /************ 2ND LEVEL ************/
35. #nav ul { position:absolute; width:15em; top:22px; left:-10000px; border:1px solid #bbb; border-bottom:2px solid #999; padding:3px 8px; background:#fcfcfc; font-size:11px; }
36. *****
37. /* Show menu */
38. #nav li.over > ul { left:-1px; }
39. #nav li.over > ul li.over > ul { left:100px; }
40. #nav li.over ul ul { left:-10000px; }
41. *****
42. #nav ul li a { padding:3px 0; color:#444 !important; }
43. #nav ul li a:hover { padding:3px 0; color:#5a7f00 !important; }
44. *****
45. /************ 3RD+ LEVEL ************/
46. #nav ul ul { top:5px; }
47. *****
48. ***** /**********************************************Vert ical Nav ********************************/
49. *****
50. ***** ***** #nav_vert { padding:0 8px; font-size:1em; z-index:999; width:180px; background-color: #F6F6F6; }
51. **********
52. ***** ***** /************** ALL LEVELS *************/ /* Style consistent throughout all nav levels */
53. ********** ***** #nav_vert li {
54. ********** ***** width:200px;
55. ********** ***** list-style:none;
56. ***** position:relative;
57. ***** text-align:left;
58. ***** background-color: #F6F6F6;
59. ***** border-bottom-width: thin;
60. ***** border-bottom-style: solid;
61. ***** border-bottom-color: #CCCCCC;
62. *****}
63. *****
64. ***** ***** #nav_vert li.over { z-index:999; }
65. ***** ***** #nav_vert li.active { z-index:999; } /* to prevent the li separator from showing through on mouseover on li */
66. ***** ***** #nav_vert a { line-height:1.3em; }
67. ***** ***** #nav_vert a, #nav_vert a:hover { display:block; text-decoration:none; }
68. ***** ***** #nav_vert span { display:block; cursor:pointer; color: #000; }
69. *****
70. ***** ***** /************ 1ST LEVEL ***************/
71. ********** #nav_vert li { float:left; background:url(../images/nav_bg.gif) repeat-x 50%; height:30px; margin-right:1px; }
72. ********** #nav_vert li.active a { color:#4c6a16; }
73. ********** #nav_vert a {
74. ********** float:left;
75. ********** padding:5px 12px 6px 8px;
76. ********** color:#4c6a16;
77. ***** font-weight:bold;
78. ***** ***** font-family:Trebuchet MS;
79. ***** ***** font-size:13px;}
80. ***** ***** #nav_vert li.over a, #nav_vert a:hover { color:#CCCCCC; }
81. ***** *****
82. /************ 1ST LEVEL RESET ************/
83. ***** ***** #nav_vert ul li, #nav_vert ul li.active {
84. ********** float:none;
85. ********** height:auto;
86. ********** background:none;
87. ********** margin:0;
88. *****}
89. *****
90. ***** #nav_vert ul a, #nav_vert ul a:hover {
91. ********** float:none;
92. ********** padding:0;
93. ********** background:none;
94. *****}
95. *****
96. ***** #nav_vert ul li a { font-weight:normal !important; }
97. **********
98. ***** /************ 2ND LEVEL ***********/
99. ***** #nav_vert ul {
106 ***** position: absolute;
107 ***** width:200px;
108 ***** margin-left:180px;
109 ***** top:0px;
110 ***** left:-10000px;
111 ***** border:1px solid #666666;
112 ***** }
113 ********** ***** *****
114 *****/* Show menu */
115 *****#nav_vert li.over ul { left:0; }
116 *****#nav_vert li.over ul ul { left:-10000px; }
117 *****#nav_vert li.over ul li.over ul { left:0px; }
118 *****#nav_vert ul li a { background:#FFFFFF/*#ecf3f6*/; }
119 *****#nav_vert ul li a:hover { background: #F2F1D2; /*#d5e4eb;*/ }
120 *****#nav_vert ul li a span { background:url(../images/nav_divider.gif) repeat-x 0 100%; }
121 *****#nav_vert ul li a, #nav_vert ul li a:hover { color:#2f2f2f !important; }
122 *****#nav_vert ul span, #nav_vert ul li.last li span { padding:6px 15px 6px 15px; }
123 *****#nav_vert ul li.last span { background:none; }
124 **********
125 *****/************ 3RD+ LEVEL ************/
126 *****#nav_vert ul ul { top:5px;}
127 *****#nav_vert ul ul ul { left:-10000px;}
128 *****#nav_vert li.over ul li.over ul ul { left:-10000px;}
129 *****#nav_vert li.over ul li.over ul li.over ul { left:100px; }
130 *****
131 *****/* Fix for the IE bug */
132 *****#nav_vert iframe {
133 *****position: absolute;
134 *****left: -1px;
135 *****top: 0;
136 *****z-index: -1;
137 *****filter: progid:DXImageTransform.Microsoft.Alpha(style=0,op acity=0);
138 *****}