Version Notes
~ default values, + jQuery: check exists
Download this release
Release Info
Developer | WebAndPeople |
Extension | wp_custom_menu |
Version | 2.5.7 |
Comparing to | |
See all releases |
Code changes from version 2.5.2 to 2.5.7
- app/code/local/WP/CustomMenu/Block/Navigation.php +3 -8
- app/code/local/WP/CustomMenu/Block/Toggle.php +16 -2
- app/code/local/WP/CustomMenu/Helper/Data.php +112 -1
- app/code/local/WP/CustomMenu/controllers/AjaxmenucontentController.php +10 -0
- app/code/local/WP/CustomMenu/controllers/AjaxmobilemenucontentController.php +10 -0
- app/code/local/WP/CustomMenu/etc/config.xml +16 -4
- app/code/local/WP/CustomMenu/etc/system.xml +31 -0
- app/design/frontend/default/default/template/webandpeople/custommenu/menucontent.phtml +12 -0
- app/design/frontend/default/default/template/webandpeople/custommenu/top.phtml +28 -26
- package.xml +17 -12
- readme.txt +21 -0
- skin/frontend/default/default/js/webandpeople/custommenu/custommenu.js +38 -15
app/code/local/WP/CustomMenu/Block/Navigation.php
CHANGED
@@ -6,11 +6,6 @@ class WP_CustomMenu_Block_Navigation extends Mage_Catalog_Block_Navigation
|
|
6 |
|
7 |
private $_productsCount = null;
|
8 |
|
9 |
-
public function showHomeLink()
|
10 |
-
{
|
11 |
-
return Mage::getStoreConfig('custom_menu/general/show_home_link');
|
12 |
-
}
|
13 |
-
|
14 |
public function drawCustomMenuMobileItem($category, $level = 0, $last = false)
|
15 |
{
|
16 |
if (!$category->getIsActive()) return '';
|
@@ -33,7 +28,7 @@ class WP_CustomMenu_Block_Navigation extends Mage_Catalog_Block_Navigation
|
|
33 |
$html[] = '<span>' . $name . '</span>';
|
34 |
$html[] = '</a>';
|
35 |
if ($hasSubMenu) {
|
36 |
-
$html[] = '<span class="button" rel="submenu-mobile-' . $id . '" onclick="wpSubMenuToggle(this, \'menu-mobile-' . $id . '\', \'submenu-mobile-' . $id . '\');"> 
|
37 |
}
|
38 |
$html[] = '</div>';
|
39 |
// --- Add Popup block (hidden) ---
|
@@ -62,7 +57,7 @@ class WP_CustomMenu_Block_Navigation extends Mage_Catalog_Block_Navigation
|
|
62 |
->addFieldToFilter('is_active', 1);
|
63 |
$blockId = $collection->getFirstItem()->getIdentifier();
|
64 |
#Mage::log($blockId);
|
65 |
-
$blockHtml =
|
66 |
// --- Sub Categories ---
|
67 |
$activeChildren = $this->_getActiveChildren($category, $level);
|
68 |
// --- class for active category ---
|
@@ -134,7 +129,7 @@ class WP_CustomMenu_Block_Navigation extends Mage_Catalog_Block_Navigation
|
|
134 |
$html.= '<div class="parentMenu">';
|
135 |
$html.= '<a class="itemMenuName level' . $level . '" href="' . $this->getCategoryUrl($child) . '"><span>' . $name . '</span></a>';
|
136 |
if (count($activeChildren) > 0) {
|
137 |
-
$html.= '<span class="button" rel="submenu-mobile-' . $id . '" onclick="wpSubMenuToggle(this, \'menu-mobile-' . $id . '\', \'submenu-mobile-' . $id . '\');"> 
|
138 |
}
|
139 |
$html.= '</div>';
|
140 |
if (count($activeChildren) > 0) {
|
6 |
|
7 |
private $_productsCount = null;
|
8 |
|
|
|
|
|
|
|
|
|
|
|
9 |
public function drawCustomMenuMobileItem($category, $level = 0, $last = false)
|
10 |
{
|
11 |
if (!$category->getIsActive()) return '';
|
28 |
$html[] = '<span>' . $name . '</span>';
|
29 |
$html[] = '</a>';
|
30 |
if ($hasSubMenu) {
|
31 |
+
$html[] = '<span class="button" rel="submenu-mobile-' . $id . '" onclick="wpSubMenuToggle(this, \'menu-mobile-' . $id . '\', \'submenu-mobile-' . $id . '\');"> </span>';
|
32 |
}
|
33 |
$html[] = '</div>';
|
34 |
// --- Add Popup block (hidden) ---
|
57 |
->addFieldToFilter('is_active', 1);
|
58 |
$blockId = $collection->getFirstItem()->getIdentifier();
|
59 |
#Mage::log($blockId);
|
60 |
+
$blockHtml = Mage::app()->getLayout()->createBlock('cms/block')->setBlockId($blockId)->toHtml();
|
61 |
// --- Sub Categories ---
|
62 |
$activeChildren = $this->_getActiveChildren($category, $level);
|
63 |
// --- class for active category ---
|
129 |
$html.= '<div class="parentMenu">';
|
130 |
$html.= '<a class="itemMenuName level' . $level . '" href="' . $this->getCategoryUrl($child) . '"><span>' . $name . '</span></a>';
|
131 |
if (count($activeChildren) > 0) {
|
132 |
+
$html.= '<span class="button" rel="submenu-mobile-' . $id . '" onclick="wpSubMenuToggle(this, \'menu-mobile-' . $id . '\', \'submenu-mobile-' . $id . '\');"> </span>';
|
133 |
}
|
134 |
$html.= '</div>';
|
135 |
if (count($activeChildren) > 0) {
|
app/code/local/WP/CustomMenu/Block/Toggle.php
CHANGED
@@ -8,12 +8,26 @@ class WP_CustomMenu_Block_Toggle extends Mage_Core_Block_Template
|
|
8 |
if (Mage::getStoreConfig('custom_menu/general/ie6_ignore') && Mage::helper('custommenu')->isIE6()) return;
|
9 |
$layout = $this->getLayout();
|
10 |
$topnav = $layout->getBlock('catalog.topnav');
|
11 |
-
if (is_object($topnav))
|
12 |
-
{
|
13 |
$topnav->setTemplate('webandpeople/custommenu/top.phtml');
|
14 |
$head = $layout->getBlock('head');
|
15 |
$head->addItem('skin_js', 'js/webandpeople/custommenu/custommenu.js');
|
16 |
$head->addItem('skin_css', 'css/webandpeople/custommenu/custommenu.css');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
}
|
18 |
}
|
19 |
}
|
8 |
if (Mage::getStoreConfig('custom_menu/general/ie6_ignore') && Mage::helper('custommenu')->isIE6()) return;
|
9 |
$layout = $this->getLayout();
|
10 |
$topnav = $layout->getBlock('catalog.topnav');
|
11 |
+
if (is_object($topnav)) {
|
|
|
12 |
$topnav->setTemplate('webandpeople/custommenu/top.phtml');
|
13 |
$head = $layout->getBlock('head');
|
14 |
$head->addItem('skin_js', 'js/webandpeople/custommenu/custommenu.js');
|
15 |
$head->addItem('skin_css', 'css/webandpeople/custommenu/custommenu.css');
|
16 |
+
// --- Insert menu content ---
|
17 |
+
if (!Mage::getStoreConfig('custom_menu/general/ajax_load_content')) {
|
18 |
+
$menuContent = $layout->getBlock('custommenu-content');
|
19 |
+
if (!is_object($menuContent)) {
|
20 |
+
$menuContent = $layout->createBlock('core/template', 'custommenu-content')
|
21 |
+
->setTemplate('webandpeople/custommenu/menucontent.phtml');
|
22 |
+
}
|
23 |
+
if (Mage::getStoreConfig('custom_menu/general/move_code_to_bottom')) {
|
24 |
+
$positionTargetName = 'before_body_end';
|
25 |
+
} else {
|
26 |
+
$positionTargetName = 'content';
|
27 |
+
}
|
28 |
+
$positionTarget = $layout->getBlock($positionTargetName);
|
29 |
+
if (is_object($positionTarget)) $positionTarget->append($menuContent);
|
30 |
+
}
|
31 |
}
|
32 |
}
|
33 |
}
|
app/code/local/WP/CustomMenu/Helper/Data.php
CHANGED
@@ -2,6 +2,8 @@
|
|
2 |
|
3 |
class WP_CustomMenu_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
{
|
|
|
|
|
5 |
public function isIE6()
|
6 |
{
|
7 |
if (!isset($_SERVER['HTTP_USER_AGENT'])) return;
|
@@ -9,7 +11,116 @@ class WP_CustomMenu_Helper_Data extends Mage_Core_Helper_Abstract
|
|
9 |
preg_match('/MSIE ([0-9]{1,}[\.0-9]{0,})/', $userAgent, $matches);
|
10 |
if (!isset($matches[1])) return;
|
11 |
$version = floatval($matches[1]); #Mage::log($version);
|
12 |
-
$flag = false; if(
|
13 |
return $flag;
|
14 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
}
|
2 |
|
3 |
class WP_CustomMenu_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
{
|
5 |
+
private $_menuData = null;
|
6 |
+
|
7 |
public function isIE6()
|
8 |
{
|
9 |
if (!isset($_SERVER['HTTP_USER_AGENT'])) return;
|
11 |
preg_match('/MSIE ([0-9]{1,}[\.0-9]{0,})/', $userAgent, $matches);
|
12 |
if (!isset($matches[1])) return;
|
13 |
$version = floatval($matches[1]); #Mage::log($version);
|
14 |
+
$flag = false; if ($version <= 6.0) $flag = true;
|
15 |
return $flag;
|
16 |
}
|
17 |
+
|
18 |
+
public function getMenuData()
|
19 |
+
{
|
20 |
+
if (!is_null($this->_menuData)) return $this->_menuData;
|
21 |
+
|
22 |
+
$blockClassName = Mage::getConfig()->getBlockClassName('custommenu/navigation');
|
23 |
+
$block = new $blockClassName();
|
24 |
+
|
25 |
+
$categories = $block->getStoreCategories();
|
26 |
+
if (is_object($categories)) $categories = $block->getStoreCategories()->getNodes();
|
27 |
+
|
28 |
+
if (Mage::getStoreConfig('custom_menu/general/ajax_load_content')) {
|
29 |
+
$_moblieMenuAjaxUrl = str_replace('http:', '', Mage::getUrl('custommenu/ajaxmobilemenucontent'));
|
30 |
+
$_menuAjaxUrl = str_replace('http:', '', Mage::getUrl('custommenu/ajaxmenucontent'));
|
31 |
+
} else {
|
32 |
+
$_moblieMenuAjaxUrl = '';
|
33 |
+
$_menuAjaxUrl = '';
|
34 |
+
}
|
35 |
+
|
36 |
+
$this->_menuData = array(
|
37 |
+
'_block' => $block,
|
38 |
+
'_categories' => $categories,
|
39 |
+
'_moblieMenuAjaxUrl' => $_moblieMenuAjaxUrl,
|
40 |
+
'_menuAjaxUrl' => $_menuAjaxUrl,
|
41 |
+
'_showHomeLink' => Mage::getStoreConfig('custom_menu/general/show_home_link'),
|
42 |
+
'_popupWidth' => Mage::getStoreConfig('custom_menu/popup/width') + 0,
|
43 |
+
'_popupTopOffset' => Mage::getStoreConfig('custom_menu/popup/top_offset') + 0,
|
44 |
+
'_popupDelayBeforeDisplaying' => Mage::getStoreConfig('custom_menu/popup/delay_displaying') + 0,
|
45 |
+
'_popupDelayBeforeHiding' => Mage::getStoreConfig('custom_menu/popup/delay_hiding') + 0,
|
46 |
+
'_rtl' => Mage::getStoreConfig('custom_menu/general/rtl') + 0,
|
47 |
+
'_mobileMenuEnabled' => Mage::getStoreConfig('custom_menu/general/mobile_menu') + 0,
|
48 |
+
);
|
49 |
+
|
50 |
+
return $this->_menuData;
|
51 |
+
}
|
52 |
+
|
53 |
+
public function getMobileMenuContent()
|
54 |
+
{
|
55 |
+
$menuData = Mage::helper('custommenu')->getMenuData();
|
56 |
+
extract($menuData);
|
57 |
+
// --- Home Link ---
|
58 |
+
$homeLinkUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
59 |
+
$homeLinkText = $this->__('Home');
|
60 |
+
$homeLink = '';
|
61 |
+
if ($_showHomeLink) {
|
62 |
+
$homeLink = <<<HTML
|
63 |
+
<div id="menu-mobile-0" class="menu-mobile level0">
|
64 |
+
<div class="parentMenu">
|
65 |
+
<a href="$homeLinkUrl">
|
66 |
+
<span>$homeLinkText</span>
|
67 |
+
</a>
|
68 |
+
</div>
|
69 |
+
</div>
|
70 |
+
HTML;
|
71 |
+
}
|
72 |
+
// --- Menu Content ---
|
73 |
+
$mobileMenuContent = '';
|
74 |
+
$mobileMenuContentArray = array();
|
75 |
+
foreach ($_categories as $_category) {
|
76 |
+
$mobileMenuContentArray[] = $_block->drawCustomMenuMobileItem($_category);
|
77 |
+
}
|
78 |
+
if (count($mobileMenuContentArray)) {
|
79 |
+
$mobileMenuContent = implode("\n", $mobileMenuContentArray);
|
80 |
+
}
|
81 |
+
// --- Result ---
|
82 |
+
$menu = <<<HTML
|
83 |
+
$homeLink
|
84 |
+
$mobileMenuContent
|
85 |
+
<div class="clearBoth"></div>
|
86 |
+
HTML;
|
87 |
+
return $menu;
|
88 |
+
}
|
89 |
+
|
90 |
+
public function getMenuContent()
|
91 |
+
{
|
92 |
+
$menuData = Mage::helper('custommenu')->getMenuData();
|
93 |
+
extract($menuData);
|
94 |
+
// --- Home Link ---
|
95 |
+
$homeLinkUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
96 |
+
$homeLinkText = $this->__('Home');
|
97 |
+
$homeLink = '';
|
98 |
+
if ($_showHomeLink) {
|
99 |
+
$homeLink = <<<HTML
|
100 |
+
<div class="menu">
|
101 |
+
<div class="parentMenu menu0">
|
102 |
+
<a href="$homeLinkUrl">
|
103 |
+
<span>$homeLinkText</span>
|
104 |
+
</a>
|
105 |
+
</div>
|
106 |
+
</div>
|
107 |
+
HTML;
|
108 |
+
}
|
109 |
+
// --- Menu Content ---
|
110 |
+
$menuContent = '';
|
111 |
+
$menuContentArray = array();
|
112 |
+
foreach ($_categories as $_category) {
|
113 |
+
$menuContentArray[] = $_block->drawCustomMenuItem($_category);
|
114 |
+
}
|
115 |
+
if (count($menuContentArray)) {
|
116 |
+
$menuContent = implode("\n", $menuContentArray);
|
117 |
+
}
|
118 |
+
// --- Result ---
|
119 |
+
$menu = <<<HTML
|
120 |
+
$homeLink
|
121 |
+
$menuContent
|
122 |
+
<div class="clearBoth"></div>
|
123 |
+
HTML;
|
124 |
+
return $menu;
|
125 |
+
}
|
126 |
}
|
app/code/local/WP/CustomMenu/controllers/AjaxmenucontentController.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WP_CustomMenu_AjaxmenucontentController extends Mage_Core_Controller_Front_Action
|
4 |
+
{
|
5 |
+
public function indexAction()
|
6 |
+
{
|
7 |
+
$menu = Mage::helper('custommenu')->getMenuContent();
|
8 |
+
$this->getResponse()->setBody($menu);
|
9 |
+
}
|
10 |
+
}
|
app/code/local/WP/CustomMenu/controllers/AjaxmobilemenucontentController.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WP_CustomMenu_AjaxmobilemenucontentController extends Mage_Core_Controller_Front_Action
|
4 |
+
{
|
5 |
+
public function indexAction()
|
6 |
+
{
|
7 |
+
$menu = Mage::helper('custommenu')->getMobileMenuContent();
|
8 |
+
$this->getResponse()->setBody($menu);
|
9 |
+
}
|
10 |
+
}
|
app/code/local/WP/CustomMenu/etc/config.xml
CHANGED
@@ -2,10 +2,19 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<WP_CustomMenu>
|
5 |
-
<version>2.5.
|
6 |
</WP_CustomMenu>
|
7 |
</modules>
|
8 |
<frontend>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
<layout>
|
10 |
<updates>
|
11 |
<custommenu>
|
@@ -67,13 +76,16 @@
|
|
67 |
<custom_menu>
|
68 |
<general>
|
69 |
<enabled>1</enabled>
|
|
|
|
|
|
|
70 |
<display_empty_categories>1</display_empty_categories>
|
71 |
<max_level>3</max_level>
|
72 |
<show_home_link>1</show_home_link>
|
73 |
<non_breaking_space>0</non_breaking_space>
|
74 |
<ie6_ignore>1</ie6_ignore>
|
75 |
<rtl>0</rtl>
|
76 |
-
<version>2.5.
|
77 |
</general>
|
78 |
<columns>
|
79 |
<count>3</count>
|
@@ -83,8 +95,8 @@
|
|
83 |
<popup>
|
84 |
<width>0</width>
|
85 |
<top_offset>0</top_offset>
|
86 |
-
<delay_displaying>
|
87 |
-
<delay_hiding>
|
88 |
</popup>
|
89 |
</custom_menu>
|
90 |
</default>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<WP_CustomMenu>
|
5 |
+
<version>2.5.7</version>
|
6 |
</WP_CustomMenu>
|
7 |
</modules>
|
8 |
<frontend>
|
9 |
+
<routers>
|
10 |
+
<custommenu>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<frontName>custommenu</frontName>
|
14 |
+
<module>WP_CustomMenu</module>
|
15 |
+
</args>
|
16 |
+
</custommenu>
|
17 |
+
</routers>
|
18 |
<layout>
|
19 |
<updates>
|
20 |
<custommenu>
|
76 |
<custom_menu>
|
77 |
<general>
|
78 |
<enabled>1</enabled>
|
79 |
+
<ajax_load_content>0</ajax_load_content>
|
80 |
+
<move_code_to_bottom>0</move_code_to_bottom>
|
81 |
+
<mobile_menu>1</mobile_menu>
|
82 |
<display_empty_categories>1</display_empty_categories>
|
83 |
<max_level>3</max_level>
|
84 |
<show_home_link>1</show_home_link>
|
85 |
<non_breaking_space>0</non_breaking_space>
|
86 |
<ie6_ignore>1</ie6_ignore>
|
87 |
<rtl>0</rtl>
|
88 |
+
<version>2.5.7</version>
|
89 |
</general>
|
90 |
<columns>
|
91 |
<count>3</count>
|
95 |
<popup>
|
96 |
<width>0</width>
|
97 |
<top_offset>0</top_offset>
|
98 |
+
<delay_displaying>150</delay_displaying>
|
99 |
+
<delay_hiding>100</delay_hiding>
|
100 |
</popup>
|
101 |
</custom_menu>
|
102 |
</default>
|
app/code/local/WP/CustomMenu/etc/system.xml
CHANGED
@@ -34,6 +34,37 @@
|
|
34 |
<show_in_website>1</show_in_website>
|
35 |
<show_in_store>1</show_in_store>
|
36 |
</enabled>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
<display_empty_categories translate="label comment">
|
38 |
<label>Display empty categories</label>
|
39 |
<comment><![CDATA[An empty category is a category that has no products]]></comment>
|
34 |
<show_in_website>1</show_in_website>
|
35 |
<show_in_store>1</show_in_store>
|
36 |
</enabled>
|
37 |
+
<ajax_load_content translate="label comment">
|
38 |
+
<label>Load content through ajax</label>
|
39 |
+
<frontend_type>select</frontend_type>
|
40 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
41 |
+
<sort_order>2</sort_order>
|
42 |
+
<show_in_default>1</show_in_default>
|
43 |
+
<show_in_website>1</show_in_website>
|
44 |
+
<show_in_store>1</show_in_store>
|
45 |
+
</ajax_load_content>
|
46 |
+
<move_code_to_bottom translate="label">
|
47 |
+
<label>Move content to the bottom</label>
|
48 |
+
<comment>Move the menu source code to the bottom of a page</comment>
|
49 |
+
<frontend_type>select</frontend_type>
|
50 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
51 |
+
<sort_order>3</sort_order>
|
52 |
+
<show_in_default>1</show_in_default>
|
53 |
+
<show_in_website>1</show_in_website>
|
54 |
+
<show_in_store>1</show_in_store>
|
55 |
+
<depends>
|
56 |
+
<ajax_load_content>0</ajax_load_content>
|
57 |
+
</depends>
|
58 |
+
</move_code_to_bottom>
|
59 |
+
<mobile_menu translate="label comment">
|
60 |
+
<label>Mobile menu</label>
|
61 |
+
<frontend_type>select</frontend_type>
|
62 |
+
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
63 |
+
<sort_order>4</sort_order>
|
64 |
+
<show_in_default>1</show_in_default>
|
65 |
+
<show_in_website>1</show_in_website>
|
66 |
+
<show_in_store>1</show_in_store>
|
67 |
+
</mobile_menu>
|
68 |
<display_empty_categories translate="label comment">
|
69 |
<label>Display empty categories</label>
|
70 |
<comment><![CDATA[An empty category is a category that has no products]]></comment>
|
app/design/frontend/default/default/template/webandpeople/custommenu/menucontent.phtml
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $menuContent = Mage::helper('custommenu')->getMenuContent(); ?>
|
2 |
+
<script type="text/javascript">
|
3 |
+
//<![CDATA[
|
4 |
+
if ($('custommenu')) $('custommenu').update(<?php echo Zend_Json::encode($menuContent); ?>);
|
5 |
+
//]]>
|
6 |
+
</script>
|
7 |
+
<?php $mobileMenuContent = Mage::helper('custommenu')->getMobileMenuContent(); ?>
|
8 |
+
<script type="text/javascript">
|
9 |
+
//<![CDATA[
|
10 |
+
if ($('menu-content')) $('menu-content').update(<?php echo Zend_Json::encode($mobileMenuContent); ?>);
|
11 |
+
//]]>
|
12 |
+
</script>
|
app/design/frontend/default/default/template/webandpeople/custommenu/top.phtml
CHANGED
@@ -1,57 +1,59 @@
|
|
1 |
-
<?php
|
2 |
-
$_rtl = Mage::getStoreConfig('custom_menu/general/rtl') + 0;
|
3 |
-
$_categories = $this->getStoreCategories();
|
4 |
-
if (is_object($_categories)) $_categories = $this->getStoreCategories()->getNodes();
|
5 |
-
?>
|
6 |
<div class="nav-container">
|
7 |
-
<div id="custommenu" class="<?php echo $_rtl ? ' rtl' : ''; ?>">
|
8 |
-
<?php if ($this->showHomeLink()) : ?>
|
9 |
<div class="menu">
|
10 |
<div class="parentMenu menu0">
|
11 |
-
<a href="
|
12 |
-
<span><?php echo $this->__('
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
</a>
|
14 |
</div>
|
15 |
</div>
|
16 |
-
<?php endif ?>
|
17 |
-
<?php foreach ($_categories as $_category): ?>
|
18 |
-
<?php echo $this->drawCustomMenuItem($_category) ?>
|
19 |
-
<?php endforeach ?>
|
20 |
<div class="clearBoth"></div>
|
21 |
</div>
|
22 |
<div id="custommenu-mobile" class="<?php echo $_rtl ? ' rtl' : ''; ?>" style="display:none;">
|
23 |
<div id="menu-button" onclick="wpMenuButtonToggle()">
|
24 |
<a href="javascript:void(0);">
|
25 |
-
<span
|
26 |
</a>
|
27 |
</div>
|
28 |
<div id="menu-content" style="display:none;">
|
29 |
-
|
30 |
-
<div id="menu-mobile-0" class="menu-mobile level0">
|
31 |
<div class="parentMenu">
|
32 |
-
<a href="
|
33 |
-
<span><?php echo $this->__('
|
34 |
</a>
|
35 |
</div>
|
36 |
</div>
|
37 |
-
<?php endif ?>
|
38 |
-
<?php foreach ($_categories as $_category): ?>
|
39 |
-
<?php echo $this->drawCustomMenuMobileItem($_category) ?>
|
40 |
-
<?php endforeach ?>
|
41 |
<div class="clearBoth"></div>
|
42 |
</div>
|
43 |
</div>
|
44 |
</div>
|
45 |
<script type="text/javascript">
|
46 |
//<![CDATA[
|
47 |
-
var CUSTOMMENU_POPUP_WIDTH = <?php echo
|
48 |
-
var CUSTOMMENU_POPUP_TOP_OFFSET = <?php echo
|
49 |
-
var CUSTOMMENU_POPUP_DELAY_BEFORE_DISPLAYING = <?php echo
|
50 |
-
var CUSTOMMENU_POPUP_DELAY_BEFORE_HIDING = <?php echo
|
51 |
var CUSTOMMENU_RTL_MODE = <?php echo $_rtl; ?>;
|
52 |
var wpCustommenuTimerShow = {};
|
53 |
var wpCustommenuTimerHide = {};
|
54 |
var wpActiveMenu = null;
|
|
|
|
|
|
|
55 |
wpCustomMenuMobileToggle();
|
|
|
|
|
|
|
56 |
//]]>
|
57 |
</script>
|
1 |
+
<?php $menuData = Mage::helper('custommenu')->getMenuData(); extract($menuData); ?>
|
|
|
|
|
|
|
|
|
2 |
<div class="nav-container">
|
3 |
+
<div id="custommenu-loading" class="<?php echo $_rtl ? ' rtl' : ''; ?>">
|
|
|
4 |
<div class="menu">
|
5 |
<div class="parentMenu menu0">
|
6 |
+
<a href="javascript:;">
|
7 |
+
<span><?php echo $this->__('Loading...'); ?></span>
|
8 |
+
</a>
|
9 |
+
</div>
|
10 |
+
</div>
|
11 |
+
<div class="clearBoth"></div>
|
12 |
+
</div>
|
13 |
+
<div id="custommenu" class="<?php echo $_rtl ? ' rtl' : ''; ?>" style="display:none;">
|
14 |
+
<div class="menu">
|
15 |
+
<div class="parentMenu menu0">
|
16 |
+
<a href="javascript:;">
|
17 |
+
<span><?php echo $this->__('Loading...'); ?></span>
|
18 |
</a>
|
19 |
</div>
|
20 |
</div>
|
|
|
|
|
|
|
|
|
21 |
<div class="clearBoth"></div>
|
22 |
</div>
|
23 |
<div id="custommenu-mobile" class="<?php echo $_rtl ? ' rtl' : ''; ?>" style="display:none;">
|
24 |
<div id="menu-button" onclick="wpMenuButtonToggle()">
|
25 |
<a href="javascript:void(0);">
|
26 |
+
<span><?php echo $this->__('Menu'); ?></span>
|
27 |
</a>
|
28 |
</div>
|
29 |
<div id="menu-content" style="display:none;">
|
30 |
+
<div id="menu-mobile-loading" class="menu-mobile level0">
|
|
|
31 |
<div class="parentMenu">
|
32 |
+
<a href="javascript:;">
|
33 |
+
<span><?php echo $this->__('Loading...'); ?></span>
|
34 |
</a>
|
35 |
</div>
|
36 |
</div>
|
|
|
|
|
|
|
|
|
37 |
<div class="clearBoth"></div>
|
38 |
</div>
|
39 |
</div>
|
40 |
</div>
|
41 |
<script type="text/javascript">
|
42 |
//<![CDATA[
|
43 |
+
var CUSTOMMENU_POPUP_WIDTH = <?php echo $_popupWidth; ?>;
|
44 |
+
var CUSTOMMENU_POPUP_TOP_OFFSET = <?php echo $_popupTopOffset; ?>;
|
45 |
+
var CUSTOMMENU_POPUP_DELAY_BEFORE_DISPLAYING = <?php echo $_popupDelayBeforeDisplaying; ?>;
|
46 |
+
var CUSTOMMENU_POPUP_DELAY_BEFORE_HIDING = <?php echo $_popupDelayBeforeHiding; ?>;
|
47 |
var CUSTOMMENU_RTL_MODE = <?php echo $_rtl; ?>;
|
48 |
var wpCustommenuTimerShow = {};
|
49 |
var wpCustommenuTimerHide = {};
|
50 |
var wpActiveMenu = null;
|
51 |
+
var wpMobileMenuEnabled = <?php echo $_mobileMenuEnabled; ?>;
|
52 |
+
var wpMenuAjaxUrl = '<?php echo $_menuAjaxUrl; ?>';
|
53 |
+
var wpMoblieMenuAjaxUrl = '<?php echo $_moblieMenuAjaxUrl; ?>';
|
54 |
wpCustomMenuMobileToggle();
|
55 |
+
Event.observe(window, 'resize', function() {
|
56 |
+
wpCustomMenuMobileToggle();
|
57 |
+
});
|
58 |
//]]>
|
59 |
</script>
|
package.xml
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<package>
|
3 |
<name>wp_custom_menu</name>
|
4 |
-
<version>2.5.
|
5 |
<stability>stable</stability>
|
6 |
-
<license uri="http://
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Magento Extension - Magento Custom Menu (Web-Experiment.Info)</summary>
|
10 |
<description>Magento Extension - Magento Custom Menu (Web-Experiment.Info)</description>
|
11 |
-
<notes
|
12 |
<authors>
|
13 |
<author>
|
14 |
<name>WebAndPeople</name>
|
@@ -21,8 +21,8 @@
|
|
21 |
<email>y.gerassimenko@webandpeople.com</email>
|
22 |
</author>
|
23 |
</authors>
|
24 |
-
<date>
|
25 |
-
<time>
|
26 |
<contents>
|
27 |
<target name="mageweb">
|
28 |
<dir name="app">
|
@@ -32,16 +32,20 @@
|
|
32 |
<dir name="CustomMenu">
|
33 |
<dir name="Block">
|
34 |
<file name="About.php" hash="c7770064d9bbd15f841b8f8d65aafe19"/>
|
35 |
-
<file name="Navigation.php" hash="
|
36 |
-
<file name="Toggle.php" hash="
|
37 |
<file name="Topmenu.php" hash="7102b3bf0473dc5ecb0d66c12bfc6a95"/>
|
38 |
</dir>
|
39 |
<dir name="Helper">
|
40 |
-
<file name="Data.php" hash="
|
|
|
|
|
|
|
|
|
41 |
</dir>
|
42 |
<dir name="etc">
|
43 |
-
<file name="config.xml" hash="
|
44 |
-
<file name="system.xml" hash="
|
45 |
</dir>
|
46 |
</dir>
|
47 |
</dir>
|
@@ -59,7 +63,8 @@
|
|
59 |
<dir name="template">
|
60 |
<dir name="webandpeople">
|
61 |
<dir name="custommenu">
|
62 |
-
<file name="
|
|
|
63 |
</dir>
|
64 |
</dir>
|
65 |
</dir>
|
@@ -87,7 +92,7 @@
|
|
87 |
<dir name="js">
|
88 |
<dir name="webandpeople">
|
89 |
<dir name="custommenu">
|
90 |
-
<file name="custommenu.js" hash="
|
91 |
</dir>
|
92 |
</dir>
|
93 |
</dir>
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<package>
|
3 |
<name>wp_custom_menu</name>
|
4 |
+
<version>2.5.7</version>
|
5 |
<stability>stable</stability>
|
6 |
+
<license uri="http://web-experiment.info/regular_free_license">Web-Experiment.Info Regular Free License</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Magento Extension - Magento Custom Menu (Web-Experiment.Info)</summary>
|
10 |
<description>Magento Extension - Magento Custom Menu (Web-Experiment.Info)</description>
|
11 |
+
<notes>~ default values, + jQuery: check exists</notes>
|
12 |
<authors>
|
13 |
<author>
|
14 |
<name>WebAndPeople</name>
|
21 |
<email>y.gerassimenko@webandpeople.com</email>
|
22 |
</author>
|
23 |
</authors>
|
24 |
+
<date>2014-01-23</date>
|
25 |
+
<time>13:04:28</time>
|
26 |
<contents>
|
27 |
<target name="mageweb">
|
28 |
<dir name="app">
|
32 |
<dir name="CustomMenu">
|
33 |
<dir name="Block">
|
34 |
<file name="About.php" hash="c7770064d9bbd15f841b8f8d65aafe19"/>
|
35 |
+
<file name="Navigation.php" hash="87be6224e66862e0562d30977277503c"/>
|
36 |
+
<file name="Toggle.php" hash="c0e3299c7ce19041edb481ff09ab22c7"/>
|
37 |
<file name="Topmenu.php" hash="7102b3bf0473dc5ecb0d66c12bfc6a95"/>
|
38 |
</dir>
|
39 |
<dir name="Helper">
|
40 |
+
<file name="Data.php" hash="3fc8215a159463e064f9673e6b9c6a7b"/>
|
41 |
+
</dir>
|
42 |
+
<dir name="controllers">
|
43 |
+
<file name="AjaxmenucontentController.php" hash="7e4b0f04147ede2a9405181e1056fd19"/>
|
44 |
+
<file name="AjaxmobilemenucontentController.php" hash="7b1690de9885838fb6f483136eed3a06"/>
|
45 |
</dir>
|
46 |
<dir name="etc">
|
47 |
+
<file name="config.xml" hash="cb9f2e0bb3f6e822f7bb7c88887802fd"/>
|
48 |
+
<file name="system.xml" hash="64cafadbaacd02165a008a83a4223bb1"/>
|
49 |
</dir>
|
50 |
</dir>
|
51 |
</dir>
|
63 |
<dir name="template">
|
64 |
<dir name="webandpeople">
|
65 |
<dir name="custommenu">
|
66 |
+
<file name="menucontent.phtml" hash="c6aacc6cd49e638f08e90803183fed7b"/>
|
67 |
+
<file name="top.phtml" hash="e57f1dc563d8cd5c7bfd39bdf58afd50"/>
|
68 |
</dir>
|
69 |
</dir>
|
70 |
</dir>
|
92 |
<dir name="js">
|
93 |
<dir name="webandpeople">
|
94 |
<dir name="custommenu">
|
95 |
+
<file name="custommenu.js" hash="f3a0fc60503e5db502d0e34f7d72c665"/>
|
96 |
</dir>
|
97 |
</dir>
|
98 |
</dir>
|
readme.txt
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
----------------------------------------------------------------------
|
2 |
+
Magento Extension - Magento Custom Menu (Web-Experiment.Info)
|
3 |
+
----------------------------------------------------------------------
|
4 |
+
Thank you for choosing the Web-Experiment Magento extension.
|
5 |
+
|
6 |
+
INSTALLATION GUIDE
|
7 |
+
Please find the installation guide here:
|
8 |
+
http://web-experiment.info/articles/cat/custom_menu/
|
9 |
+
|
10 |
+
SUPPORT
|
11 |
+
If you have any questions, please feel free to email us via our support form here:
|
12 |
+
http://web-experiment.info/support
|
13 |
+
|
14 |
+
LICENSING
|
15 |
+
This extension is licensed under a Regular Free License:
|
16 |
+
http://web-experiment.info/regular_free_license
|
17 |
+
You must not incorporate the Extension in a work which is created for Sale or Redistribute for free by you or your client.
|
18 |
+
You may use the Extension in a work which you are creating for your own purposes or for your client who has asked you to create it.
|
19 |
+
|
20 |
+
|
21 |
+
|
skin/frontend/default/default/js/webandpeople/custommenu/custommenu.js
CHANGED
@@ -33,10 +33,13 @@ function wpShowMenuPopup(objMenu, event, popupId)
|
|
33 |
}
|
34 |
// --- change href ---
|
35 |
var wpMenuAnchor = $(objMenu.select('a')[0]);
|
36 |
-
wpChangeTopMenuHref(wpMenuAnchor);
|
37 |
// --- show popup ---
|
38 |
-
|
39 |
-
|
|
|
|
|
|
|
40 |
}, CUSTOMMENU_POPUP_DELAY_BEFORE_DISPLAYING);
|
41 |
}
|
42 |
}
|
@@ -54,10 +57,13 @@ function wpHideMenuPopup(element, event, popupId, menuId)
|
|
54 |
objMenu.removeClassName('active');
|
55 |
// --- change href ---
|
56 |
var wpMenuAnchor = $(objMenu.select('a')[0]);
|
57 |
-
wpChangeTopMenuHref(wpMenuAnchor);
|
58 |
// --- hide popup ---
|
59 |
-
|
60 |
-
|
|
|
|
|
|
|
61 |
}, CUSTOMMENU_POPUP_DELAY_BEFORE_HIDING);
|
62 |
}
|
63 |
}
|
@@ -96,11 +102,13 @@ function wpPopupPos(objMenu, w)
|
|
96 |
return res;
|
97 |
}
|
98 |
|
99 |
-
function wpChangeTopMenuHref(wpMenuAnchor)
|
100 |
{
|
101 |
-
|
102 |
-
|
103 |
-
|
|
|
|
|
104 |
}
|
105 |
|
106 |
function wpIsChildOf(parent, child)
|
@@ -204,19 +212,34 @@ function wpCustomMenuMobileToggle()
|
|
204 |
g = d.getElementsByTagName('body')[0],
|
205 |
x = w.innerWidth || e.clientWidth || g.clientWidth,
|
206 |
y = w.innerHeight|| e.clientHeight|| g.clientHeight;
|
207 |
-
|
|
|
208 |
$('custommenu').hide();
|
209 |
$('custommenu-mobile').show();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
210 |
} else {
|
211 |
$('custommenu-mobile').hide();
|
212 |
wpResetMobileMenuState();
|
213 |
$('custommenu').show();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
214 |
}
|
215 |
-
}
|
216 |
|
217 |
-
|
218 |
-
|
219 |
-
});
|
220 |
|
221 |
var wpIsMobile = {
|
222 |
Android: function() {
|
33 |
}
|
34 |
// --- change href ---
|
35 |
var wpMenuAnchor = $(objMenu.select('a')[0]);
|
36 |
+
wpChangeTopMenuHref(wpMenuAnchor, true);
|
37 |
// --- show popup ---
|
38 |
+
if (typeof jQuery == 'undefined') {
|
39 |
+
popup.style.display = 'block';
|
40 |
+
} else {
|
41 |
+
jQuery('#' + popupId).stop(true, true).fadeIn();
|
42 |
+
}
|
43 |
}, CUSTOMMENU_POPUP_DELAY_BEFORE_DISPLAYING);
|
44 |
}
|
45 |
}
|
57 |
objMenu.removeClassName('active');
|
58 |
// --- change href ---
|
59 |
var wpMenuAnchor = $(objMenu.select('a')[0]);
|
60 |
+
wpChangeTopMenuHref(wpMenuAnchor, false);
|
61 |
// --- hide popup ---
|
62 |
+
if (typeof jQuery == 'undefined') {
|
63 |
+
popup.style.display = 'none';
|
64 |
+
} else {
|
65 |
+
jQuery('#' + popupId).stop(true, true).fadeOut();
|
66 |
+
}
|
67 |
}, CUSTOMMENU_POPUP_DELAY_BEFORE_HIDING);
|
68 |
}
|
69 |
}
|
102 |
return res;
|
103 |
}
|
104 |
|
105 |
+
function wpChangeTopMenuHref(wpMenuAnchor, state)
|
106 |
{
|
107 |
+
if (state) {
|
108 |
+
wpMenuAnchor.href = wpMenuAnchor.rel;
|
109 |
+
} else if (wpIsMobile.any()) {
|
110 |
+
wpMenuAnchor.href = 'javascript:void(0);';
|
111 |
+
}
|
112 |
}
|
113 |
|
114 |
function wpIsChildOf(parent, child)
|
212 |
g = d.getElementsByTagName('body')[0],
|
213 |
x = w.innerWidth || e.clientWidth || g.clientWidth,
|
214 |
y = w.innerHeight|| e.clientHeight|| g.clientHeight;
|
215 |
+
|
216 |
+
if ((x < 800 || wpIsMobile.any()) && wpMobileMenuEnabled) {
|
217 |
$('custommenu').hide();
|
218 |
$('custommenu-mobile').show();
|
219 |
+
// --- ajax load ---
|
220 |
+
if (wpMoblieMenuAjaxUrl) {
|
221 |
+
new Ajax.Updater({success: 'menu-content'}, wpMoblieMenuAjaxUrl, {
|
222 |
+
method: 'get',
|
223 |
+
asynchronous: true
|
224 |
+
});
|
225 |
+
wpMoblieMenuAjaxUrl = null;
|
226 |
+
}
|
227 |
} else {
|
228 |
$('custommenu-mobile').hide();
|
229 |
wpResetMobileMenuState();
|
230 |
$('custommenu').show();
|
231 |
+
// --- ajax load ---
|
232 |
+
if (wpMenuAjaxUrl) {
|
233 |
+
new Ajax.Updater({success: 'custommenu'}, wpMenuAjaxUrl, {
|
234 |
+
method: 'get',
|
235 |
+
asynchronous: true
|
236 |
+
});
|
237 |
+
wpMenuAjaxUrl = null;
|
238 |
+
}
|
239 |
}
|
|
|
240 |
|
241 |
+
if ($('custommenu-loading')) $('custommenu-loading').remove();
|
242 |
+
}
|
|
|
243 |
|
244 |
var wpIsMobile = {
|
245 |
Android: function() {
|