Version Notes
+ support touch screen (only android), ~ error if flat categories mode, ~ if empty categories
Download this release
Release Info
Developer | Magento Core Team |
Extension | wp_custom_menu |
Version | 2.4.0 |
Comparing to | |
See all releases |
Code changes from version 1.2.5 to 2.4.0
- app/code/local/WP/CustomMenu/Block/About.php +202 -0
- app/code/local/WP/CustomMenu/Block/Navigation.php +317 -216
- app/code/local/WP/CustomMenu/Block/Toggle.php +19 -0
- app/code/local/WP/CustomMenu/Block/Topmenu.php +16 -0
- app/code/local/WP/CustomMenu/Helper/Data.php +11 -2
- app/code/local/WP/CustomMenu/etc/adminhtml.xml +0 -23
- app/code/local/WP/CustomMenu/etc/config.xml +113 -65
- app/code/local/WP/CustomMenu/etc/system.xml +209 -117
- app/design/frontend/base/default/layout/custommenu.xml +0 -12
- app/design/frontend/base/default/template/custommenu/top.phtml +0 -18
- app/design/frontend/default/default/layout/webandpeople/custommenu.xml +6 -0
- app/design/frontend/default/default/template/webandpeople/custommenu/top.phtml +34 -0
- package.xml +8 -8
- skin/frontend/base/default/js/custommenu.js +0 -61
- skin/frontend/{base/default/css → default/default/css/webandpeople/custommenu}/custommenu.css +55 -49
- skin/frontend/default/default/js/webandpeople/custommenu/custommenu.js +152 -0
app/code/local/WP/CustomMenu/Block/About.php
ADDED
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WP_CustomMenu_Block_About
|
4 |
+
extends Mage_Adminhtml_Block_Abstract
|
5 |
+
implements Varien_Data_Form_Element_Renderer_Interface
|
6 |
+
{
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Render fieldset html
|
10 |
+
*
|
11 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
12 |
+
* @return string
|
13 |
+
*/
|
14 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
15 |
+
{
|
16 |
+
$default = <<<HTML
|
17 |
+
<div style="background-color:#EAF0EE;border:1px solid #CCCCCC;margin-bottom:10px;padding:20px;">
|
18 |
+
<p>
|
19 |
+
<b style="font-size:12px;">WebAndPeople</b>, a family of niche sites, provides small businesses with everything they need to start selling online.
|
20 |
+
</p>
|
21 |
+
<p>
|
22 |
+
<strong>PREMIUM and FREE MAGENTO TEMPALTES and EXTENSIONS</strong><br />
|
23 |
+
<a href="http://web-experiment.info" target="_blank">Web-Experiment.info</a> offers a wide choice of nice-looking and easily editable free and premium Magento Themes. At Web-Experiment, you can find free downloads or buy premium tempaltes for the extremely popular Magento eCommerce platform.<br />
|
24 |
+
<strong>MAGENTO HOSTING</strong></strong><br />
|
25 |
+
<a href="http://magenting.com" target="_blank">Magenting.com</a>, a new and improved hosting solution, is allowing you to easily create, promote, and manage your online store with Magento. Magenting users will receive a valuable set of tools and features, including automatic Magento eCommerce installation, automatic Magento template installation and a free or paid professional Magento hosting account.<br />
|
26 |
+
<strong>WEB DEVELOPMENT</strong><br />
|
27 |
+
<a href="http://webandpeople.com" target="_blank">WebAndPeople.com</a> is a team of professional Web developers and designers who are some of the best in the industry. WebAndPeople provides Web application development, custom Magento theme designs, and Website design services.<br />
|
28 |
+
<br />
|
29 |
+
</p>
|
30 |
+
<p>
|
31 |
+
Our themes and extensions on <a href="http://www.magentocommerce.com/magento-connect/developer/WebAndPeople" target="_blank">MagentoConnect</a><br />
|
32 |
+
Should you have any questions <a href="http://web-experiment.info/support" target="_blank">Contact Us</a> or email at <a href="mailto:support@web-experiment.info">support@web-experiment.info</a>
|
33 |
+
<br />
|
34 |
+
</p>
|
35 |
+
</div>
|
36 |
+
HTML;
|
37 |
+
$default = json_encode($default);
|
38 |
+
$html = '<div id="wp_aboutus_content"></div>
|
39 |
+
|
40 |
+
<script type="text/javascript"> //<![CDATA[
|
41 |
+
|
42 |
+
/* JSON-P implementation for Prototype.js somewhat by Dan Dean (http://www.dandean.com)
|
43 |
+
*
|
44 |
+
* *HEAVILY* based on Tobie Langel\'s version: http://gist.github.com/145466.
|
45 |
+
* Might as well just call this an iteration.
|
46 |
+
*
|
47 |
+
* This version introduces:
|
48 |
+
* - Support for predefined callbacks (Necessary for OAuth signed requests, by @rboyce)
|
49 |
+
* - Partial integration with Ajax.Responders (Thanks to @sr3d for the kick in this direction)
|
50 |
+
* - Compatibility with Prototype 1.7 (Thanks to @soung3 for the bug report)
|
51 |
+
* - Will not break if page lacks a <head> element
|
52 |
+
*
|
53 |
+
* See examples in README for usage
|
54 |
+
*
|
55 |
+
* VERSION 1.1.2
|
56 |
+
*
|
57 |
+
* new Ajax.JSONRequest(url, options);
|
58 |
+
* - url (String): JSON-P endpoint url.
|
59 |
+
* - options (Object): Configuration options for the request.
|
60 |
+
*/
|
61 |
+
Ajax.JSONRequest = Class.create(Ajax.Base, (function() {
|
62 |
+
var id = 0, head = document.getElementsByTagName(\'head\')[0] || document.body;
|
63 |
+
return {
|
64 |
+
initialize: function($super, url, options) {
|
65 |
+
$super(options);
|
66 |
+
this.options.url = url;
|
67 |
+
this.options.callbackParamName = this.options.callbackParamName || \'callback\';
|
68 |
+
this.options.timeout = this.options.timeout || 10; // Default timeout: 10 seconds
|
69 |
+
this.options.invokeImmediately = (!Object.isUndefined(this.options.invokeImmediately)) ? this.options.invokeImmediately : true ;
|
70 |
+
|
71 |
+
if (!Object.isUndefined(this.options.parameters) && Object.isString(this.options.parameters)) {
|
72 |
+
this.options.parameters = this.options.parameters.toQueryParams();
|
73 |
+
}
|
74 |
+
|
75 |
+
if (this.options.invokeImmediately) {
|
76 |
+
this.request();
|
77 |
+
}
|
78 |
+
},
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Ajax.JSONRequest#_cleanup() -> undefined
|
82 |
+
* Cleans up after the request
|
83 |
+
**/
|
84 |
+
_cleanup: function() {
|
85 |
+
if (this.timeout) {
|
86 |
+
clearTimeout(this.timeout);
|
87 |
+
this.timeout = null;
|
88 |
+
}
|
89 |
+
if (this.transport && Object.isElement(this.transport)) {
|
90 |
+
this.transport.remove();
|
91 |
+
this.transport = null;
|
92 |
+
}
|
93 |
+
},
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Ajax.JSONRequest#request() -> undefined
|
97 |
+
* Invokes the JSON-P request lifecycle
|
98 |
+
**/
|
99 |
+
request: function() {
|
100 |
+
|
101 |
+
// Define local vars
|
102 |
+
var response = new Ajax.JSONResponse(this);
|
103 |
+
var key = this.options.callbackParamName,
|
104 |
+
name = \'_prototypeJSONPCallback_\' + (id++),
|
105 |
+
complete = function() {
|
106 |
+
if (Object.isFunction(this.options.onComplete)) {
|
107 |
+
this.options.onComplete.call(this, response);
|
108 |
+
}
|
109 |
+
Ajax.Responders.dispatch(\'onComplete\', this, response);
|
110 |
+
}.bind(this);
|
111 |
+
|
112 |
+
// If the callback parameter is already defined, use that
|
113 |
+
if (this.options.parameters[key] !== undefined) {
|
114 |
+
name = this.options.parameters[key];
|
115 |
+
}
|
116 |
+
// Otherwise, add callback as a parameter
|
117 |
+
else {
|
118 |
+
this.options.parameters[key] = name;
|
119 |
+
}
|
120 |
+
|
121 |
+
// Build request URL
|
122 |
+
this.options.parameters[key] = name;
|
123 |
+
var url = this.options.url + ((this.options.url.include(\'?\') ? \'&\' : \'?\') + Object.toQueryString(this.options.parameters));
|
124 |
+
|
125 |
+
// Define callback function
|
126 |
+
window[name] = function(json) {
|
127 |
+
this._cleanup(); // Garbage collection
|
128 |
+
window[name] = undefined;
|
129 |
+
|
130 |
+
response.status = 200;
|
131 |
+
response.statusText = "OK";
|
132 |
+
response.setResponseContent(json);
|
133 |
+
|
134 |
+
if (Object.isFunction(this.options.onSuccess)) {
|
135 |
+
this.options.onSuccess.call(this, response);
|
136 |
+
}
|
137 |
+
Ajax.Responders.dispatch(\'onSuccess\', this, response);
|
138 |
+
|
139 |
+
complete();
|
140 |
+
|
141 |
+
}.bind(this);
|
142 |
+
|
143 |
+
this.transport = new Element(\'script\', { type: \'text/javascript\', src: url });
|
144 |
+
|
145 |
+
if (Object.isFunction(this.options.onCreate)) {
|
146 |
+
this.options.onCreate.call(this, response);
|
147 |
+
}
|
148 |
+
Ajax.Responders.dispatch(\'onCreate\', this);
|
149 |
+
|
150 |
+
head.appendChild(this.transport);
|
151 |
+
|
152 |
+
this.timeout = setTimeout(function() {
|
153 |
+
this._cleanup();
|
154 |
+
window[name] = Prototype.emptyFunction;
|
155 |
+
if (Object.isFunction(this.options.onFailure)) {
|
156 |
+
response.status = 504;
|
157 |
+
response.statusText = "Gateway Timeout";
|
158 |
+
this.options.onFailure.call(this, response);
|
159 |
+
}
|
160 |
+
complete();
|
161 |
+
}.bind(this), this.options.timeout * 1000);
|
162 |
+
},
|
163 |
+
toString: function() { return "[object Ajax.JSONRequest]"; }
|
164 |
+
};
|
165 |
+
})());
|
166 |
+
|
167 |
+
Ajax.JSONResponse = Class.create({
|
168 |
+
initialize: function(request) {
|
169 |
+
this.request = request;
|
170 |
+
},
|
171 |
+
request: undefined,
|
172 |
+
status: 0,
|
173 |
+
statusText: \'\',
|
174 |
+
responseJSON: undefined,
|
175 |
+
responseText: undefined,
|
176 |
+
setResponseContent: function(json) {
|
177 |
+
this.responseJSON = json;
|
178 |
+
this.responseText = Object.toJSON(json);
|
179 |
+
},
|
180 |
+
getTransport: function() {
|
181 |
+
if (this.request) return this.request.transport;
|
182 |
+
},
|
183 |
+
toString: function() { return "[object Ajax.JSONResponse]"; }
|
184 |
+
});
|
185 |
+
|
186 |
+
window.onload = function(){
|
187 |
+
var html = ' . $default . ';
|
188 |
+
|
189 |
+
new Ajax.JSONRequest(\'http://web-experiment.info/about-us.php\', {
|
190 |
+
callbackParamName: "jsoncallback",
|
191 |
+
onComplete: function(response) {
|
192 |
+
if (response.responseJSON && response.responseJSON.html) {
|
193 |
+
html = response.responseJSON.html;
|
194 |
+
}
|
195 |
+
Element.replace(\'wp_aboutus_content\', html);
|
196 |
+
}
|
197 |
+
});
|
198 |
+
};
|
199 |
+
//]]></script>';
|
200 |
+
return $html;
|
201 |
+
}
|
202 |
+
}
|
app/code/local/WP/CustomMenu/Block/Navigation.php
CHANGED
@@ -1,216 +1,317 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WP_CustomMenu_Block_Navigation extends Mage_Catalog_Block_Navigation
|
4 |
-
{
|
5 |
-
const CUSTOM_BLOCK_TEMPLATE =
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
$
|
19 |
-
// ---
|
20 |
-
$
|
21 |
-
|
22 |
-
$
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
$
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
if ($drawPopup)
|
42 |
-
|
43 |
-
|
44 |
-
$html[] = '<
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
$
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
$
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
$
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
$
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WP_CustomMenu_Block_Navigation extends Mage_Catalog_Block_Navigation
|
4 |
+
{
|
5 |
+
const CUSTOM_BLOCK_TEMPLATE = "wp_custom_menu_%d";
|
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 drawCustomMenuItem($category, $level = 0, $last = false)
|
15 |
+
{
|
16 |
+
if (!$category->getIsActive()) return '';
|
17 |
+
$html = array();
|
18 |
+
$id = $category->getId();
|
19 |
+
// --- Static Block ---
|
20 |
+
$blockId = sprintf(self::CUSTOM_BLOCK_TEMPLATE, $id); // --- static block key
|
21 |
+
#Mage::log($blockId);
|
22 |
+
$collection = Mage::getModel('cms/block')->getCollection()
|
23 |
+
->addFieldToFilter('identifier', array('like' => $blockId . '%'))
|
24 |
+
->addFieldToFilter('is_active', 1);
|
25 |
+
$blockId = $collection->getFirstItem()->getIdentifier();
|
26 |
+
#Mage::log($blockId);
|
27 |
+
$blockHtml = $this->getLayout()->createBlock('cms/block')->setBlockId($blockId)->toHtml();
|
28 |
+
// --- Sub Categories ---
|
29 |
+
$activeChildren = $this->_getActiveChildren($category, $level);
|
30 |
+
// --- class for active category ---
|
31 |
+
$active = ''; if ($this->isCategoryActive($category)) $active = ' act';
|
32 |
+
// --- Popup functions for show ---
|
33 |
+
$drawPopup = ($blockHtml || count($activeChildren));
|
34 |
+
if ($drawPopup) {
|
35 |
+
$html[] = '<div id="menu' . $id . '" class="menu' . $active . '" onmouseover="wpShowMenuPopup(this, event, \'popup' . $id . '\');" onmouseout="wpHideMenuPopup(this, event, \'popup' . $id . '\', \'menu' . $id . '\')">';
|
36 |
+
} else {
|
37 |
+
$html[] = '<div id="menu' . $id . '" class="menu' . $active . '">';
|
38 |
+
}
|
39 |
+
// --- Top Menu Item ---
|
40 |
+
$html[] = '<div class="parentMenu">';
|
41 |
+
if ($level == 0 && $drawPopup) {
|
42 |
+
$html[] = '<a href="javascript:void(0);" rel="'.$this->getCategoryUrl($category).'">';
|
43 |
+
} else {
|
44 |
+
$html[] = '<a href="'.$this->getCategoryUrl($category).'">';
|
45 |
+
}
|
46 |
+
$name = $this->escapeHtml($category->getName());
|
47 |
+
if (Mage::getStoreConfig('custom_menu/general/non_breaking_space')) {
|
48 |
+
$name = str_replace(' ', ' ', $name);
|
49 |
+
}
|
50 |
+
$html[] = '<span>' . $name . '</span>';
|
51 |
+
$html[] = '</a>';
|
52 |
+
$html[] = '</div>';
|
53 |
+
$html[] = '</div>';
|
54 |
+
// --- Add Popup block (hidden) ---
|
55 |
+
if ($drawPopup) {
|
56 |
+
// --- Popup function for hide ---
|
57 |
+
$html[] = '<div id="popup' . $id . '" class="wp-custom-menu-popup" onmouseout="wpHideMenuPopup(this, event, \'popup' . $id . '\', \'menu' . $id . '\')" onmouseover="wpPopupOver(this, event, \'popup' . $id . '\', \'menu' . $id . '\')">';
|
58 |
+
// --- draw Sub Categories ---
|
59 |
+
if (count($activeChildren)) {
|
60 |
+
$html[] = '<div class="block1">';
|
61 |
+
$html[] = $this->drawColumns($activeChildren);
|
62 |
+
$html[] = '<div class="clearBoth"></div>';
|
63 |
+
$html[] = '</div>';
|
64 |
+
}
|
65 |
+
// --- draw Custom User Block ---
|
66 |
+
if ($blockHtml) {
|
67 |
+
$html[] = '<div id="' . $blockId . '" class="block2">';
|
68 |
+
$html[] = $blockHtml;
|
69 |
+
$html[] = '</div>';
|
70 |
+
}
|
71 |
+
$html[] = '</div>';
|
72 |
+
}
|
73 |
+
$html = implode("\n", $html);
|
74 |
+
return $html;
|
75 |
+
}
|
76 |
+
|
77 |
+
public function drawMenuItem($children, $level = 1)
|
78 |
+
{
|
79 |
+
$html = '<div class="itemMenu level' . $level . '">';
|
80 |
+
$keyCurrent = $this->getCurrentCategory()->getId();
|
81 |
+
foreach ($children as $child)
|
82 |
+
{
|
83 |
+
if (is_object($child) && $child->getIsActive())
|
84 |
+
{
|
85 |
+
// --- class for active category ---
|
86 |
+
$active = '';
|
87 |
+
if ($this->isCategoryActive($child))
|
88 |
+
{
|
89 |
+
$active = ' actParent';
|
90 |
+
if ($child->getId() == $keyCurrent) $active = ' act';
|
91 |
+
}
|
92 |
+
// --- format category name ---
|
93 |
+
$name = $this->escapeHtml($child->getName());
|
94 |
+
if (Mage::getStoreConfig('custom_menu/general/non_breaking_space'))
|
95 |
+
$name = str_replace(' ', ' ', $name);
|
96 |
+
$html.= '<a class="itemMenuName level' . $level . $active . '" href="' . $this->getCategoryUrl($child) . '"><span>' . $name . '</span></a>';
|
97 |
+
$activeChildren = $this->_getActiveChildren($child, $level);
|
98 |
+
if (count($activeChildren) > 0)
|
99 |
+
{
|
100 |
+
$html.= '<div class="itemSubMenu level' . $level . '">';
|
101 |
+
$html.= $this->drawMenuItem($activeChildren, $level + 1);
|
102 |
+
$html.= '</div>';
|
103 |
+
}
|
104 |
+
}
|
105 |
+
}
|
106 |
+
$html.= '</div>';
|
107 |
+
return $html;
|
108 |
+
}
|
109 |
+
|
110 |
+
public function drawColumns($children)
|
111 |
+
{
|
112 |
+
$html = '';
|
113 |
+
// --- explode by columns ---
|
114 |
+
$columns = (int)Mage::getStoreConfig('custom_menu/columns/count');
|
115 |
+
if ($columns < 1) $columns = 1;
|
116 |
+
$chunks = $this->_explodeByColumns($children, $columns);
|
117 |
+
// --- draw columns ---
|
118 |
+
$lastColumnNumber = count($chunks);
|
119 |
+
$i = 1;
|
120 |
+
foreach ($chunks as $key => $value)
|
121 |
+
{
|
122 |
+
if (!count($value)) continue;
|
123 |
+
$class = '';
|
124 |
+
if ($i == 1) $class.= ' first';
|
125 |
+
if ($i == $lastColumnNumber) $class.= ' last';
|
126 |
+
if ($i % 2) $class.= ' odd'; else $class.= ' even';
|
127 |
+
$html.= '<div class="column' . $class . '">';
|
128 |
+
$html.= $this->drawMenuItem($value, 1);
|
129 |
+
$html.= '</div>';
|
130 |
+
$i++;
|
131 |
+
}
|
132 |
+
return $html;
|
133 |
+
}
|
134 |
+
|
135 |
+
protected function _getActiveChildren($parent, $level)
|
136 |
+
{
|
137 |
+
$activeChildren = array();
|
138 |
+
// --- check level ---
|
139 |
+
$maxLevel = (int)Mage::getStoreConfig('custom_menu/general/max_level');
|
140 |
+
if ($maxLevel > 0)
|
141 |
+
{
|
142 |
+
if ($level >= ($maxLevel - 1)) return $activeChildren;
|
143 |
+
}
|
144 |
+
// --- / check level ---
|
145 |
+
if (Mage::helper('catalog/category_flat')->isEnabled())
|
146 |
+
{
|
147 |
+
$children = $parent->getChildrenNodes();
|
148 |
+
$childrenCount = count($children);
|
149 |
+
}
|
150 |
+
else
|
151 |
+
{
|
152 |
+
$children = $parent->getChildren();
|
153 |
+
$childrenCount = $children->count();
|
154 |
+
}
|
155 |
+
$hasChildren = $children && $childrenCount;
|
156 |
+
if ($hasChildren)
|
157 |
+
{
|
158 |
+
foreach ($children as $child)
|
159 |
+
{
|
160 |
+
if ($this->_isCategoryDisplayed($child))
|
161 |
+
{
|
162 |
+
array_push($activeChildren, $child);
|
163 |
+
}
|
164 |
+
}
|
165 |
+
}
|
166 |
+
return $activeChildren;
|
167 |
+
}
|
168 |
+
|
169 |
+
private function _isCategoryDisplayed(&$child)
|
170 |
+
{
|
171 |
+
if (!$child->getIsActive()) return false;
|
172 |
+
// === check products count ===
|
173 |
+
// --- get collection info ---
|
174 |
+
if (!Mage::getStoreConfig('custom_menu/general/display_empty_categories'))
|
175 |
+
{
|
176 |
+
$data = $this->_getProductsCountData();
|
177 |
+
// --- check by id ---
|
178 |
+
$id = $child->getId();
|
179 |
+
#Mage::log($id); Mage::log($data);
|
180 |
+
if (!isset($data[$id]) || !$data[$id]['product_count']) return false;
|
181 |
+
}
|
182 |
+
// === / check products count ===
|
183 |
+
return true;
|
184 |
+
}
|
185 |
+
|
186 |
+
private function _getProductsCountData()
|
187 |
+
{
|
188 |
+
if (is_null($this->_productsCount))
|
189 |
+
{
|
190 |
+
$collection = Mage::getModel('catalog/category')->getCollection();
|
191 |
+
$storeId = Mage::app()->getStore()->getId();
|
192 |
+
/* @var $collection Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Collection */
|
193 |
+
$collection->addAttributeToSelect('name')
|
194 |
+
->addAttributeToSelect('is_active')
|
195 |
+
->setProductStoreId($storeId)
|
196 |
+
->setLoadProductCount(true)
|
197 |
+
->setStoreId($storeId);
|
198 |
+
$productsCount = array();
|
199 |
+
foreach($collection as $cat)
|
200 |
+
{
|
201 |
+
$productsCount[$cat->getId()] = array(
|
202 |
+
'name' => $cat->getName(),
|
203 |
+
'product_count' => $cat->getProductCount(),
|
204 |
+
);
|
205 |
+
}
|
206 |
+
#Mage::log($productsCount);
|
207 |
+
$this->_productsCount = $productsCount;
|
208 |
+
}
|
209 |
+
return $this->_productsCount;
|
210 |
+
}
|
211 |
+
|
212 |
+
private function _explodeByColumns($target, $num)
|
213 |
+
{
|
214 |
+
if ((int)Mage::getStoreConfig('custom_menu/columns/divided_horizontally')) {
|
215 |
+
$target = self::_explodeArrayByColumnsHorisontal($target, $num);
|
216 |
+
} else {
|
217 |
+
$target = self::_explodeArrayByColumnsVertical($target, $num);
|
218 |
+
}
|
219 |
+
#return $target;
|
220 |
+
if ((int)Mage::getStoreConfig('custom_menu/columns/integrate') && count($target))
|
221 |
+
{
|
222 |
+
// --- combine consistently numerically small column ---
|
223 |
+
// --- 1. calc length of each column ---
|
224 |
+
$max = 0; $columnsLength = array();
|
225 |
+
foreach ($target as $key => $child)
|
226 |
+
{
|
227 |
+
$count = 0;
|
228 |
+
$this->_countChild($child, 1, $count);
|
229 |
+
if ($max < $count) $max = $count;
|
230 |
+
$columnsLength[$key] = $count;
|
231 |
+
}
|
232 |
+
// --- 2. merge small columns with next ---
|
233 |
+
$xColumns = array(); $column = array(); $cnt = 0;
|
234 |
+
$xColumnsLength = array(); $k = 0;
|
235 |
+
foreach ($columnsLength as $key => $count)
|
236 |
+
{
|
237 |
+
$cnt+= $count;
|
238 |
+
if ($cnt > $max && count($column))
|
239 |
+
{
|
240 |
+
$xColumns[$k] = $column;
|
241 |
+
$xColumnsLength[$k] = $cnt - $count;
|
242 |
+
$k++; $column = array(); $cnt = $count;
|
243 |
+
}
|
244 |
+
$column = array_merge($column, $target[$key]);
|
245 |
+
}
|
246 |
+
$xColumns[$k] = $column;
|
247 |
+
$xColumnsLength[$k] = $cnt - $count;
|
248 |
+
// --- 3. integrate columns of one element ---
|
249 |
+
$target = $xColumns; $xColumns = array(); $nextKey = -1;
|
250 |
+
if ($max > 1 && count($target) > 1)
|
251 |
+
{
|
252 |
+
foreach($target as $key => $column)
|
253 |
+
{
|
254 |
+
if ($key == $nextKey) continue;
|
255 |
+
if ($xColumnsLength[$key] == 1)
|
256 |
+
{
|
257 |
+
// --- merge with next column ---
|
258 |
+
$nextKey = $key + 1;
|
259 |
+
if (isset($target[$nextKey]) && count($target[$nextKey]))
|
260 |
+
{
|
261 |
+
$xColumns[] = array_merge($column, $target[$nextKey]);
|
262 |
+
continue;
|
263 |
+
}
|
264 |
+
}
|
265 |
+
$xColumns[] = $column;
|
266 |
+
}
|
267 |
+
$target = $xColumns;
|
268 |
+
}
|
269 |
+
}
|
270 |
+
$_rtl = Mage::getStoreConfigFlag('custom_menu/general/rtl');
|
271 |
+
if ($_rtl) {
|
272 |
+
$target = array_reverse($target);
|
273 |
+
}
|
274 |
+
return $target;
|
275 |
+
}
|
276 |
+
|
277 |
+
private function _countChild($children, $level, &$count)
|
278 |
+
{
|
279 |
+
foreach ($children as $child)
|
280 |
+
{
|
281 |
+
if ($child->getIsActive())
|
282 |
+
{
|
283 |
+
$count++; $activeChildren = $this->_getActiveChildren($child, $level);
|
284 |
+
if (count($activeChildren) > 0) $this->_countChild($activeChildren, $level + 1, $count);
|
285 |
+
}
|
286 |
+
}
|
287 |
+
}
|
288 |
+
|
289 |
+
private static function _explodeArrayByColumnsHorisontal($list, $num)
|
290 |
+
{
|
291 |
+
if ($num <= 0) return array($list);
|
292 |
+
$partition = array();
|
293 |
+
$partition = array_pad($partition, $num, array());
|
294 |
+
$i = 0;
|
295 |
+
foreach ($list as $key => $value) {
|
296 |
+
$partition[$i][$key] = $value;
|
297 |
+
if (++$i == $num) $i = 0;
|
298 |
+
}
|
299 |
+
return $partition;
|
300 |
+
}
|
301 |
+
|
302 |
+
private static function _explodeArrayByColumnsVertical($list, $num)
|
303 |
+
{
|
304 |
+
if ($num <= 0) return array($list);
|
305 |
+
$listlen = count($list);
|
306 |
+
$partlen = floor($listlen / $num);
|
307 |
+
$partrem = $listlen % $num;
|
308 |
+
$partition = array();
|
309 |
+
$mark = 0;
|
310 |
+
for ($column = 0; $column < $num; $column++) {
|
311 |
+
$incr = ($column < $partrem) ? $partlen + 1 : $partlen;
|
312 |
+
$partition[$column] = array_slice($list, $mark, $incr);
|
313 |
+
$mark += $incr;
|
314 |
+
}
|
315 |
+
return $partition;
|
316 |
+
}
|
317 |
+
}
|
app/code/local/WP/CustomMenu/Block/Toggle.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WP_CustomMenu_Block_Toggle extends Mage_Core_Block_Template
|
4 |
+
{
|
5 |
+
public function _prepareLayout()
|
6 |
+
{
|
7 |
+
if (!Mage::getStoreConfig('custom_menu/general/enabled')) return;
|
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 |
+
}
|
app/code/local/WP/CustomMenu/Block/Topmenu.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if (!Mage::getStoreConfig('custom_menu/general/enabled') ||
|
4 |
+
(Mage::getStoreConfig('custom_menu/general/ie6_ignore') && Mage::helper('custommenu')->isIE6()))
|
5 |
+
{
|
6 |
+
class WP_CustomMenu_Block_Topmenu extends Mage_Page_Block_Html_Topmenu
|
7 |
+
{
|
8 |
+
|
9 |
+
}
|
10 |
+
return;
|
11 |
+
}
|
12 |
+
|
13 |
+
class WP_CustomMenu_Block_Topmenu extends WP_CustomMenu_Block_Navigation
|
14 |
+
{
|
15 |
+
|
16 |
+
}
|
app/code/local/WP/CustomMenu/Helper/Data.php
CHANGED
@@ -2,5 +2,14 @@
|
|
2 |
|
3 |
class WP_CustomMenu_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
{
|
5 |
-
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
8 |
+
$userAgent = $_SERVER['HTTP_USER_AGENT'];
|
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( $version <= 6.0 ) $flag = true;
|
13 |
+
return $flag;
|
14 |
+
}
|
15 |
+
}
|
app/code/local/WP/CustomMenu/etc/adminhtml.xml
DELETED
@@ -1,23 +0,0 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
<config>
|
3 |
-
<acl>
|
4 |
-
<resources>
|
5 |
-
<admin>
|
6 |
-
<children>
|
7 |
-
<system>
|
8 |
-
<children>
|
9 |
-
<config>
|
10 |
-
<children>
|
11 |
-
<custom_menu translate="title" module="custommenu">
|
12 |
-
<title>Custom Menu</title>
|
13 |
-
<sort_order>300</sort_order>
|
14 |
-
</custom_menu>
|
15 |
-
</children>
|
16 |
-
</config>
|
17 |
-
</children>
|
18 |
-
</system>
|
19 |
-
</children>
|
20 |
-
</admin>
|
21 |
-
</resources>
|
22 |
-
</acl>
|
23 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/WP/CustomMenu/etc/config.xml
CHANGED
@@ -1,65 +1,113 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<modules>
|
4 |
-
<WP_CustomMenu>
|
5 |
-
<version>
|
6 |
-
</WP_CustomMenu>
|
7 |
-
</modules>
|
8 |
-
<frontend>
|
9 |
-
<layout>
|
10 |
-
<updates>
|
11 |
-
<custommenu>
|
12 |
-
<file>custommenu.xml</file>
|
13 |
-
</custommenu>
|
14 |
-
</updates>
|
15 |
-
</layout>
|
16 |
-
</frontend>
|
17 |
-
<adminhtml>
|
18 |
-
<acl>
|
19 |
-
<resources>
|
20 |
-
<all>
|
21 |
-
<title>Allow Everything</title>
|
22 |
-
</all>
|
23 |
-
<admin>
|
24 |
-
<children>
|
25 |
-
<
|
26 |
-
<
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
<
|
51 |
-
<
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<WP_CustomMenu>
|
5 |
+
<version>2.4.0</version>
|
6 |
+
</WP_CustomMenu>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<layout>
|
10 |
+
<updates>
|
11 |
+
<custommenu>
|
12 |
+
<file>webandpeople/custommenu.xml</file>
|
13 |
+
</custommenu>
|
14 |
+
</updates>
|
15 |
+
</layout>
|
16 |
+
</frontend>
|
17 |
+
<adminhtml>
|
18 |
+
<acl>
|
19 |
+
<resources>
|
20 |
+
<all>
|
21 |
+
<title>Allow Everything</title>
|
22 |
+
</all>
|
23 |
+
<admin>
|
24 |
+
<children>
|
25 |
+
<system>
|
26 |
+
<children>
|
27 |
+
<config>
|
28 |
+
<children>
|
29 |
+
<custom_menu translate="title" module="custommenu">
|
30 |
+
<title><![CDATA[Web & People: Custom Menu]]></title>
|
31 |
+
<sort_order>2000</sort_order>
|
32 |
+
</custom_menu>
|
33 |
+
</children>
|
34 |
+
</config>
|
35 |
+
</children>
|
36 |
+
</system>
|
37 |
+
</children>
|
38 |
+
</admin>
|
39 |
+
</resources>
|
40 |
+
</acl>
|
41 |
+
</adminhtml>
|
42 |
+
<global>
|
43 |
+
<blocks>
|
44 |
+
<catalog>
|
45 |
+
<rewrite>
|
46 |
+
<navigation>WP_CustomMenu_Block_Navigation</navigation>
|
47 |
+
<!-- v1.4-1.6 -->
|
48 |
+
</rewrite>
|
49 |
+
</catalog>
|
50 |
+
<page>
|
51 |
+
<rewrite>
|
52 |
+
<html_topmenu>WP_CustomMenu_Block_Topmenu</html_topmenu>
|
53 |
+
<!-- v1.7 -->
|
54 |
+
</rewrite>
|
55 |
+
</page>
|
56 |
+
<custommenu>
|
57 |
+
<class>WP_CustomMenu_Block</class>
|
58 |
+
</custommenu>
|
59 |
+
</blocks>
|
60 |
+
<helpers>
|
61 |
+
<custommenu>
|
62 |
+
<class>WP_CustomMenu_Helper</class>
|
63 |
+
</custommenu>
|
64 |
+
</helpers>
|
65 |
+
</global>
|
66 |
+
<default>
|
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.4.0</version>
|
77 |
+
</general>
|
78 |
+
<columns>
|
79 |
+
<count>3</count>
|
80 |
+
<divided_horizontally>0</divided_horizontally>
|
81 |
+
<integrate>1</integrate>
|
82 |
+
</columns>
|
83 |
+
<popup>
|
84 |
+
<width>0</width>
|
85 |
+
<top_offset>0</top_offset>
|
86 |
+
<delay_displaying>0</delay_displaying>
|
87 |
+
<delay_hiding>0</delay_hiding>
|
88 |
+
</popup>
|
89 |
+
</custom_menu>
|
90 |
+
</default>
|
91 |
+
<adminhtml>
|
92 |
+
<acl>
|
93 |
+
<resources>
|
94 |
+
<admin>
|
95 |
+
<children>
|
96 |
+
<system>
|
97 |
+
<children>
|
98 |
+
<config>
|
99 |
+
<children>
|
100 |
+
<about_webandpeople translate="title" module="custommenu">
|
101 |
+
<title><![CDATA[Web & People: About Us]]></title>
|
102 |
+
<sort_order>1000</sort_order>
|
103 |
+
</about_webandpeople>
|
104 |
+
</children>
|
105 |
+
</config>
|
106 |
+
</children>
|
107 |
+
</system>
|
108 |
+
</children>
|
109 |
+
</admin>
|
110 |
+
</resources>
|
111 |
+
</acl>
|
112 |
+
</adminhtml>
|
113 |
+
</config>
|
app/code/local/WP/CustomMenu/etc/system.xml
CHANGED
@@ -1,117 +1,209 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<tabs>
|
4 |
-
<web_and_people translate="label" module="custommenu">
|
5 |
-
<label>Web-And-People</label>
|
6 |
-
<sort_order>150</sort_order>
|
7 |
-
</web_and_people>
|
8 |
-
</tabs>
|
9 |
-
<sections>
|
10 |
-
<custom_menu translate="label" module="custommenu">
|
11 |
-
<label>Custom Menu</label>
|
12 |
-
<tab>web_and_people</tab>
|
13 |
-
<frontend_type>text</frontend_type>
|
14 |
-
<sort_order>
|
15 |
-
<show_in_default>1</show_in_default>
|
16 |
-
<show_in_website>1</show_in_website>
|
17 |
-
<show_in_store>1</show_in_store>
|
18 |
-
<groups>
|
19 |
-
<general translate="label">
|
20 |
-
<label>General</label>
|
21 |
-
<frontend_type>text</frontend_type>
|
22 |
-
<sort_order>10</sort_order>
|
23 |
-
<show_in_default>1</show_in_default>
|
24 |
-
<show_in_website>1</show_in_website>
|
25 |
-
<show_in_store>1</show_in_store>
|
26 |
-
<fields>
|
27 |
-
<enabled translate="label comment">
|
28 |
-
<label>Enable</label>
|
29 |
-
<
|
30 |
-
<
|
31 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
32 |
-
<sort_order>1</sort_order>
|
33 |
-
<show_in_default>1</show_in_default>
|
34 |
-
<show_in_website>1</show_in_website>
|
35 |
-
<show_in_store>1</show_in_store>
|
36 |
-
</enabled>
|
37 |
-
<
|
38 |
-
<label>
|
39 |
-
<comment><![CDATA[
|
40 |
-
<frontend_type>
|
41 |
-
<
|
42 |
-
<
|
43 |
-
<
|
44 |
-
<
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
<
|
57 |
-
<label>
|
58 |
-
<
|
59 |
-
<
|
60 |
-
<sort_order>
|
61 |
-
<show_in_default>1</show_in_default>
|
62 |
-
<show_in_website>1</show_in_website>
|
63 |
-
<show_in_store>1</show_in_store>
|
64 |
-
</
|
65 |
-
<
|
66 |
-
<label>
|
67 |
-
<
|
68 |
-
<
|
69 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
70 |
-
<sort_order>
|
71 |
-
<show_in_default>1</show_in_default>
|
72 |
-
<show_in_website>1</show_in_website>
|
73 |
-
<show_in_store>1</show_in_store>
|
74 |
-
</
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
<
|
87 |
-
<
|
88 |
-
<
|
89 |
-
<
|
90 |
-
<
|
91 |
-
<
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
<label
|
96 |
-
<
|
97 |
-
<
|
98 |
-
<
|
99 |
-
<
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<web_and_people translate="label" module="custommenu">
|
5 |
+
<label>Web-And-People</label>
|
6 |
+
<sort_order>150</sort_order>
|
7 |
+
</web_and_people>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<custom_menu translate="label" module="custommenu">
|
11 |
+
<label>Custom Menu</label>
|
12 |
+
<tab>web_and_people</tab>
|
13 |
+
<frontend_type>text</frontend_type>
|
14 |
+
<sort_order>200</sort_order>
|
15 |
+
<show_in_default>1</show_in_default>
|
16 |
+
<show_in_website>1</show_in_website>
|
17 |
+
<show_in_store>1</show_in_store>
|
18 |
+
<groups>
|
19 |
+
<general translate="label">
|
20 |
+
<label>General</label>
|
21 |
+
<frontend_type>text</frontend_type>
|
22 |
+
<sort_order>10</sort_order>
|
23 |
+
<show_in_default>1</show_in_default>
|
24 |
+
<show_in_website>1</show_in_website>
|
25 |
+
<show_in_store>1</show_in_store>
|
26 |
+
<fields>
|
27 |
+
<enabled translate="label comment">
|
28 |
+
<label>Enable</label>
|
29 |
+
<comment><![CDATA[In order to display a custom block with images or other html content in the popup, use the <b>Static Block</b> (<strong>CMS->Static Blocks</strong> section) with the ID like "<b>wp_custom_menu_83</b>", where "<b>83</b>" is the Category ID of this category]]></comment>
|
30 |
+
<frontend_type>select</frontend_type>
|
31 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
32 |
+
<sort_order>1</sort_order>
|
33 |
+
<show_in_default>1</show_in_default>
|
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>
|
40 |
+
<frontend_type>select</frontend_type>
|
41 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
42 |
+
<sort_order>5</sort_order>
|
43 |
+
<show_in_default>1</show_in_default>
|
44 |
+
<show_in_website>1</show_in_website>
|
45 |
+
<show_in_store>1</show_in_store>
|
46 |
+
</display_empty_categories>
|
47 |
+
<max_level translate="label comment">
|
48 |
+
<label>Visible menu depth</label>
|
49 |
+
<comment><![CDATA[e.g. 1, 2, 3, 4 (0 - disable limits). For example, if you set this value to <b>2</b>, only second level categories will be displayed]]></comment>
|
50 |
+
<frontend_type>text</frontend_type>
|
51 |
+
<sort_order>10</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 |
+
</max_level>
|
56 |
+
<show_home_link translate="label">
|
57 |
+
<label>Show the link "Home"</label>
|
58 |
+
<frontend_type>select</frontend_type>
|
59 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
60 |
+
<sort_order>15</sort_order>
|
61 |
+
<show_in_default>1</show_in_default>
|
62 |
+
<show_in_website>1</show_in_website>
|
63 |
+
<show_in_store>1</show_in_store>
|
64 |
+
</show_home_link>
|
65 |
+
<non_breaking_space translate="label comment">
|
66 |
+
<label>Replace spaces with non-breaking spaces</label>
|
67 |
+
<comment><![CDATA[Insert <b>&nbsp;</b> instead of a space in a name of a menu item]]></comment>
|
68 |
+
<frontend_type>select</frontend_type>
|
69 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
70 |
+
<sort_order>20</sort_order>
|
71 |
+
<show_in_default>1</show_in_default>
|
72 |
+
<show_in_website>1</show_in_website>
|
73 |
+
<show_in_store>1</show_in_store>
|
74 |
+
</non_breaking_space>
|
75 |
+
<ie6_ignore translate="label">
|
76 |
+
<label>Display standard menu in IE6 browser</label>
|
77 |
+
<frontend_type>select</frontend_type>
|
78 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
79 |
+
<sort_order>30</sort_order>
|
80 |
+
<show_in_default>1</show_in_default>
|
81 |
+
<show_in_website>1</show_in_website>
|
82 |
+
<show_in_store>1</show_in_store>
|
83 |
+
</ie6_ignore>
|
84 |
+
<rtl translate="label">
|
85 |
+
<label>Enable RTL Text mode</label>
|
86 |
+
<frontend_type>select</frontend_type>
|
87 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
88 |
+
<sort_order>35</sort_order>
|
89 |
+
<show_in_default>1</show_in_default>
|
90 |
+
<show_in_website>1</show_in_website>
|
91 |
+
<show_in_store>1</show_in_store>
|
92 |
+
</rtl>
|
93 |
+
<version translate="label">
|
94 |
+
<label>Extension Release</label>
|
95 |
+
<frontend_type>label</frontend_type>
|
96 |
+
<sort_order>100</sort_order>
|
97 |
+
<show_in_default>1</show_in_default>
|
98 |
+
<show_in_website>1</show_in_website>
|
99 |
+
<show_in_store>1</show_in_store>
|
100 |
+
</version>
|
101 |
+
</fields>
|
102 |
+
</general>
|
103 |
+
<columns translate="label">
|
104 |
+
<label>Columns</label>
|
105 |
+
<frontend_type>text</frontend_type>
|
106 |
+
<sort_order>15</sort_order>
|
107 |
+
<show_in_default>1</show_in_default>
|
108 |
+
<show_in_website>1</show_in_website>
|
109 |
+
<show_in_store>1</show_in_store>
|
110 |
+
<fields>
|
111 |
+
<count translate="label comment">
|
112 |
+
<label>Number of columns</label>
|
113 |
+
<comment>e.g. 1, 2, 3. The maximum number of columns in the popup</comment>
|
114 |
+
<frontend_type>text</frontend_type>
|
115 |
+
<sort_order>1</sort_order>
|
116 |
+
<show_in_default>1</show_in_default>
|
117 |
+
<show_in_website>1</show_in_website>
|
118 |
+
<show_in_store>1</show_in_store>
|
119 |
+
</count>
|
120 |
+
<divided_horizontally translate="label comment">
|
121 |
+
<label>Split categories left to right into columns</label>
|
122 |
+
<comment><![CDATA[Next Sub-category is placed to the next column]]></comment>
|
123 |
+
<frontend_type>select</frontend_type>
|
124 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
125 |
+
<sort_order>3</sort_order>
|
126 |
+
<show_in_default>1</show_in_default>
|
127 |
+
<show_in_website>1</show_in_website>
|
128 |
+
<show_in_store>1</show_in_store>
|
129 |
+
</divided_horizontally>
|
130 |
+
<integrate translate="label comment">
|
131 |
+
<label>Merge small subcategories</label>
|
132 |
+
<comment><![CDATA[Merge small subcategory lists into one column (except the extream left categories)]]></comment>
|
133 |
+
<frontend_type>select</frontend_type>
|
134 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
135 |
+
<sort_order>5</sort_order>
|
136 |
+
<show_in_default>1</show_in_default>
|
137 |
+
<show_in_website>1</show_in_website>
|
138 |
+
<show_in_store>1</show_in_store>
|
139 |
+
</integrate>
|
140 |
+
</fields>
|
141 |
+
</columns>
|
142 |
+
<popup translate="label">
|
143 |
+
<label>Popup settings</label>
|
144 |
+
<frontend_type>text</frontend_type>
|
145 |
+
<sort_order>20</sort_order>
|
146 |
+
<show_in_default>1</show_in_default>
|
147 |
+
<show_in_website>1</show_in_website>
|
148 |
+
<show_in_store>1</show_in_store>
|
149 |
+
<fields>
|
150 |
+
<width translate="label comment">
|
151 |
+
<label>Width</label>
|
152 |
+
<comment>in pixels, (0 - no fixed width)</comment>
|
153 |
+
<frontend_type>text</frontend_type>
|
154 |
+
<sort_order>1</sort_order>
|
155 |
+
<show_in_default>1</show_in_default>
|
156 |
+
<show_in_website>1</show_in_website>
|
157 |
+
<show_in_store>1</show_in_store>
|
158 |
+
</width>
|
159 |
+
<top_offset translate="label comment">
|
160 |
+
<label>Top offset</label>
|
161 |
+
<comment>in pixels, (0 - to calculate the offset automatically)</comment>
|
162 |
+
<frontend_type>text</frontend_type>
|
163 |
+
<sort_order>3</sort_order>
|
164 |
+
<show_in_default>1</show_in_default>
|
165 |
+
<show_in_website>1</show_in_website>
|
166 |
+
<show_in_store>1</show_in_store>
|
167 |
+
</top_offset>
|
168 |
+
<delay_displaying translate="label comment">
|
169 |
+
<label>Delay before displaying</label>
|
170 |
+
<comment>in milliseconds</comment>
|
171 |
+
<frontend_type>text</frontend_type>
|
172 |
+
<sort_order>15</sort_order>
|
173 |
+
<show_in_default>1</show_in_default>
|
174 |
+
<show_in_website>1</show_in_website>
|
175 |
+
<show_in_store>1</show_in_store>
|
176 |
+
</delay_displaying>
|
177 |
+
<delay_hiding translate="label comment">
|
178 |
+
<label>Delay before hiding</label>
|
179 |
+
<comment>in milliseconds</comment>
|
180 |
+
<frontend_type>text</frontend_type>
|
181 |
+
<sort_order>20</sort_order>
|
182 |
+
<show_in_default>1</show_in_default>
|
183 |
+
<show_in_website>1</show_in_website>
|
184 |
+
<show_in_store>1</show_in_store>
|
185 |
+
</delay_hiding>
|
186 |
+
</fields>
|
187 |
+
</popup>
|
188 |
+
</groups>
|
189 |
+
</custom_menu>
|
190 |
+
<about_webandpeople translate="label" module="custommenu">
|
191 |
+
<label>About Us</label>
|
192 |
+
<tab>web_and_people</tab>
|
193 |
+
<frontend_type>text</frontend_type>
|
194 |
+
<sort_order>99</sort_order>
|
195 |
+
<show_in_default>1</show_in_default>
|
196 |
+
<show_in_website>1</show_in_website>
|
197 |
+
<show_in_store>1</show_in_store>
|
198 |
+
<groups>
|
199 |
+
<info>
|
200 |
+
<frontend_model>custommenu/about</frontend_model>
|
201 |
+
<sort_order>10</sort_order>
|
202 |
+
<show_in_default>1</show_in_default>
|
203 |
+
<show_in_website>1</show_in_website>
|
204 |
+
<show_in_store>1</show_in_store>
|
205 |
+
</info>
|
206 |
+
</groups>
|
207 |
+
</about_webandpeople>
|
208 |
+
</sections>
|
209 |
+
</config>
|
app/design/frontend/base/default/layout/custommenu.xml
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<layout version="0.1.0">
|
3 |
-
<default>
|
4 |
-
<reference name="head">
|
5 |
-
<action method="addCss" ifconfig="custom_menu/general/enabled"><stylesheet>css/custommenu.css</stylesheet></action>
|
6 |
-
<action method="addItem" ifconfig="custom_menu/general/enabled"><type>skin_js</type><name>js/custommenu.js</name></action>
|
7 |
-
</reference>
|
8 |
-
<reference name="catalog.topnav">
|
9 |
-
<action method="setTemplate" ifconfig="custom_menu/general/enabled"><template>custommenu/top.phtml</template></action>
|
10 |
-
</reference>
|
11 |
-
</default>
|
12 |
-
</layout>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/custommenu/top.phtml
DELETED
@@ -1,18 +0,0 @@
|
|
1 |
-
<?php $_categories = $this->getStoreCategories() ?>
|
2 |
-
<?php if(count($_categories)): ?>
|
3 |
-
<div class="nav-container">
|
4 |
-
<div id="custommenu">
|
5 |
-
<?php foreach ($_categories as $_category): ?>
|
6 |
-
<?php echo $this->drawCustomMenuItem($_category) ?>
|
7 |
-
<?php endforeach ?>
|
8 |
-
<div class="clearBoth"></div>
|
9 |
-
</div>
|
10 |
-
</div>
|
11 |
-
<script type="text/javascript">
|
12 |
-
//<![CDATA[
|
13 |
-
var CUSTOMMENU_POPUP_WIDTH = <?php echo (int)Mage::getStoreConfig('custom_menu/popup/width')?>;
|
14 |
-
var CUSTOMMENU_POPUP_TOP_OFFSET = <?php echo (int)Mage::getStoreConfig('custom_menu/popup/top_offset')?>;
|
15 |
-
var CUSTOMMENU_POPUP_RIGHT_OFFSET_MIN = <?php echo (int)Mage::getStoreConfig('custom_menu/popup/right_offset_min')?>;
|
16 |
-
//]]>
|
17 |
-
</script>
|
18 |
-
<?php endif ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/default/default/layout/webandpeople/custommenu.xml
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<default>
|
4 |
+
<block type="custommenu/toggle"></block>
|
5 |
+
</default>
|
6 |
+
</layout>
|
app/design/frontend/default/default/template/webandpeople/custommenu/top.phtml
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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="<?php echo $this->getUrl('') ?>">
|
12 |
+
<span><?php echo $this->__('Home'); ?></span>
|
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>
|
23 |
+
<script type="text/javascript">
|
24 |
+
//<![CDATA[
|
25 |
+
var CUSTOMMENU_POPUP_WIDTH = <?php echo Mage::getStoreConfig('custom_menu/popup/width') + 0; ?>;
|
26 |
+
var CUSTOMMENU_POPUP_TOP_OFFSET = <?php echo Mage::getStoreConfig('custom_menu/popup/top_offset') + 0; ?>;
|
27 |
+
var CUSTOMMENU_POPUP_DELAY_BEFORE_DISPLAYING = <?php echo Mage::getStoreConfig('custom_menu/popup/delay_displaying') + 0; ?>;
|
28 |
+
var CUSTOMMENU_POPUP_DELAY_BEFORE_HIDING = <?php echo Mage::getStoreConfig('custom_menu/popup/delay_hiding') + 0; ?>;
|
29 |
+
var CUSTOMMENU_RTL_MODE = <?php echo $_rtl; ?>;
|
30 |
+
var wpCustommenuTimerShow = {};
|
31 |
+
var wpCustommenuTimerHide = {};
|
32 |
+
var wpActiveMenu = null;
|
33 |
+
//]]>
|
34 |
+
</script>
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>wp_custom_menu</name>
|
4 |
-
<version>
|
5 |
<stability>stable</stability>
|
6 |
-
<license uri="http://
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>Custom
|
10 |
-
<description>Custom
|
11 |
-
<notes>+
|
12 |
<authors><author><name>WebAndPeople</name><user>auto-converted</user><email>design@webandpeople.com</email></author><author><name>y.gerassimenko</name><user>auto-converted</user><email>y.gerassimenko@webandpeople.com</email></author></authors>
|
13 |
-
<date>
|
14 |
-
<time>
|
15 |
-
<contents><target name="mageweb"><dir name="app"><dir name="code"><dir name="local"><dir name="WP"><dir name="CustomMenu"><dir name="Block"><file name="Navigation.php" hash="
|
16 |
<compatible/>
|
17 |
<dependencies/>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>wp_custom_menu</name>
|
4 |
+
<version>2.4.0</version>
|
5 |
<stability>stable</stability>
|
6 |
+
<license uri="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0 Unported 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>+ support touch screen (only android), ~ error if flat categories mode, ~ if empty categories</notes>
|
12 |
<authors><author><name>WebAndPeople</name><user>auto-converted</user><email>design@webandpeople.com</email></author><author><name>y.gerassimenko</name><user>auto-converted</user><email>y.gerassimenko@webandpeople.com</email></author></authors>
|
13 |
+
<date>2013-03-01</date>
|
14 |
+
<time>10:04:58</time>
|
15 |
+
<contents><target name="mageweb"><dir name="app"><dir name="code"><dir name="local"><dir name="WP"><dir name="CustomMenu"><dir name="Block"><file name="About.php" hash="4b43b7032da1d355a8d98add63e12af8"/><file name="Navigation.php" hash="e8994edde5446f9dc9bd5e7d7431a277"/><file name="Toggle.php" hash="b280abeb27613c14139a0f590048fcc7"/><file name="Topmenu.php" hash="7102b3bf0473dc5ecb0d66c12bfc6a95"/></dir><dir name="Helper"><file name="Data.php" hash="2e4bf439248df62e7936b59ba31994cc"/></dir><dir name="etc"><file name="config.xml" hash="3d6f2f5ac491239472b5a23cc0045b02"/><file name="system.xml" hash="c02e8881469bdb4fb5341fba2ef5d1a2"/></dir></dir></dir></dir></dir><dir name="design"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><dir name="webandpeople"><file name="custommenu.xml" hash="924c62b611df2b20ef35fccab8c87a86"/></dir></dir><dir name="template"><dir name="webandpeople"><dir name="custommenu"><file name="top.phtml" hash="7ef0543e00d047e00683bc449fc77f6f"/></dir></dir></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="WP_CustomMenu.xml" hash="cfe1d1974c20f4ac9f2d5ace4916c5ab"/></dir></dir></dir><dir name="skin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><dir name="webandpeople"><dir name="custommenu"><file name="custommenu.css" hash="679d419acd6e2de8a4358c1850926f6c"/></dir></dir></dir><dir name="js"><dir name="webandpeople"><dir name="custommenu"><file name="custommenu.js" hash="5b19bc1102e0e84a8efd41866d1acd0b"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies/>
|
18 |
</package>
|
skin/frontend/base/default/js/custommenu.js
DELETED
@@ -1,61 +0,0 @@
|
|
1 |
-
function wpShowMenuPopup(objMenu, popupId)
|
2 |
-
{
|
3 |
-
objMenu = $(objMenu.id); var popup = $(popupId); if (!popup) return;
|
4 |
-
popup.style.display = 'block';
|
5 |
-
objMenu.addClassName('active');
|
6 |
-
var popupWidth = CUSTOMMENU_POPUP_WIDTH;
|
7 |
-
if (!popupWidth) popupWidth = popup.getWidth();
|
8 |
-
var pos = wpPopupPos(objMenu, popupWidth);
|
9 |
-
popup.style.top = pos.top + 'px';
|
10 |
-
popup.style.left = pos.left + 'px';
|
11 |
-
if (CUSTOMMENU_POPUP_WIDTH) popup.style.width = CUSTOMMENU_POPUP_WIDTH + 'px';
|
12 |
-
}
|
13 |
-
|
14 |
-
function wpPopupPos(objMenu, w)
|
15 |
-
{
|
16 |
-
var pos = objMenu.cumulativeOffset();
|
17 |
-
var wraper = $('custommenu');
|
18 |
-
var posWraper = wraper.cumulativeOffset();
|
19 |
-
var wWraper = wraper.getWidth() - CUSTOMMENU_POPUP_RIGHT_OFFSET_MIN;
|
20 |
-
var xTop = pos.top - posWraper.top + CUSTOMMENU_POPUP_TOP_OFFSET;
|
21 |
-
var xLeft = pos.left - posWraper.left;
|
22 |
-
if ((xLeft + w) > wWraper) xLeft = wWraper - w;
|
23 |
-
return {'top': xTop, 'left': xLeft};
|
24 |
-
}
|
25 |
-
|
26 |
-
function wpHideMenuPopup(element, event, popupId, menuId)
|
27 |
-
{
|
28 |
-
element = $(element.id); var popup = $(popupId); if (!popup) return;
|
29 |
-
var current_mouse_target = null;
|
30 |
-
if (event.toElement)
|
31 |
-
{
|
32 |
-
current_mouse_target = event.toElement;
|
33 |
-
}
|
34 |
-
else if (event.relatedTarget)
|
35 |
-
{
|
36 |
-
current_mouse_target = event.relatedTarget;
|
37 |
-
}
|
38 |
-
if (!wpIsChildOf(element, current_mouse_target) && element != current_mouse_target)
|
39 |
-
{
|
40 |
-
if (!wpIsChildOf(popup, current_mouse_target) && popup != current_mouse_target)
|
41 |
-
{
|
42 |
-
popup.style.display = 'none';
|
43 |
-
$(menuId).removeClassName('active');
|
44 |
-
}
|
45 |
-
}
|
46 |
-
}
|
47 |
-
|
48 |
-
function wpIsChildOf(parent, child)
|
49 |
-
{
|
50 |
-
if (child != null)
|
51 |
-
{
|
52 |
-
while (child.parentNode)
|
53 |
-
{
|
54 |
-
if ((child = child.parentNode) == parent)
|
55 |
-
{
|
56 |
-
return true;
|
57 |
-
}
|
58 |
-
}
|
59 |
-
}
|
60 |
-
return false;
|
61 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/frontend/{base/default/css → default/default/css/webandpeople/custommenu}/custommenu.css
RENAMED
@@ -1,49 +1,55 @@
|
|
1 |
-
#custommenu {
|
2 |
-
position:relative;
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
}
|
9 |
-
div.menu {
|
10 |
-
float: left;
|
11 |
-
}
|
12 |
-
div.menu.act {
|
13 |
-
background-color:#ADD8E6;
|
14 |
-
}
|
15 |
-
div.menu.active {
|
16 |
-
background-color:#FFC0CB;
|
17 |
-
}
|
18 |
-
div.popup {
|
19 |
-
position:absolute;
|
20 |
-
z-index:3000;
|
21 |
-
border:5px solid #FFC0CB;
|
22 |
-
display: none;
|
23 |
-
background-color:#fff;
|
24 |
-
text-align:left;
|
25 |
-
}
|
26 |
-
div.menu, div.popup {
|
27 |
-
padding: 5px 12px 6px 8px;
|
28 |
-
}
|
29 |
-
div.menu a, div.popup a {
|
30 |
-
text-decoration: none;
|
31 |
-
display:block;
|
32 |
-
}
|
33 |
-
div.popup a.actParent {
|
34 |
-
color: #4D4D4D;
|
35 |
-
}
|
36 |
-
div.popup a.act {
|
37 |
-
color: #A52A2A;
|
38 |
-
}
|
39 |
-
div.column {
|
40 |
-
float:left;
|
41 |
-
width:200px; /* column width */
|
42 |
-
padding:5px;
|
43 |
-
}
|
44 |
-
div.itemSubMenu {
|
45 |
-
margin-left:20px;
|
46 |
-
}
|
47 |
-
.clearBoth {
|
48 |
-
clear:both;
|
49 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#custommenu {
|
2 |
+
position:relative;
|
3 |
+
font-size: 14px;
|
4 |
+
margin: 0 auto;
|
5 |
+
padding: 0 16px;
|
6 |
+
width: 918px;
|
7 |
+
z-index: 999;
|
8 |
+
}
|
9 |
+
div.menu {
|
10 |
+
float: left;
|
11 |
+
}
|
12 |
+
div.menu.act {
|
13 |
+
background-color:#ADD8E6;
|
14 |
+
}
|
15 |
+
div.menu.active {
|
16 |
+
background-color:#FFC0CB;
|
17 |
+
}
|
18 |
+
div.wp-custom-menu-popup {
|
19 |
+
position:absolute;
|
20 |
+
z-index:3000;
|
21 |
+
border:5px solid #FFC0CB;
|
22 |
+
display: none;
|
23 |
+
background-color:#fff;
|
24 |
+
text-align:left;
|
25 |
+
}
|
26 |
+
div.menu, div.wp-custom-menu-popup {
|
27 |
+
padding: 5px 12px 6px 8px;
|
28 |
+
}
|
29 |
+
div.menu a, div.wp-custom-menu-popup a {
|
30 |
+
text-decoration: none;
|
31 |
+
display:block;
|
32 |
+
}
|
33 |
+
div.wp-custom-menu-popup a.actParent {
|
34 |
+
color: #4D4D4D;
|
35 |
+
}
|
36 |
+
div.wp-custom-menu-popup a.act {
|
37 |
+
color: #A52A2A;
|
38 |
+
}
|
39 |
+
div.column {
|
40 |
+
float:left;
|
41 |
+
width:200px; /* column width */
|
42 |
+
padding:5px;
|
43 |
+
}
|
44 |
+
div.itemSubMenu {
|
45 |
+
margin-left:20px;
|
46 |
+
}
|
47 |
+
.clearBoth {
|
48 |
+
clear:both;
|
49 |
+
}
|
50 |
+
#custommenu.rtl .menu {
|
51 |
+
float: right;
|
52 |
+
}
|
53 |
+
#custommenu.rtl div.column {
|
54 |
+
text-align: right;
|
55 |
+
}
|
skin/frontend/default/default/js/webandpeople/custommenu/custommenu.js
ADDED
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
function wpShowMenuPopup(objMenu, event, popupId)
|
2 |
+
{
|
3 |
+
if (typeof wpCustommenuTimerHide[popupId] != 'undefined') clearTimeout(wpCustommenuTimerHide[popupId]);
|
4 |
+
objMenu = $(objMenu.id); var popup = $(popupId); if (!popup) return;
|
5 |
+
if (!!wpActiveMenu) {
|
6 |
+
wpHideMenuPopup(objMenu, event, wpActiveMenu.popupId, wpActiveMenu.menuId);
|
7 |
+
}
|
8 |
+
wpActiveMenu = {menuId: objMenu.id, popupId: popupId};
|
9 |
+
if (!objMenu.hasClassName('active')) {
|
10 |
+
wpCustommenuTimerShow[popupId] = setTimeout(function() {
|
11 |
+
objMenu.addClassName('active');
|
12 |
+
var popupWidth = CUSTOMMENU_POPUP_WIDTH;
|
13 |
+
if (!popupWidth) popupWidth = popup.getWidth();
|
14 |
+
var pos = wpPopupPos(objMenu, popupWidth);
|
15 |
+
popup.style.top = pos.top + 'px';
|
16 |
+
popup.style.left = pos.left + 'px';
|
17 |
+
wpSetPopupZIndex(popup);
|
18 |
+
if (CUSTOMMENU_POPUP_WIDTH)
|
19 |
+
popup.style.width = CUSTOMMENU_POPUP_WIDTH + 'px';
|
20 |
+
// --- Static Block width ---
|
21 |
+
var block2 = $(popupId).select('div.block2');
|
22 |
+
if (typeof block2[0] != 'undefined') {
|
23 |
+
var wStart = block2[0].id.indexOf('_w');
|
24 |
+
if (wStart > -1) {
|
25 |
+
var w = block2[0].id.substr(wStart+2);
|
26 |
+
} else {
|
27 |
+
var w = 0;
|
28 |
+
$(popupId).select('div.block1 div.column').each(function(item) {
|
29 |
+
w += $(item).getWidth();
|
30 |
+
});
|
31 |
+
}
|
32 |
+
if (w) block2[0].style.width = w + 'px';
|
33 |
+
}
|
34 |
+
// --- change href ---
|
35 |
+
var wpMenuAnchor = $(objMenu.select('a')[0]);
|
36 |
+
wpChangeTopMenuHref(wpMenuAnchor);
|
37 |
+
// --- show popup ---
|
38 |
+
popup.style.display = 'block';
|
39 |
+
//jQuery('#' + popupId).stop(true, true).fadeIn();
|
40 |
+
}, CUSTOMMENU_POPUP_DELAY_BEFORE_DISPLAYING);
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
+
function wpHideMenuPopup(element, event, popupId, menuId)
|
45 |
+
{
|
46 |
+
if (typeof wpCustommenuTimerShow[popupId] != 'undefined') clearTimeout(wpCustommenuTimerShow[popupId]);
|
47 |
+
var element = $(element); var objMenu = $(menuId) ;var popup = $(popupId); if (!popup) return;
|
48 |
+
var wpCurrentMouseTarget = getCurrentMouseTarget(event);
|
49 |
+
if (!!wpCurrentMouseTarget) {
|
50 |
+
if (!wpIsChildOf(element, wpCurrentMouseTarget) && element != wpCurrentMouseTarget) {
|
51 |
+
if (!wpIsChildOf(popup, wpCurrentMouseTarget) && popup != wpCurrentMouseTarget) {
|
52 |
+
if (objMenu.hasClassName('active')) {
|
53 |
+
wpCustommenuTimerHide[popupId] = setTimeout(function() {
|
54 |
+
objMenu.removeClassName('active');
|
55 |
+
// --- change href ---
|
56 |
+
var wpMenuAnchor = $(objMenu.select('a')[0]);
|
57 |
+
wpChangeTopMenuHref(wpMenuAnchor);
|
58 |
+
// --- hide popup ---
|
59 |
+
popup.style.display = 'none';
|
60 |
+
//jQuery('#' + popupId).stop(true, true).fadeOut();
|
61 |
+
}, CUSTOMMENU_POPUP_DELAY_BEFORE_HIDING);
|
62 |
+
}
|
63 |
+
}
|
64 |
+
}
|
65 |
+
}
|
66 |
+
}
|
67 |
+
|
68 |
+
function wpPopupOver(element, event, popupId, menuId)
|
69 |
+
{
|
70 |
+
if (typeof wpCustommenuTimerHide[popupId] != 'undefined') clearTimeout(wpCustommenuTimerHide[popupId]);
|
71 |
+
}
|
72 |
+
|
73 |
+
function wpPopupPos(objMenu, w)
|
74 |
+
{
|
75 |
+
var pos = objMenu.cumulativeOffset();
|
76 |
+
var wraper = $('custommenu');
|
77 |
+
var posWraper = wraper.cumulativeOffset();
|
78 |
+
var xTop = pos.top - posWraper.top
|
79 |
+
if (CUSTOMMENU_POPUP_TOP_OFFSET) {
|
80 |
+
xTop += CUSTOMMENU_POPUP_TOP_OFFSET;
|
81 |
+
} else {
|
82 |
+
xTop += objMenu.getHeight();
|
83 |
+
}
|
84 |
+
var res = {'top': xTop};
|
85 |
+
if (CUSTOMMENU_RTL_MODE) {
|
86 |
+
var xLeft = pos.left - posWraper.left - w + objMenu.getWidth();
|
87 |
+
if (xLeft < 0) xLeft = 0;
|
88 |
+
res.left = xLeft;
|
89 |
+
} else {
|
90 |
+
var wWraper = wraper.getWidth();
|
91 |
+
var xLeft = pos.left - posWraper.left;
|
92 |
+
if ((xLeft + w) > wWraper) xLeft = wWraper - w;
|
93 |
+
if (xLeft < 0) xLeft = 0;
|
94 |
+
res.left = xLeft;
|
95 |
+
}
|
96 |
+
return res;
|
97 |
+
}
|
98 |
+
|
99 |
+
function wpChangeTopMenuHref(wpMenuAnchor)
|
100 |
+
{
|
101 |
+
var wpValue = wpMenuAnchor.href;
|
102 |
+
wpMenuAnchor.href = wpMenuAnchor.rel;
|
103 |
+
wpMenuAnchor.rel = wpValue;
|
104 |
+
}
|
105 |
+
|
106 |
+
function wpIsChildOf(parent, child)
|
107 |
+
{
|
108 |
+
if (child != null) {
|
109 |
+
while (child.parentNode) {
|
110 |
+
if ((child = child.parentNode) == parent) {
|
111 |
+
return true;
|
112 |
+
}
|
113 |
+
}
|
114 |
+
}
|
115 |
+
return false;
|
116 |
+
}
|
117 |
+
|
118 |
+
function wpSetPopupZIndex(popup)
|
119 |
+
{
|
120 |
+
$$('.wp-custom-menu-popup').each(function(item){
|
121 |
+
item.style.zIndex = '9999';
|
122 |
+
});
|
123 |
+
popup.style.zIndex = '10000';
|
124 |
+
}
|
125 |
+
|
126 |
+
function getCurrentMouseTarget(xEvent)
|
127 |
+
{
|
128 |
+
var wpCurrentMouseTarget = null;
|
129 |
+
if (xEvent.toElement) {
|
130 |
+
wpCurrentMouseTarget = xEvent.toElement;
|
131 |
+
} else if (xEvent.relatedTarget) {
|
132 |
+
wpCurrentMouseTarget = xEvent.relatedTarget;
|
133 |
+
}
|
134 |
+
return wpCurrentMouseTarget;
|
135 |
+
}
|
136 |
+
/*
|
137 |
+
Event.observe(document, 'click', function (event) {
|
138 |
+
if (!!wpActiveMenu) {
|
139 |
+
var element = event.element();
|
140 |
+
if (!!element) {
|
141 |
+
var menuObj = $(wpActiveMenu.menuId);
|
142 |
+
var popupObj = $(wpActiveMenu.popupId);
|
143 |
+
if (!wpIsChildOf(menuObj, element) && menuObj != element) {
|
144 |
+
if (!wpIsChildOf(popupObj, element) && popupObj != element) {
|
145 |
+
wpHideMenuPopup(element, event, wpActiveMenu.popupId, wpActiveMenu.menuId);
|
146 |
+
wpActiveMenu = null;
|
147 |
+
}
|
148 |
+
}
|
149 |
+
}
|
150 |
+
}
|
151 |
+
});
|
152 |
+
*/
|