Version Notes
- Fixed tables creation for implementations with tables prefix.
- Added the option to disable the "View All" link.
- Added custom events for 3rd party integrations.
Download this release
Release Info
Developer | Damian A. Pastorini |
Extension | DwD_CmsMenu |
Version | 0.1.5 |
Comparing to | |
See all releases |
Code changes from version 0.1.4 to 0.1.5
- app/code/community/DwD/CmsMenu/Block/Adminhtml/Cms/Page/Edit/Tab/Content.php +1 -0
- app/code/community/DwD/CmsMenu/Block/Page/Html/Topmenu/Observer.php +43 -53
- app/code/community/DwD/CmsMenu/Model/Mysql4/Cmsmenu/Collection.php +15 -3
- app/code/community/DwD/CmsMenu/Model/Observer.php +5 -0
- app/code/community/DwD/CmsMenu/etc/config.xml +9 -1
- app/code/community/DwD/CmsMenu/etc/system.xml +9 -0
- app/code/community/DwD/CmsMenu/sql/cmsmenu_setup/mysql4-upgrade-0.1.4-0.1.5.php +31 -0
- app/design/frontend/base/default/layout/dwd_cmsmenu.xml +22 -0
- app/design/frontend/base/default/template/dwd/cmsmenu/page/html/topmenu/renderer.phtml +84 -0
- package.xml +7 -6
app/code/community/DwD/CmsMenu/Block/Adminhtml/Cms/Page/Edit/Tab/Content.php
CHANGED
@@ -45,6 +45,7 @@ class DwD_CmsMenu_Block_Adminhtml_Cms_Page_Edit_Tab_Content extends Mage_Adminht
|
|
45 |
'values' => $fathersList,
|
46 |
'note' => Mage::helper('cms')->__('If empty the item will be added as last. If you have multiple items without this value those will be added at the end ordered by the identifier.'),
|
47 |
));
|
|
|
48 |
}
|
49 |
}
|
50 |
|
45 |
'values' => $fathersList,
|
46 |
'note' => Mage::helper('cms')->__('If empty the item will be added as last. If you have multiple items without this value those will be added at the end ordered by the identifier.'),
|
47 |
));
|
48 |
+
Mage::dispatchEvent('cmsmenu_add_form_items_after', $observer->getData());
|
49 |
}
|
50 |
}
|
51 |
|
app/code/community/DwD/CmsMenu/Block/Page/Html/Topmenu/Observer.php
CHANGED
@@ -16,12 +16,9 @@ class DwD_CmsMenu_Block_Page_Html_Topmenu_Observer extends Mage_Page_Block_Html_
|
|
16 |
{
|
17 |
$isEnabled = Mage::getStoreConfig('dwd_cmsmenu/general/enabled');
|
18 |
if($isEnabled) {
|
|
|
19 |
// get all items that should be added at the end of the tree:
|
20 |
-
$cmsMenuItems =
|
21 |
-
->getCollection()
|
22 |
-
->addActiveFilter()
|
23 |
-
->setChildOfOrder()
|
24 |
-
->setAddBeforeOrder();
|
25 |
// loop items and add to the menu:
|
26 |
foreach ($cmsMenuItems as $menuItem) {
|
27 |
// get item name:
|
@@ -45,7 +42,7 @@ class DwD_CmsMenu_Block_Page_Html_Topmenu_Observer extends Mage_Page_Block_Html_
|
|
45 |
// child of items:
|
46 |
if($menuItem->getChildOf()) {
|
47 |
// get all child nodes:
|
48 |
-
$allChildNodes = $
|
49 |
// look for the parent item:
|
50 |
$parentItem = false;
|
51 |
// get child of value:
|
@@ -55,61 +52,26 @@ class DwD_CmsMenu_Block_Page_Html_Topmenu_Observer extends Mage_Page_Block_Html_
|
|
55 |
$parentItem = $allChildNodes[$childOf];
|
56 |
}
|
57 |
if($parentItem) {
|
58 |
-
|
59 |
-
$itemNode = new Varien_Data_Tree_Node($itemNodeData, 'cmsmenu-'.$menuItem->getCmsPageId(), $parentItem->getTree());
|
60 |
-
if(!$menuItem->getAddBefore()) {
|
61 |
-
// add item at the end:
|
62 |
-
$parentItem->addChild($itemNode);
|
63 |
-
} else {
|
64 |
-
// add before case, get parent item childs:
|
65 |
-
$currentChilds = $parentItem->getChildren();
|
66 |
-
if($currentChilds) {
|
67 |
-
// loop and reorder items:
|
68 |
-
foreach($currentChilds as $childIndex => $currentChild) {
|
69 |
-
$parentItem->removeChild($currentChild);
|
70 |
-
$addBeforeValue = $this->formatedItemValue($menuItem->getAddBefore());
|
71 |
-
if($childIndex == $addBeforeValue) {
|
72 |
-
$parentItem->addChild($itemNode);
|
73 |
-
}
|
74 |
-
$parentItem->addChild($currentChild);
|
75 |
-
}
|
76 |
-
} else {
|
77 |
-
// if there are no childs add the item normally:
|
78 |
-
$parentItem->addChild($itemNode);
|
79 |
-
}
|
80 |
-
}
|
81 |
}
|
82 |
} else {
|
83 |
-
|
84 |
-
$itemNode = new Varien_Data_Tree_Node($itemNodeData, 'cmsmenu-' . $menuItem->getCmsPageId(), $observer->getMenu()->getTree());
|
85 |
-
// top level items:
|
86 |
-
if(!$menuItem->getAddBefore()) {
|
87 |
-
// add item at the end:
|
88 |
-
$observer->getMenu()->addChild($itemNode);
|
89 |
-
} else {
|
90 |
-
// get menu items:
|
91 |
-
$currentChilds = $observer->getMenu()->getChildren();
|
92 |
-
if($currentChilds) {
|
93 |
-
// loop and reorder items:
|
94 |
-
foreach($currentChilds as $childIndex => $currentChild) {
|
95 |
-
$observer->getMenu()->removeChild($currentChild);
|
96 |
-
$addBeforeValue = $this->formatedItemValue($menuItem->getAddBefore());
|
97 |
-
if($childIndex == $addBeforeValue) {
|
98 |
-
$observer->getMenu()->addChild($itemNode);
|
99 |
-
}
|
100 |
-
$observer->getMenu()->addChild($currentChild);
|
101 |
-
}
|
102 |
-
} else {
|
103 |
-
// if there are no items just add the child normally:
|
104 |
-
$observer->getMenu()->addChild($itemNode);
|
105 |
-
}
|
106 |
-
}
|
107 |
}
|
108 |
}
|
109 |
}
|
110 |
return $observer;
|
111 |
}
|
112 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
public function getItemName($menuItem)
|
114 |
{
|
115 |
$itemName = $menuItem->getMenuItemTitle();
|
@@ -145,4 +107,32 @@ class DwD_CmsMenu_Block_Page_Html_Topmenu_Observer extends Mage_Page_Block_Html_
|
|
145 |
return $result;
|
146 |
}
|
147 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
}
|
16 |
{
|
17 |
$isEnabled = Mage::getStoreConfig('dwd_cmsmenu/general/enabled');
|
18 |
if($isEnabled) {
|
19 |
+
$topMenu = $observer->getMenu();
|
20 |
// get all items that should be added at the end of the tree:
|
21 |
+
$cmsMenuItems = $this->getCmsMenuItems();
|
|
|
|
|
|
|
|
|
22 |
// loop items and add to the menu:
|
23 |
foreach ($cmsMenuItems as $menuItem) {
|
24 |
// get item name:
|
42 |
// child of items:
|
43 |
if($menuItem->getChildOf()) {
|
44 |
// get all child nodes:
|
45 |
+
$allChildNodes = $topMenu->getAllChildNodes();
|
46 |
// look for the parent item:
|
47 |
$parentItem = false;
|
48 |
// get child of value:
|
52 |
$parentItem = $allChildNodes[$childOf];
|
53 |
}
|
54 |
if($parentItem) {
|
55 |
+
$this->createAndAssignItemNode($menuItem, $itemNodeData, $parentItem);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
}
|
57 |
} else {
|
58 |
+
$this->createAndAssignItemNode($menuItem, $itemNodeData, $topMenu);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
}
|
60 |
}
|
61 |
}
|
62 |
return $observer;
|
63 |
}
|
64 |
|
65 |
+
protected function getCmsMenuItems()
|
66 |
+
{
|
67 |
+
$collection = Mage::getModel('dwd_cmsmenu/cmsmenu')
|
68 |
+
->getCollection()
|
69 |
+
->addActiveFilter()
|
70 |
+
->setChildOfOrder()
|
71 |
+
->setAddBeforeOrder();
|
72 |
+
return $collection;
|
73 |
+
}
|
74 |
+
|
75 |
public function getItemName($menuItem)
|
76 |
{
|
77 |
$itemName = $menuItem->getMenuItemTitle();
|
107 |
return $result;
|
108 |
}
|
109 |
|
110 |
+
public function createAndAssignItemNode($menuItem, $itemNodeData, $parentMenu)
|
111 |
+
{
|
112 |
+
// create new node:
|
113 |
+
$itemNode = new Varien_Data_Tree_Node($itemNodeData, 'cmsmenu-' . $menuItem->getCmsPageId(), $parentMenu->getTree());
|
114 |
+
// top level items:
|
115 |
+
if(!$menuItem->getAddBefore()) {
|
116 |
+
// add item at the end:
|
117 |
+
$parentMenu->addChild($itemNode);
|
118 |
+
} else {
|
119 |
+
// get menu items:
|
120 |
+
$currentChilds = $parentMenu->getChildren();
|
121 |
+
if($currentChilds) {
|
122 |
+
// loop and reorder items:
|
123 |
+
foreach($currentChilds as $childIndex => $currentChild) {
|
124 |
+
$parentMenu->removeChild($currentChild);
|
125 |
+
$addBeforeValue = $this->formatedItemValue($menuItem->getAddBefore());
|
126 |
+
if($childIndex == $addBeforeValue) {
|
127 |
+
$parentMenu->addChild($itemNode);
|
128 |
+
}
|
129 |
+
$parentMenu->addChild($currentChild);
|
130 |
+
}
|
131 |
+
} else {
|
132 |
+
// if there are no items just add the child normally:
|
133 |
+
$parentMenu->addChild($itemNode);
|
134 |
+
}
|
135 |
+
}
|
136 |
+
}
|
137 |
+
|
138 |
}
|
app/code/community/DwD/CmsMenu/Model/Mysql4/Cmsmenu/Collection.php
CHANGED
@@ -23,7 +23,7 @@ class DwD_CmsMenu_Model_Mysql4_Cmsmenu_Collection extends Mage_Core_Model_Mysql4
|
|
23 |
return $this;
|
24 |
}
|
25 |
|
26 |
-
public function addChildOfFilter($childOf=false)
|
27 |
{
|
28 |
if(!$childOf) {
|
29 |
$this->addFieldToFilter('child_of', array('attribute' => 'child_of', array('eq'=>'0', 'null'=>true)));
|
@@ -33,9 +33,21 @@ class DwD_CmsMenu_Model_Mysql4_Cmsmenu_Collection extends Mage_Core_Model_Mysql4
|
|
33 |
return $this;
|
34 |
}
|
35 |
|
36 |
-
public function addBeforeFilter()
|
37 |
{
|
38 |
-
$this->addFieldToFilter('add_before', array('attribute' => 'add_before', 'notnull' =>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
return $this;
|
40 |
}
|
41 |
|
23 |
return $this;
|
24 |
}
|
25 |
|
26 |
+
public function addChildOfFilter($childOf = false)
|
27 |
{
|
28 |
if(!$childOf) {
|
29 |
$this->addFieldToFilter('child_of', array('attribute' => 'child_of', array('eq'=>'0', 'null'=>true)));
|
33 |
return $this;
|
34 |
}
|
35 |
|
36 |
+
public function addBeforeFilter($notNull = true)
|
37 |
{
|
38 |
+
$this->addFieldToFilter('add_before', array('attribute' => 'add_before', 'notnull' => $notNull));
|
39 |
+
return $this;
|
40 |
+
}
|
41 |
+
|
42 |
+
public function addBeforeIdFilter($beforeId)
|
43 |
+
{
|
44 |
+
$this->addFieldToFilter('add_before', array('attribute' => 'add_before', 'eq' => (string) $beforeId));
|
45 |
+
return $this;
|
46 |
+
}
|
47 |
+
|
48 |
+
public function addLevelFilter($level)
|
49 |
+
{
|
50 |
+
$this->addFieldToFilter('level', array('attribute' => 'level', 'eq' => $level));
|
51 |
return $this;
|
52 |
}
|
53 |
|
app/code/community/DwD/CmsMenu/Model/Observer.php
CHANGED
@@ -36,6 +36,8 @@ class DwD_CmsMenu_Model_Observer
|
|
36 |
$itemTitle = $post['title'];
|
37 |
}
|
38 |
$cmsMenu->setMenuItemTitle($itemTitle);
|
|
|
|
|
39 |
$cmsMenu->save();
|
40 |
$flushCache = Mage::getStoreConfig('dwd_cmsmenu/general/cache');
|
41 |
if($flushCache) {
|
@@ -44,6 +46,7 @@ class DwD_CmsMenu_Model_Observer
|
|
44 |
} catch (Exception $e) {
|
45 |
Mage::log($e->getMessage(), null, 'dwd-cmsmenu-error.log');
|
46 |
}
|
|
|
47 |
}
|
48 |
}
|
49 |
|
@@ -59,6 +62,8 @@ class DwD_CmsMenu_Model_Observer
|
|
59 |
$page->setData('add_before', $cmsMenu->getAddBefore());
|
60 |
$page->setData('menu_item_title', $cmsMenu->getMenuItemTitle());
|
61 |
$page->setData('level', $cmsMenu->getLevel());
|
|
|
|
|
62 |
return $page;
|
63 |
}
|
64 |
}
|
36 |
$itemTitle = $post['title'];
|
37 |
}
|
38 |
$cmsMenu->setMenuItemTitle($itemTitle);
|
39 |
+
$observerDataArray = array_merge($observer->getData(), array('cmsmenu'=>$cmsMenu, 'post'=>$post));
|
40 |
+
Mage::dispatchEvent('cmsmenu_save_item_before', $observerDataArray);
|
41 |
$cmsMenu->save();
|
42 |
$flushCache = Mage::getStoreConfig('dwd_cmsmenu/general/cache');
|
43 |
if($flushCache) {
|
46 |
} catch (Exception $e) {
|
47 |
Mage::log($e->getMessage(), null, 'dwd-cmsmenu-error.log');
|
48 |
}
|
49 |
+
Mage::dispatchEvent('cmsmenu_save_item_after', $observer->getData());
|
50 |
}
|
51 |
}
|
52 |
|
62 |
$page->setData('add_before', $cmsMenu->getAddBefore());
|
63 |
$page->setData('menu_item_title', $cmsMenu->getMenuItemTitle());
|
64 |
$page->setData('level', $cmsMenu->getLevel());
|
65 |
+
$observerDataArray = array_merge($observer->getData(), array('page'=>$page, 'cmsmenu'=>$cmsMenu));
|
66 |
+
Mage::dispatchEvent('cmsmenu_add_cms_page_data_after', $observerDataArray);
|
67 |
return $page;
|
68 |
}
|
69 |
}
|
app/code/community/DwD/CmsMenu/etc/config.xml
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
<config>
|
13 |
<modules>
|
14 |
<DwD_CmsMenu>
|
15 |
-
<version>0.1.
|
16 |
</DwD_CmsMenu>
|
17 |
</modules>
|
18 |
<global>
|
@@ -79,6 +79,7 @@
|
|
79 |
<general>
|
80 |
<enabled>1</enabled>
|
81 |
<cache>1</cache>
|
|
|
82 |
</general>
|
83 |
</dwd_cmsmenu>
|
84 |
</default>
|
@@ -93,6 +94,13 @@
|
|
93 |
</observers>
|
94 |
</page_block_html_topmenu_gethtml_before>
|
95 |
</events>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
</frontend>
|
97 |
<adminhtml>
|
98 |
<events>
|
12 |
<config>
|
13 |
<modules>
|
14 |
<DwD_CmsMenu>
|
15 |
+
<version>0.1.5</version>
|
16 |
</DwD_CmsMenu>
|
17 |
</modules>
|
18 |
<global>
|
79 |
<general>
|
80 |
<enabled>1</enabled>
|
81 |
<cache>1</cache>
|
82 |
+
<show_view_all>0</show_view_all>
|
83 |
</general>
|
84 |
</dwd_cmsmenu>
|
85 |
</default>
|
94 |
</observers>
|
95 |
</page_block_html_topmenu_gethtml_before>
|
96 |
</events>
|
97 |
+
<layout>
|
98 |
+
<updates>
|
99 |
+
<dwd_cmsmenu>
|
100 |
+
<file>dwd_cmsmenu.xml</file>
|
101 |
+
</dwd_cmsmenu>
|
102 |
+
</updates>
|
103 |
+
</layout>
|
104 |
</frontend>
|
105 |
<adminhtml>
|
106 |
<events>
|
app/code/community/DwD/CmsMenu/etc/system.xml
CHANGED
@@ -53,6 +53,15 @@
|
|
53 |
<show_in_store>1</show_in_store>
|
54 |
<comment>This will flush the Magento Cache every time a CMS Page was saved to reflect the menu modifications automatically.</comment>
|
55 |
</cache>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
</fields>
|
57 |
</general>
|
58 |
</groups>
|
53 |
<show_in_store>1</show_in_store>
|
54 |
<comment>This will flush the Magento Cache every time a CMS Page was saved to reflect the menu modifications automatically.</comment>
|
55 |
</cache>
|
56 |
+
<show_view_all translate="label">
|
57 |
+
<label>Show "View All" Link</label>
|
58 |
+
<frontend_type>select</frontend_type>
|
59 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
60 |
+
<sort_order>3</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_view_all>
|
65 |
</fields>
|
66 |
</general>
|
67 |
</groups>
|
app/code/community/DwD/CmsMenu/sql/cmsmenu_setup/mysql4-upgrade-0.1.4-0.1.5.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
*
|
5 |
+
* DwD-CmsMenu - Magento Extension
|
6 |
+
*
|
7 |
+
* @copyright Copyright (c) 2015 DwDesigner Inc. (http://www.dwdeveloper.com/)
|
8 |
+
* @author Damian A. Pastorini - damian.pastorini@dwdeveloper.com
|
9 |
+
*
|
10 |
+
*/
|
11 |
+
|
12 |
+
$installer = $this;
|
13 |
+
|
14 |
+
$installer->startSetup();
|
15 |
+
|
16 |
+
// cmsmenu table:
|
17 |
+
$table = $this->getTable('dwd_cmsmenu/cmsmenu');
|
18 |
+
|
19 |
+
// cms pages table:
|
20 |
+
$tableCmsPages = $this->getTable('cms/page');
|
21 |
+
Mage::log($tableCmsPages, null, 'dwd-cmsmenu-error.log', true);
|
22 |
+
|
23 |
+
// remove old foreign key:
|
24 |
+
$installer->run("ALTER TABLE {$table} DROP FOREIGN KEY `FK_cmsmenu_cms_page`;");
|
25 |
+
Mage::log("ALTER TABLE {$table} DROP FOREIGN KEY `FK_cmsmenu_cms_page`;", null, 'dwd-cmsmenu-error.log', true);
|
26 |
+
|
27 |
+
// add fixed foreign key:
|
28 |
+
$installer->run("ALTER TABLE {$table} ADD CONSTRAINT `FK_cmsmenu_cms_page` FOREIGN KEY (`cms_page_id`) REFERENCES {$tableCmsPages} (`page_id`);");
|
29 |
+
Mage::log("ALTER TABLE {$table} ADD CONSTRAINT `FK_cmsmenu_cms_page` FOREIGN KEY (`cms_page_id`) REFERENCES {$tableCmsPages} (`page_id`);", null, 'dwd-cmsmenu-error.log', true);
|
30 |
+
|
31 |
+
$installer->endSetup();
|
app/design/frontend/base/default/layout/dwd_cmsmenu.xml
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
*
|
5 |
+
* DwD-CmsMenu - Magento Extension
|
6 |
+
*
|
7 |
+
* @copyright Copyright (c) 2015 DwDesigner Inc. (http://www.dwdeveloper.com/)
|
8 |
+
* @author Damian A. Pastorini - damian.pastorini@dwdeveloper.com
|
9 |
+
*
|
10 |
+
*/
|
11 |
+
-->
|
12 |
+
<layout version="0.1.0">
|
13 |
+
|
14 |
+
<default>
|
15 |
+
<reference name="catalog.topnav.renderer">
|
16 |
+
<action ifconfig="dwd_cmsmenu/general/show_view_all" method="setTemplate">
|
17 |
+
<name>dwd/cmsmenu/page/html/topmenu/renderer.phtml</name>
|
18 |
+
</action>
|
19 |
+
</reference>
|
20 |
+
</default>
|
21 |
+
|
22 |
+
</layout>
|
app/design/frontend/base/default/template/dwd/cmsmenu/page/html/topmenu/renderer.phtml
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magento.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magento.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package rwd_default
|
23 |
+
* @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/** @var Mage_Page_Block_Html_Topmenu_Renderer $this */
|
28 |
+
/** @var Varien_Data_Tree_Node $menuTree */
|
29 |
+
/** @var string $childrenWrapClass */
|
30 |
+
|
31 |
+
$html = '';
|
32 |
+
|
33 |
+
$children = $menuTree->getChildren();
|
34 |
+
$parentLevel = $menuTree->getLevel();
|
35 |
+
$childLevel = is_null($parentLevel) ? 0 : $parentLevel + 1;
|
36 |
+
|
37 |
+
$counter = 1;
|
38 |
+
$childrenCount = $children->count();
|
39 |
+
|
40 |
+
$parentPositionClass = $menuTree->getPositionClass();
|
41 |
+
$itemPositionClassPrefix = $parentPositionClass ? $parentPositionClass . '-' : 'nav-';
|
42 |
+
|
43 |
+
foreach ($children as $child) {
|
44 |
+
$child->setLevel($childLevel);
|
45 |
+
$child->setIsFirst($counter == 1);
|
46 |
+
$child->setIsLast($counter == $childrenCount);
|
47 |
+
$child->setPositionClass($itemPositionClassPrefix . $counter);
|
48 |
+
|
49 |
+
$outermostClassCode = 'level'. $childLevel;
|
50 |
+
$_hasChildren = ($child->hasChildren()) ? 'has-children' : '';
|
51 |
+
|
52 |
+
$html .= '<li '. $this->_getRenderedMenuItemAttributes($child) .'>';
|
53 |
+
|
54 |
+
$html .= '<a href="'. $child->getUrl() .'" class="'. $outermostClassCode .' '. $_hasChildren .'">'. $this->escapeHtml($this->__($child->getName())) .'</a>';
|
55 |
+
|
56 |
+
if (!empty($childrenWrapClass)) {
|
57 |
+
$html .= '<div class="'. $childrenWrapClass .'">';
|
58 |
+
}
|
59 |
+
|
60 |
+
$nextChildLevel = $childLevel + 1;
|
61 |
+
|
62 |
+
if (!empty($_hasChildren)) {
|
63 |
+
$html .= '<ul class="level'. $childLevel .'">';
|
64 |
+
if(Mage::getStoreConfig('dwd_cmsmenu/general/show_view_all')) {
|
65 |
+
$html .= '<li class="level'. $nextChildLevel .' view-all">';
|
66 |
+
$html .= '<a class="level'. $nextChildLevel .'" href="'. $child->getUrl() .'">';
|
67 |
+
$html .= $this->__('View All') . ' ' . $this->escapeHtml($this->__($child->getName()));
|
68 |
+
$html .= '</a>';
|
69 |
+
$html .= '</li>';
|
70 |
+
}
|
71 |
+
$html .= $this->render($child, $childrenWrapClass);
|
72 |
+
$html .= '</ul>';
|
73 |
+
}
|
74 |
+
|
75 |
+
if (!empty($childrenWrapClass)) {
|
76 |
+
$html .= '</div>';
|
77 |
+
}
|
78 |
+
|
79 |
+
$html .= '</li>';
|
80 |
+
|
81 |
+
$counter++;
|
82 |
+
}
|
83 |
+
|
84 |
+
return $html;
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>DwD_CmsMenu</name>
|
4 |
-
<version>0.1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/afl-3.0.php">Academic Free License (AFL 3.0)</license>
|
7 |
<channel>community</channel>
|
@@ -47,12 +47,13 @@ With this extension everything will be much easier and you will get everything w
|
|
47 |
<p>For support, contact us at <a href="mailto:info@dwdeveloper.com">info@dwdeveloper.com</a></p>
|
48 |
<p>You can also get the extension from our GitHub repository: <a href="https://github.com/damian-pastorini/DwD-Mage-Extension-CMS-Menu" target="_blank">https://github.com/damian-pastorini/DwD-Mage-Extension-CMS-Menu</a>.</p>
|
49 |
<p>Please feel free to report any issues there.</p></description>
|
50 |
-
<notes>-
|
51 |
-
-
|
|
|
52 |
<authors><author><name>Damian A. Pastorini</name><user>MAG002087848</user><email>damian.pastorini@dwdeveloper.com</email></author></authors>
|
53 |
-
<date>2015-
|
54 |
-
<time>
|
55 |
-
<contents><target name="mageetc"><dir name="modules"><file name="DwD_CmsMenu.xml" hash="9b1288160fc81a13f811056ca9f49123"/></dir></target><target name="magecommunity"><dir name="DwD"><dir name="CmsMenu"><dir name="Block"><dir name="Adminhtml"><dir name="Cms"><dir name="Page"><dir name="Edit"><dir name="Tab"><file name="Content.php" hash="
|
56 |
<compatible/>
|
57 |
<dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
|
58 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>DwD_CmsMenu</name>
|
4 |
+
<version>0.1.5</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/afl-3.0.php">Academic Free License (AFL 3.0)</license>
|
7 |
<channel>community</channel>
|
47 |
<p>For support, contact us at <a href="mailto:info@dwdeveloper.com">info@dwdeveloper.com</a></p>
|
48 |
<p>You can also get the extension from our GitHub repository: <a href="https://github.com/damian-pastorini/DwD-Mage-Extension-CMS-Menu" target="_blank">https://github.com/damian-pastorini/DwD-Mage-Extension-CMS-Menu</a>.</p>
|
49 |
<p>Please feel free to report any issues there.</p></description>
|
50 |
+
<notes>- Fixed tables creation for implementations with tables prefix.
|
51 |
+
- Added the option to disable the "View All" link.
|
52 |
+
- Added custom events for 3rd party integrations.</notes>
|
53 |
<authors><author><name>Damian A. Pastorini</name><user>MAG002087848</user><email>damian.pastorini@dwdeveloper.com</email></author></authors>
|
54 |
+
<date>2015-12-03</date>
|
55 |
+
<time>00:01:16</time>
|
56 |
+
<contents><target name="mageetc"><dir name="modules"><file name="DwD_CmsMenu.xml" hash="9b1288160fc81a13f811056ca9f49123"/></dir></target><target name="magecommunity"><dir name="DwD"><dir name="CmsMenu"><dir name="Block"><dir name="Adminhtml"><dir name="Cms"><dir name="Page"><dir name="Edit"><dir name="Tab"><file name="Content.php" hash="61f83fea6b53b767897b47be1f6b2577"/></dir></dir></dir></dir></dir><dir name="Page"><dir name="Html"><dir name="Topmenu"><file name="Observer.php" hash="9ff5ebd23574dd779871cab796b592a4"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="939ba6a32fbbbad3d81be3812fd5dd20"/></dir><dir name="Model"><file name="Cmsmenu.php" hash="27a1044475f1a225142baa025051b5fb"/><dir name="Mysql4"><dir name="Cmsmenu"><file name="Collection.php" hash="392f767ff63127c85424195e281385ea"/></dir><file name="Cmsmenu.php" hash="f317ca72b5de8d0cf7a018b4deb8cdb8"/></dir><file name="Observer.php" hash="feacfb1e46c6de805d9c7001341dc03d"/></dir><dir name="etc"><file name="adminhtml.xml" hash="a47c8fe2ed9bdcc5a91595d9f633397e"/><file name="config.xml" hash="a2ec48afae39b5e6059569851c8ee1c5"/><file name="system.xml" hash="fe859d449fb22b06697e35a0c2a65436"/></dir><dir name="sql"><dir name="cmsmenu_setup"><file name="mysql4-install-0.1.0.php" hash="f7917d067ce6b37abca95c3d9a15afbe"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="f7917d067ce6b37abca95c3d9a15afbe"/><file name="mysql4-upgrade-0.1.1-0.1.2.php" hash="f7917d067ce6b37abca95c3d9a15afbe"/><file name="mysql4-upgrade-0.1.2-0.1.3.php" hash="bbe36b889cfe7b582ff763e8a4c981eb"/><file name="mysql4-upgrade-0.1.3-0.1.4.php" hash="98be2360182089f7a3bf67b6c081a34a"/><file name="mysql4-upgrade-0.1.4-0.1.5.php" hash="751a920617bc3d0195f7ffc8bee82b3c"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="dwd"><dir name="cmsmenu"><dir name="page"><dir name="html"><dir name="topmenu"><file name="renderer.phtml" hash="3c3640ffe3e3df118c44ece987f46c0c"/></dir></dir></dir></dir></dir></dir><dir name="layout"><file name="dwd_cmsmenu.xml" hash="e868e3defe367d42ede9fa8c1e368576"/></dir></dir></dir></dir></target></contents>
|
57 |
<compatible/>
|
58 |
<dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
|
59 |
</package>
|