RicoNeitzel_VertNav - Version 0.2.3

Version Notes

Add a vertical menu to your site. Features many css classes and several configuration options.

Download this release

Release Info

Developer Magento Core Team
Extension RicoNeitzel_VertNav
Version 0.2.3
Comparing to
See all releases


Code changes from version 0.2.1 to 0.2.3

app/code/community/RicoNeitzel/VertNav/Block/Navigation.php CHANGED
@@ -107,36 +107,36 @@ class RicoNeitzel_VertNav_Block_Navigation extends Mage_Catalog_Block_Navigation
107
*
108
* @param Mage_Model_Catalog_Category $category
109
* @param integer $level
110
- * @param array $class
111
* @return string
112
*/
113
- public function drawOpenCategoryItem($category, $level=0, array $class=null)
114
{
115
- $html = '';
116
117
//if (! $category instanceof Varien_Data_Tree_Node) return $html;
118
119
- if ($this->_checkLoginCatalog()) return $html;
120
121
- if (! $category->getIsActive()) return $html;
122
123
- if (! isset($class)) $class = array();
124
- $classColl = array();
125
126
- $classColl[] = 'level' . $level;
127
if ($this->_isCurrentCategory($category))
128
{
129
- $classColl[] = 'active';
130
}
131
else
132
{
133
- $classColl[] = $this->isCategoryActive($category) ? 'parent' : 'inactive';
134
}
135
- $class[] = implode('-', $classColl);
136
137
- $class = array_merge($class, $classColl);
138
139
- $class[] = $this->_getClassNameFromCategoryName($category);
140
141
$productCount = '';
142
if (Mage::getStoreConfig('catalog/vertnav/display_product_count'))
@@ -145,11 +145,15 @@ class RicoNeitzel_VertNav_Block_Navigation extends Mage_Catalog_Block_Navigation
145
}
146
147
// indent HTML!
148
- $html .= str_pad ( "", ($level * 2 ) + 2, " " ).sprintf('<li class="%s">', implode(" ", $class))."\n";
149
-
150
- $html .= str_pad ( "", (($level * 2 ) + 4), " " ).'<span class="vertnav-cat"><a href="'.$this->getCategoryUrl($category).'"><span>'.$this->htmlEscape($category->getName()).'</span></a>'.$productCount."</span>\n";
151
152
- if (in_array($category->getId(), $this->getCurrentCategoryPath()))
153
{
154
if ($category instanceof Mage_Catalog_Model_Category)
155
{
@@ -185,16 +189,24 @@ class RicoNeitzel_VertNav_Block_Navigation extends Mage_Catalog_Block_Navigation
185
186
if (!empty($htmlChildren))
187
{
188
// indent HTML!
189
- $html.= str_pad ( "", ($level * 2 ) + 2, " " ).'<ul>'."\n"
190
.$htmlChildren."\n".
191
str_pad ( "", ($level * 2 ) + 2, " " ).'</ul>';
192
}
193
}
194
}
195
// indent HTML!
196
- $html.= "\n".str_pad ( "", ($level * 2 ) + 2, " " ).'</li>'."\n";
197
- return $html;
198
}
199
200
/**
107
*
108
* @param Mage_Model_Catalog_Category $category
109
* @param integer $level
110
+ * @param array $levelClass
111
* @return string
112
*/
113
+ public function drawOpenCategoryItem($category, $level=0, array $levelClass=null)
114
{
115
+ $html = array();
116
117
//if (! $category instanceof Varien_Data_Tree_Node) return $html;
118
119
+ if ($this->_checkLoginCatalog()) return '';
120
121
+ if (! $category->getIsActive()) return '';
122
123
+ if (! isset($levelClass)) $levelClass = array();
124
+ $combineClasses = array();
125
126
+ $combineClasses[] = 'level' . $level;
127
if ($this->_isCurrentCategory($category))
128
{
129
+ $combineClasses[] = 'active';
130
}
131
else
132
{
133
+ $combineClasses[] = $this->isCategoryActive($category) ? 'parent' : 'inactive';
134
}
135
+ $levelClass[] = implode('-', $combineClasses);
136
137
+ $levelClass = array_merge($levelClass, $combineClasses);
138
139
+ $levelClass[] = $this->_getClassNameFromCategoryName($category);
140
141
$productCount = '';
142
if (Mage::getStoreConfig('catalog/vertnav/display_product_count'))
145
}
146
147
// indent HTML!
148
+ $html[1] = str_pad ( "", (($level * 2 ) + 4), " " ).'<span class="vertnav-cat"><a href="'.$this->getCategoryUrl($category).'"><span>'.$this->htmlEscape($category->getName()).'</span></a>'.$productCount."</span>\n";
149
150
+ $autoMaxDepth = Mage::getStoreConfig('catalog/vertnav/expand_all_max_depth');
151
+ $autoExpand = Mage::getStoreConfig('catalog/vertnav/expand_all');
152
+
153
+ if (in_array($category->getId(), $this->getCurrentCategoryPath())
154
+ || ($autoExpand && $autoMaxDepth == 0)
155
+ || ($autoExpand && $autoMaxDepth > $level)
156
+ )
157
{
158
if ($category instanceof Mage_Catalog_Model_Category)
159
{
189
190
if (!empty($htmlChildren))
191
{
192
+ $levelClass[] = 'open';
193
+
194
// indent HTML!
195
+ $html[2] = str_pad ( "", ($level * 2 ) + 2, " " ).'<ul>'."\n"
196
.$htmlChildren."\n".
197
str_pad ( "", ($level * 2 ) + 2, " " ).'</ul>';
198
}
199
}
200
}
201
+
202
+ // indent HTML!
203
+ $html[0] = str_pad ( "", ($level * 2 ) + 2, " " ).sprintf('<li class="%s">', implode(" ", $levelClass))."\n";
204
+
205
// indent HTML!
206
+ $html[3] = "\n".str_pad ( "", ($level * 2 ) + 2, " " ).'</li>'."\n";
207
+
208
+ ksort($html);
209
+ return implode('', $html);
210
}
211
212
/**
app/code/community/RicoNeitzel/VertNav/Helper/Data.php ADDED
@@ -0,0 +1,6 @@
1
+ <?php
2
+
3
+ class RicoNeitzel_VertNav_Helper_Data extends Mage_Core_Helper_Data
4
+ {
5
+
6
+ }
app/code/community/RicoNeitzel/VertNav/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
<config>
3
<modules>
4
<RicoNeitzel_VertNav>
5
- <version>0.2.1</version>
6
</RicoNeitzel_VertNav>
7
</modules>
8
@@ -12,6 +12,11 @@
12
<class>RicoNeitzel_VertNav_Block</class>
13
</vertnav>
14
</blocks>
15
</global>
16
<frontend>
17
<layout>
@@ -37,6 +42,8 @@
37
<catalog>
38
<vertnav>
39
<display_product_count>0</display_product_count>
40
</vertnav>
41
</catalog>
42
</default>
2
<config>
3
<modules>
4
<RicoNeitzel_VertNav>
5
+ <version>0.2.3</version>
6
</RicoNeitzel_VertNav>
7
</modules>
8
12
<class>RicoNeitzel_VertNav_Block</class>
13
</vertnav>
14
</blocks>
15
+ <helpers>
16
+ <vertnav>
17
+ <class>RicoNeitzel_VertNav_Helper</class>
18
+ </vertnav>
19
+ </helpers>
20
</global>
21
<frontend>
22
<layout>
42
<catalog>
43
<vertnav>
44
<display_product_count>0</display_product_count>
45
+ <expand_all>0</expand_all>
46
+ <expand_all_max_depth>0</expand_all_max_depth>
47
</vertnav>
48
</catalog>
49
</default>
app/code/community/RicoNeitzel/VertNav/etc/system.xml CHANGED
@@ -3,14 +3,14 @@
3
<sections>
4
<catalog translate="label" module="catalog">
5
<groups>
6
- <vertnav translate="label">
7
<label>Category Vertical Navigation</label>
8
<sort_order>500</sort_order>
9
<show_in_default>1</show_in_default>
10
<show_in_website>1</show_in_website>
11
<show_in_store>1</show_in_store>
12
<fields>
13
- <display_product_count translate="label">
14
<label>Display Product Count</label>
15
<frontend_type>select</frontend_type>
16
<source_model>adminhtml/system_config_source_yesno</source_model>
@@ -19,6 +19,24 @@
19
<show_in_website>1</show_in_website>
20
<show_in_store>1</show_in_store>
21
</display_product_count>
22
</fields>
23
</vertnav>
24
</groups>
3
<sections>
4
<catalog translate="label" module="catalog">
5
<groups>
6
+ <vertnav translate="label" module="vertnav">
7
<label>Category Vertical Navigation</label>
8
<sort_order>500</sort_order>
9
<show_in_default>1</show_in_default>
10
<show_in_website>1</show_in_website>
11
<show_in_store>1</show_in_store>
12
<fields>
13
+ <display_product_count translate="label" module="vertnav">
14
<label>Display Product Count</label>
15
<frontend_type>select</frontend_type>
16
<source_model>adminhtml/system_config_source_yesno</source_model>
19
<show_in_website>1</show_in_website>
20
<show_in_store>1</show_in_store>
21
</display_product_count>
22
+ <expand_all translate="label" module="vertnav">
23
+ <label>Expand all categories</label>
24
+ <frontend_type>select</frontend_type>
25
+ <source_model>adminhtml/system_config_source_yesno</source_model>
26
+ <sort_order>20</sort_order>
27
+ <show_in_default>1</show_in_default>
28
+ <show_in_website>1</show_in_website>
29
+ <show_in_store>1</show_in_store>
30
+ </expand_all>
31
+ <expand_all_max_depth translate="label,comment" module="vertnav">
32
+ <label>Expand all max depth</label>
33
+ <frontend_type>text</frontend_type>
34
+ <sort_order>30</sort_order>
35
+ <show_in_default>1</show_in_default>
36
+ <show_in_website>1</show_in_website>
37
+ <show_in_store>1</show_in_store>
38
+ <comment>Leave empty or set to 0 for no limit</comment>
39
+ </expand_all_max_depth>
40
</fields>
41
</vertnav>
42
</groups>
package.xml CHANGED
@@ -1,18 +1,18 @@
1
<?xml version="1.0"?>
2
<package>
3
<name>RicoNeitzel_VertNav</name>
4
- <version>0.2.1</version>
5
<stability>stable</stability>
6
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
<channel>community</channel>
8
<extends/>
9
<summary>Vertical Navigation - drop in replacement for the horizontal top navigation.</summary>
10
<description>Lots of css selectors available.</description>
11
- <notes>Developed on Magento 1.3, may work on older installations.</notes>
12
<authors><author><name>Vinai Kopp</name><user>auto-converted</user><email>vinai@netzarbeiter.com</email></author></authors>
13
- <date>2009-09-23</date>
14
- <time>10:39:53</time>
15
- <contents><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><file name="vertnav.css" hash="48ed54348eefcc8e1e0286feb84cbe4e"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="vertnav.xml" hash="5835e51670d7bc57d61cfaa486a67c84"/></dir><dir name="template"><dir name="vertnav"><file name="left.phtml" hash="9a4f260c406a632e0d62e00504d686e3"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="RicoNeitzel_VertNav.xml" hash="227d7980c24ebd629e1c1d4f10b8c62c"/></dir></target><target name="magecommunity"><dir name="RicoNeitzel"><dir name="VertNav"><dir name="Block"><file name="Navigation.php" hash="4bc6aae81c47840a0b585f231221b0aa"/></dir><dir name="etc"><file name="config.xml" hash="11d5b8ed2190055f55c3b3b3acd305bc"/><file name="system.xml" hash="fd5ddd20eb6edcbb5f7d77c1701598ef"/></dir></dir></dir></target></contents>
16
<compatible/>
17
<dependencies/>
18
</package>
1
<?xml version="1.0"?>
2
<package>
3
<name>RicoNeitzel_VertNav</name>
4
+ <version>0.2.3</version>
5
<stability>stable</stability>
6
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
<channel>community</channel>
8
<extends/>
9
<summary>Vertical Navigation - drop in replacement for the horizontal top navigation.</summary>
10
<description>Lots of css selectors available.</description>
11
+ <notes>Add a vertical menu to your site. Features many css classes and several configuration options.</notes>
12
<authors><author><name>Vinai Kopp</name><user>auto-converted</user><email>vinai@netzarbeiter.com</email></author></authors>
13
+ <date>2009-09-24</date>
14
+ <time>15:09:13</time>
15
+ <contents><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><file name="vertnav.css" hash="48ed54348eefcc8e1e0286feb84cbe4e"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="vertnav.xml" hash="5835e51670d7bc57d61cfaa486a67c84"/></dir><dir name="template"><dir name="vertnav"><file name="left.phtml" hash="9a4f260c406a632e0d62e00504d686e3"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="RicoNeitzel_VertNav.xml" hash="227d7980c24ebd629e1c1d4f10b8c62c"/></dir></target><target name="magecommunity"><dir name="RicoNeitzel"><dir name="VertNav"><dir name="Block"><file name="Navigation.php" hash="1a8da8668f56e72d57ed8a422642343e"/></dir><dir name="etc"><file name="config.xml" hash="dbd4840ae78b642cbab79bec985f425c"/><file name="system.xml" hash="cc3572e09c725d5813b7fa47b780aee6"/></dir><dir name="Helper"><file name="Data.php" hash="8e340ac22d50a4ac719477a16a16a3e1"/></dir></dir></dir></target></contents>
16
<compatible/>
17
<dependencies/>
18
</package>