easy_mega_menu - Version 1.0.1

Version Notes

First version stable

Download this release

Release Info

Developer Leonam Bernini
Extension easy_mega_menu
Version 1.0.1
Comparing to
See all releases


Version 1.0.1

Files changed (30) hide show
  1. app/code/community/LeonamBernini/MegaMenu/Block/Adminhtml/Grid/Renderer/Image.php +22 -0
  2. app/code/community/LeonamBernini/MegaMenu/Block/Adminhtml/Megamenu.php +12 -0
  3. app/code/community/LeonamBernini/MegaMenu/Block/Adminhtml/Megamenu/Edit.php +25 -0
  4. app/code/community/LeonamBernini/MegaMenu/Block/Adminhtml/Megamenu/Edit/Form.php +17 -0
  5. app/code/community/LeonamBernini/MegaMenu/Block/Adminhtml/Megamenu/Edit/Tab/Form.php +123 -0
  6. app/code/community/LeonamBernini/MegaMenu/Block/Adminhtml/Megamenu/Edit/Tabs.php +24 -0
  7. app/code/community/LeonamBernini/MegaMenu/Block/Adminhtml/Megamenu/Grid.php +144 -0
  8. app/code/community/LeonamBernini/MegaMenu/Block/Html/Topmenu.php +82 -0
  9. app/code/community/LeonamBernini/MegaMenu/Block/Html/Topmenu/Renderer.php +60 -0
  10. app/code/community/LeonamBernini/MegaMenu/Block/Megamenu.php +8 -0
  11. app/code/community/LeonamBernini/MegaMenu/Helper/Data.php +66 -0
  12. app/code/community/LeonamBernini/MegaMenu/Model/Megamenu.php +10 -0
  13. app/code/community/LeonamBernini/MegaMenu/Model/Mysql4/Megamenu.php +9 -0
  14. app/code/community/LeonamBernini/MegaMenu/Model/Mysql4/Megamenu/Collection.php +10 -0
  15. app/code/community/LeonamBernini/MegaMenu/Model/Source/Action.php +13 -0
  16. app/code/community/LeonamBernini/MegaMenu/Model/Source/DisplaySublevel.php +12 -0
  17. app/code/community/LeonamBernini/MegaMenu/Model/Source/QtyLevels.php +14 -0
  18. app/code/community/LeonamBernini/MegaMenu/controllers/Adminhtml/IndexController.php +199 -0
  19. app/code/community/LeonamBernini/MegaMenu/etc/adminhtml.xml +35 -0
  20. app/code/community/LeonamBernini/MegaMenu/etc/config.xml +116 -0
  21. app/code/community/LeonamBernini/MegaMenu/etc/system.xml +148 -0
  22. app/code/community/LeonamBernini/MegaMenu/sql/megamenu_setup/mysql4-install-1.0.1.php +28 -0
  23. app/design/frontend/base/default/layout/leonambernini/megamenu.xml +12 -0
  24. app/design/frontend/base/default/template/leonambernini/megamenu/topmenu.phtml +60 -0
  25. app/design/frontend/base/default/template/leonambernini/megamenu/topmenu/renderer.phtml +147 -0
  26. app/etc/modules/LeonamBernini_MegaMenu.xml +15 -0
  27. app/locale/en_US/LeonamBernini_MegaMenu.csv +67 -0
  28. app/locale/pt_BR/LeonamBernini_MegaMenu.csv +67 -0
  29. package.xml +18 -0
  30. skin/frontend/base/default/leonam_bernini/megamenu/css/megamenu.css +62 -0
app/code/community/LeonamBernini/MegaMenu/Block/Adminhtml/Grid/Renderer/Image.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class LeonamBernini_MegaMenu_Block_Adminhtml_Grid_Renderer_Image extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
3
+ {
4
+ public function render(Varien_Object $row)
5
+ {
6
+ if($row->getData($this->getColumn()->getIndex())==""){
7
+ return "";
8
+ }
9
+ else{
10
+ $html = '<img ';
11
+ $html .= 'id="img-' . $this->getColumn()->getId() . '" ';
12
+ $html .= 'alt="' . $this->getColumn()->getTitle() . '" ';
13
+ $html .= 'title="' . $this->getColumn()->getTitle() . '" ';
14
+ $html .= 'width="100" ';
15
+ $html .= 'height="75" ';
16
+ $html .= 'src="' . Mage::getBaseUrl("media") . Mage::helper('megamenu')->getThumbsPath( $row->getData( $this->getColumn()->getIndex() ) ) . '"';
17
+ $html .= 'class="grid-image ' . $this->getColumn()->getInlineCss() . '"/>';
18
+
19
+ return $html;
20
+ }
21
+ }
22
+ }
app/code/community/LeonamBernini/MegaMenu/Block/Adminhtml/Megamenu.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class LeonamBernini_MegaMenu_Block_Adminhtml_Megamenu extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_controller = 'adminhtml_megamenu';
7
+ $this->_blockGroup = 'megamenu';
8
+ $this->_headerText = Mage::helper('megamenu')->__('Item Manager');
9
+ $this->_addButtonLabel = Mage::helper('megamenu')->__('Add Item');
10
+ parent::__construct();
11
+ }
12
+ }
app/code/community/LeonamBernini/MegaMenu/Block/Adminhtml/Megamenu/Edit.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class LeonamBernini_MegaMenu_Block_Adminhtml_Megamenu_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+
9
+ $this->_objectId = 'id';
10
+ $this->_blockGroup = 'megamenu';
11
+ $this->_controller = 'adminhtml_megamenu';
12
+
13
+ $this->_updateButton('save', 'label', Mage::helper('megamenu')->__('Save Item'));
14
+ $this->_updateButton('delete', 'label', Mage::helper('megamenu')->__('Delete Item'));
15
+ }
16
+
17
+ public function getHeaderText()
18
+ {
19
+ if( Mage::registry('megamenu_data') && Mage::registry('megamenu_data')->getId() ) {
20
+ return Mage::helper('megamenu')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('megamenu_data')->getTitle()));
21
+ } else {
22
+ return Mage::helper('megamenu')->__('Add Item');
23
+ }
24
+ }
25
+ }
app/code/community/LeonamBernini/MegaMenu/Block/Adminhtml/Megamenu/Edit/Form.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class LeonamBernini_MegaMenu_Block_Adminhtml_MegaMenu_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form(array(
8
+ 'id' => 'edit_form',
9
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
10
+ 'method' => 'post',
11
+ 'enctype' => 'multipart/form-data'
12
+ ));
13
+ $form->setUseContainer(true);
14
+ $this->setForm($form);
15
+ return parent::_prepareForm();
16
+ }
17
+ }
app/code/community/LeonamBernini/MegaMenu/Block/Adminhtml/Megamenu/Edit/Tab/Form.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class LeonamBernini_MegaMenu_Block_Adminhtml_Megamenu_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form();
8
+ $this->setForm($form);
9
+ $fieldset = $form->addFieldset('megamenu_form', array('legend'=>Mage::helper('megamenu')->__('Item information')));
10
+
11
+ $fieldset->addField('category', 'select', array(
12
+ 'label' => Mage::helper('megamenu')->__('Category'),
13
+ 'class' => 'required-entry',
14
+ 'required' => true,
15
+ 'name' => 'category',
16
+ 'values' => Mage::helper('megamenu')->getCategories(),
17
+ ));
18
+
19
+ $fieldset->addField('title', 'text', array(
20
+ 'label' => Mage::helper('megamenu')->__('Title'),
21
+ 'class' => 'required-entry',
22
+ 'required' => true,
23
+ 'name' => 'title',
24
+ ));
25
+
26
+ if (!Mage::app()->isSingleStoreMode()) {
27
+ $fieldset->addField('stores', 'multiselect', array(
28
+ 'name' => 'stores[]',
29
+ 'label' => Mage::helper('megamenu')->__('Select Store'),
30
+ 'title' => Mage::helper('megamenu')->__('Select Store'),
31
+ 'required' => true,
32
+ 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
33
+ ));
34
+ }
35
+ else {
36
+ $fieldset->addField('stores', 'hidden', array(
37
+ 'name' => 'stores[]',
38
+ 'value' => Mage::app()->getStore(true)->getId()
39
+ ));
40
+ }
41
+
42
+ $fieldset->addField('url', 'text', array(
43
+ 'label' => Mage::helper('megamenu')->__('Url'),
44
+ 'required' => false,
45
+ 'name' => 'url',
46
+ ));
47
+
48
+ $fieldset->addField('target', 'select', array(
49
+ 'label' => Mage::helper('megamenu')->__('Target'),
50
+ 'name' => 'target',
51
+ 'values' => array(
52
+ array(
53
+ 'value' => '_blank',
54
+ 'label' => Mage::helper('megamenu')->__('Blank'),
55
+ ),
56
+ array(
57
+ 'value' => '_new',
58
+ 'label' => Mage::helper('megamenu')->__('New'),
59
+ ),
60
+ ),
61
+ ));
62
+
63
+ $fieldset->addField('filename', 'image', array(
64
+ 'label' => Mage::helper('megamenu')->__('Image File'),
65
+ 'name' => 'filename',
66
+ ));
67
+
68
+ $fieldset->addField('product_id', 'text', array(
69
+ 'label' => Mage::helper('megamenu')->__('Product ID'),
70
+ 'name' => 'product_id',
71
+ ));
72
+
73
+ $fieldset->addField('block_id', 'text', array(
74
+ 'label' => Mage::helper('megamenu')->__('Block ID'),
75
+ 'name' => 'block_id',
76
+ ));
77
+
78
+ $fieldset->addField('status', 'select', array(
79
+ 'label' => Mage::helper('megamenu')->__('Status'),
80
+ 'name' => 'status',
81
+ 'values' => array(
82
+ array(
83
+ 'value' => 1,
84
+ 'label' => Mage::helper('megamenu')->__('Active'),
85
+ ),
86
+
87
+ array(
88
+ 'value' => 0,
89
+ 'label' => Mage::helper('megamenu')->__('Inactive'),
90
+ ),
91
+ ),
92
+ ));
93
+
94
+ $image_calendar = Mage::getBaseUrl('skin') . 'adminhtml/default/default/images/grid-cal.gif';
95
+
96
+ $fieldset->addField('start_time', 'date', array(
97
+ 'label' => Mage::helper('megamenu')->__('Start date'),
98
+ 'format' => 'yyyy-MM-dd',
99
+ 'required' => false,
100
+ 'image' => $image_calendar,
101
+ 'name' => 'start_time',
102
+ 'time' => true
103
+ ));
104
+
105
+ $fieldset->addField('end_time', 'date', array(
106
+ 'label' => Mage::helper('fullbanner')->__('End date'),
107
+ 'format' =>'yyyy-MM-dd',
108
+ 'required' => false,
109
+ 'image' => $image_calendar,
110
+ 'name' => 'end_time',
111
+ 'time' => true
112
+ ));
113
+
114
+ if ( Mage::getSingleton('adminhtml/session')->getSlideshowData() )
115
+ {
116
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getFullbannerData());
117
+ Mage::getSingleton('adminhtml/session')->setFullbannerData(null);
118
+ } elseif ( Mage::registry('megamenu_data') ) {
119
+ $form->setValues(Mage::registry('megamenu_data')->getData());
120
+ }
121
+ return parent::_prepareForm();
122
+ }
123
+ }
app/code/community/LeonamBernini/MegaMenu/Block/Adminhtml/Megamenu/Edit/Tabs.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class LeonamBernini_MegaMenu_Block_Adminhtml_Megamenu_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId('megamenu_tabs');
10
+ $this->setDestElementId('edit_form');
11
+ $this->setTitle(Mage::helper('megamenu')->__('Item Information'));
12
+ }
13
+
14
+ protected function _beforeToHtml()
15
+ {
16
+ $this->addTab('form_section', array(
17
+ 'label' => Mage::helper('megamenu')->__('Item Information'),
18
+ 'title' => Mage::helper('megamenu')->__('Item Information'),
19
+ 'content' => $this->getLayout()->createBlock('megamenu/adminhtml_megamenu_edit_tab_form')->toHtml(),
20
+ ));
21
+
22
+ return parent::_beforeToHtml();
23
+ }
24
+ }
app/code/community/LeonamBernini/MegaMenu/Block/Adminhtml/Megamenu/Grid.php ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class LeonamBernini_MegaMenu_Block_Adminhtml_Megamenu_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+
6
+ private $categories;
7
+
8
+ public function __construct()
9
+ {
10
+ parent::__construct();
11
+ $this->setId('MegaMenuGrid');
12
+ // This is the primary key of the database
13
+ $this->setDefaultSort('id');
14
+ $this->setDefaultDir('ASC');
15
+ $this->setSaveParametersInSession(true);
16
+ $this->setUseAjax(true);
17
+ $this->categories = Mage::helper('megamenu')->getCategories();
18
+ }
19
+
20
+ protected function getCategory($category){
21
+ return $this->categories[$category];
22
+ }
23
+
24
+
25
+ protected function _prepareCollection()
26
+ {
27
+ $collection = Mage::getModel('megamenu/megamenu')->getCollection();
28
+ foreach($collection as $link){
29
+ if($link->getStores() && $link->getStores() != 0 ){
30
+ $link->setStores(explode(',',$link->getStores()));
31
+ }
32
+ else{
33
+ $link->setStores(array('0'));
34
+ }
35
+ $link->setCategoryName($this->getCategory($link->getCategory()));
36
+ }
37
+ $this->setCollection($collection);
38
+ return parent::_prepareCollection();
39
+ }
40
+
41
+ protected function _prepareColumns()
42
+ {
43
+ $this->addColumn('id', array(
44
+ 'header' => Mage::helper('megamenu')->__('ID'),
45
+ 'align' =>'center',
46
+ 'width' => '50px',
47
+ 'index' => 'id',
48
+ ));
49
+
50
+ $this->addColumn('filename', array(
51
+ 'header' => Mage::helper('megamenu')->__('Image'),
52
+ 'align' => 'left',
53
+ 'index' => 'filename',
54
+ 'renderer' => 'megamenu/adminhtml_grid_renderer_image',
55
+ 'width' => '130px',
56
+ 'align' => 'center',
57
+ 'escape' => true,
58
+ 'sortable' => false,
59
+ 'filter' => false,
60
+ ));
61
+
62
+ $this->addColumn('category_name', array(
63
+ 'header' => Mage::helper('megamenu')->__('Category'),
64
+ 'align' =>'left',
65
+ 'index' => 'category_name',
66
+ ));
67
+
68
+ $this->addColumn('title', array(
69
+ 'header' => Mage::helper('megamenu')->__('Title'),
70
+ 'align' =>'left',
71
+ 'index' => 'title',
72
+ ));
73
+
74
+ $this->addColumn('product_id', array(
75
+ 'header' => Mage::helper('megamenu')->__('Product ID'),
76
+ 'align' =>'left',
77
+ 'index' => 'product_id',
78
+ ));
79
+
80
+ $this->addColumn('block_id', array(
81
+ 'header' => Mage::helper('megamenu')->__('Block ID'),
82
+ 'align' =>'left',
83
+ 'index' => 'block_id',
84
+ ));
85
+
86
+ $this->addColumn('url', array(
87
+ 'header' => Mage::helper('megamenu')->__('URL'),
88
+ 'align' =>'left',
89
+ 'index' => 'url',
90
+ ));
91
+
92
+ if (!Mage::app()->isSingleStoreMode()) {
93
+ $this->addColumn('stores', array(
94
+ 'header' => Mage::helper('megamenu')->__('Store'),
95
+ 'index' => 'stores',
96
+ 'type' => 'store',
97
+ 'store_all' => true,
98
+ 'store_view' => true,
99
+ 'sortable' => false,
100
+ 'filter_condition_callback'
101
+ => array($this, '_filterStoreCondition'),
102
+ ));
103
+ }
104
+
105
+ $this->addColumn('start_time', array(
106
+ 'header' => Mage::helper('megamenu')->__('Start Time'),
107
+ 'align' => 'center',
108
+ 'width' => '80px',
109
+ 'index' => 'start_time',
110
+ ));
111
+
112
+ $this->addColumn('end_time', array(
113
+ 'header' => Mage::helper('megamenu')->__('End Time'),
114
+ 'align' => 'center',
115
+ 'width' => '80px',
116
+ 'index' => 'end_time',
117
+ ));
118
+
119
+ $this->addColumn('status', array(
120
+ 'header' => Mage::helper('megamenu')->__('Status'),
121
+ 'align' => 'center',
122
+ 'width' => '80px',
123
+ 'index' => 'status',
124
+ 'type' => 'options',
125
+ 'options' => array(
126
+ 1 => Mage::helper('megamenu')->__('Active'),
127
+ 0 => Mage::helper('megamenu')->__('Inactive'),
128
+ ),
129
+ ));
130
+
131
+ return parent::_prepareColumns();
132
+ }
133
+
134
+ public function getRowUrl($row)
135
+ {
136
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
137
+ }
138
+
139
+ public function getGridUrl()
140
+ {
141
+ return $this->getUrl('*/*/grid', array('_current'=>true));
142
+ }
143
+
144
+ }
app/code/community/LeonamBernini/MegaMenu/Block/Html/Topmenu.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class LeonamBernini_MegaMenu_Block_Html_Topmenu extends Mage_Page_Block_Html_Topmenu
3
+ {
4
+
5
+ public function getHtml($outermostClass = '', $childrenWrapClass = '')
6
+ {
7
+ Mage::dispatchEvent('page_block_html_topmenu_gethtml_before', array(
8
+ 'menu' => $this->_menu,
9
+ 'block' => $this
10
+ ));
11
+
12
+ $this->_menu->setOutermostClass($outermostClass);
13
+ $this->_menu->setChildrenWrapClass($childrenWrapClass);
14
+
15
+ if ( ( $renderer = $this->getChild('leonambernini.megamenu.renderer') ) && ( Mage::getStoreConfig("megamenu/general/enabled") ) ) {
16
+ $renderer->setMenuTree($this->_menu)->setChildrenWrapClass($childrenWrapClass);
17
+ $html = $renderer->toHtml();
18
+ } else {
19
+ $html = $this->__getHtml($this->_menu, $childrenWrapClass);
20
+ }
21
+
22
+ Mage::dispatchEvent('page_block_html_topmenu_gethtml_after', array(
23
+ 'menu' => $this->_menu,
24
+ 'html' => $html
25
+ ));
26
+
27
+ return $html;
28
+ }
29
+
30
+ public function __getHtml(Varien_Data_Tree_Node $menuTree, $childrenWrapClass)
31
+ {
32
+ $html = '';
33
+
34
+ $children = $menuTree->getChildren();
35
+ $parentLevel = $menuTree->getLevel();
36
+ $childLevel = is_null($parentLevel) ? 0 : $parentLevel + 1;
37
+
38
+ $counter = 1;
39
+ $childrenCount = $children->count();
40
+
41
+ $parentPositionClass = $menuTree->getPositionClass();
42
+ $itemPositionClassPrefix = $parentPositionClass ? $parentPositionClass . '-' : 'nav-';
43
+
44
+ foreach ($children as $child) {
45
+
46
+ $child->setLevel($childLevel);
47
+ $child->setIsFirst($counter == 1);
48
+ $child->setIsLast($counter == $childrenCount);
49
+ $child->setPositionClass($itemPositionClassPrefix . $counter);
50
+
51
+ $outermostClassCode = '';
52
+ $outermostClass = $menuTree->getOutermostClass();
53
+
54
+ if ($childLevel == 0 && $outermostClass) {
55
+ $outermostClassCode = ' class="' . $outermostClass . '" ';
56
+ $child->setClass($outermostClass);
57
+ }
58
+
59
+ $html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>';
60
+ $html .= '<a href="' . $child->getUrl() . '" ' . $outermostClassCode . '><span>'
61
+ . $this->escapeHtml($child->getName()) . '</span></a>';
62
+
63
+ if ($child->hasChildren()) {
64
+ if (!empty($childrenWrapClass)) {
65
+ $html .= '<div class="' . $childrenWrapClass . '">';
66
+ }
67
+ $html .= '<ul class="level' . $childLevel . '">';
68
+ $html .= $this->_getHtml($child, $childrenWrapClass);
69
+ $html .= '</ul>';
70
+
71
+ if (!empty($childrenWrapClass)) {
72
+ $html .= '</div>';
73
+ }
74
+ }
75
+ $html .= '</li>';
76
+
77
+ $counter++;
78
+ }
79
+
80
+ return $html;
81
+ }
82
+ }
app/code/community/LeonamBernini/MegaMenu/Block/Html/Topmenu/Renderer.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class LeonamBernini_MegaMenu_Block_Html_Topmenu_Renderer extends Mage_Page_Block_Html_Topmenu
3
+ {
4
+ protected $_templateFile;
5
+
6
+ /**
7
+ * Renders block html
8
+ * @return string
9
+ * @throws Exception
10
+ */
11
+ protected function _toHtml()
12
+ {
13
+ $this->_addCacheTags();
14
+ $menuTree = $this->getMenuTree();
15
+ $childrenWrapClass = $this->getChildrenWrapClass();
16
+ if (!$this->getTemplate() || is_null($menuTree) || is_null($childrenWrapClass)) {
17
+ throw new Exception("Top-menu renderer isn't fully configured.");
18
+ }
19
+
20
+ $includeFilePath = realpath(Mage::getBaseDir('design') . DS . $this->getTemplateFile());
21
+ if (strpos($includeFilePath, realpath(Mage::getBaseDir('design'))) === 0 || $this->_getAllowSymlinks()) {
22
+ $this->_templateFile = $includeFilePath;
23
+ } else {
24
+ throw new Exception('Not valid template file:' . $this->_templateFile);
25
+ }
26
+ return $this->render($menuTree, $childrenWrapClass);
27
+ }
28
+
29
+ /**
30
+ * Add cache tags
31
+ *
32
+ * @return void
33
+ */
34
+ protected function _addCacheTags()
35
+ {
36
+ $parentBlock = $this->getParentBlock();
37
+ if ($parentBlock) {
38
+ $this->addCacheTag($parentBlock->getCacheTags());
39
+ }
40
+ }
41
+
42
+ /**
43
+ * Fetches template. If template has return statement, than its value is used and direct output otherwise.
44
+ * @param Varien_Data_Tree_Node $menuTree
45
+ * @param $childrenWrapClass
46
+ * @return string
47
+ */
48
+ public function render(Varien_Data_Tree_Node $menuTree, $childrenWrapClass)
49
+ {
50
+ ob_start();
51
+ $html = include $this->_templateFile;
52
+ $directOutput = ob_get_clean();
53
+
54
+ if (is_string($html)) {
55
+ return $html;
56
+ } else {
57
+ return $directOutput;
58
+ }
59
+ }
60
+ }
app/code/community/LeonamBernini/MegaMenu/Block/Megamenu.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class LeonamBernini_MegaMenu_Block_Megamenu extends Mage_Catalog_Block_Product_View_Media
3
+ {
4
+ public function _prepareLayout()
5
+ {
6
+ return parent::_prepareLayout();
7
+ }
8
+ }
app/code/community/LeonamBernini/MegaMenu/Helper/Data.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class LeonamBernini_MegaMenu_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+ private $path;
6
+ private $thumbsPath;
7
+
8
+ public function __construct() {
9
+ $this->path = '/leonam_bernini/megamenu/';
10
+ $this->thumbsPath = '/leonam_bernini/megamenu/thumbs/';
11
+ }
12
+
13
+ public function getCategories(){
14
+ $categories = Mage::getModel('catalog/category')
15
+ ->getCollection()
16
+ ->addAttributeToSelect('*')
17
+ ->addIsActiveFilter()
18
+ ->addAttributeToFilter('level',2)
19
+ ->addOrderField('name');
20
+ foreach($categories as $category){
21
+ $arr[$category->getId()] = $category->getName();
22
+ }
23
+ return $arr;
24
+ }
25
+
26
+
27
+ public function getPath()
28
+ {
29
+ return $this->path;
30
+ }
31
+ public function getThumbsPath($path = null)
32
+ {
33
+ if( $path == null ){
34
+ return $this->thumbsPath;
35
+ }else{
36
+ return str_replace( '/megamenu/', '/megamenu/thumbs/', $path);
37
+ }
38
+ }
39
+
40
+ public function resizeImg($fileName, $width, $height = '')
41
+ {
42
+ //$fileName = "slideshow\slides\\".$fileName;
43
+ $folderURL = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
44
+ $imageURL = $folderURL . $fileName;
45
+
46
+ $basePath = Mage::getBaseDir(Mage_Core_Model_Store::URL_TYPE_MEDIA) . $this->path. $fileName;
47
+
48
+ $newPath = Mage::getBaseDir(Mage_Core_Model_Store::URL_TYPE_MEDIA) . $this->thumbsPath . $fileName;
49
+ //if width empty then return original size image's URL
50
+ if ($width != '') {
51
+ //if image has already resized then just return URL
52
+ if (file_exists($basePath) && is_file($basePath) && !file_exists($newPath)) {
53
+ $imageObj = new Varien_Image($basePath);
54
+ $imageObj->constrainOnly(TRUE);
55
+ $imageObj->keepAspectRatio(FALSE);
56
+ $imageObj->keepFrame(FALSE);
57
+ $imageObj->resize($width, $height);
58
+ $imageObj->save($newPath);
59
+ }
60
+ $resizedURL = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . "resized" . DS . $fileName;
61
+ } else {
62
+ $resizedURL = $imageURL;
63
+ }
64
+ return $resizedURL;
65
+ }
66
+ }
app/code/community/LeonamBernini/MegaMenu/Model/Megamenu.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class LeonamBernini_MegaMenu_Model_Megamenu extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('megamenu/megamenu');
9
+ }
10
+ }
app/code/community/LeonamBernini/MegaMenu/Model/Mysql4/Megamenu.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class LeonamBernini_MegaMenu_Model_Mysql4_Megamenu extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ $this->_init('megamenu/megamenu', 'id');
8
+ }
9
+ }
app/code/community/LeonamBernini/MegaMenu/Model/Mysql4/Megamenu/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class LeonamBernini_MegaMenu_Model_Mysql4_Megamenu_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ //parent::_construct();
8
+ $this->_init('megamenu/megamenu');
9
+ }
10
+ }
app/code/community/LeonamBernini/MegaMenu/Model/Source/Action.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class LeonamBernini_MegaMenu_Model_Source_Action
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ return array(
8
+ array('value'=>'hover', 'label'=>Mage::helper('adminhtml')->__('on hover')),
9
+ array('value'=>'click', 'label'=>Mage::helper('adminhtml')->__('on click')),
10
+ // array('value'=>'hover_click', 'label'=>Mage::helper('adminhtml')->__('on hover or click')),
11
+ );
12
+ }
13
+ }
app/code/community/LeonamBernini/MegaMenu/Model/Source/DisplaySublevel.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class LeonamBernini_MegaMenu_Model_Source_DisplaySublevel
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ return array(
8
+ array('value'=>'block', 'label'=>Mage::helper('adminhtml')->__('block')),
9
+ array('value'=>'inline-block', 'label'=>Mage::helper('adminhtml')->__('inline block')),
10
+ );
11
+ }
12
+ }
app/code/community/LeonamBernini/MegaMenu/Model/Source/QtyLevels.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class LeonamBernini_MegaMenu_Model_Source_QtyLevels
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ return array(
8
+ array('value'=>'0', 'label'=>Mage::helper('adminhtml')->__('none')),
9
+ array('value'=>'1', 'label'=>Mage::helper('adminhtml')->__('one level')),
10
+ array('value'=>'2', 'label'=>Mage::helper('adminhtml')->__('two levels')),
11
+ array('value'=>'3', 'label'=>Mage::helper('adminhtml')->__('three levels')),
12
+ );
13
+ }
14
+ }
app/code/community/LeonamBernini/MegaMenu/controllers/Adminhtml/IndexController.php ADDED
@@ -0,0 +1,199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class LeonamBernini_MegaMenu_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ protected function _initAction()
6
+ {
7
+ $this->loadLayout()
8
+ ->_setActiveMenu('megamenu/manage_megamenu')
9
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
10
+ return $this;
11
+ }
12
+
13
+ public function indexAction() {
14
+ $this->_initAction();
15
+ $this->_addContent($this->getLayout()->createBlock('megamenu/adminhtml_megamenu'));
16
+ $this->renderLayout();
17
+ }
18
+
19
+ public function newAction(){
20
+ $this->_forward('edit');
21
+ }
22
+
23
+ public function editAction(){
24
+ $id = $this->getRequest()->getParam('id');
25
+ $model = Mage::getModel('megamenu/megamenu')->load($id);
26
+
27
+ if ( $model->getId() || $id == 0 ) {
28
+
29
+ Mage::register('megamenu_data', $model);
30
+
31
+ $this->loadLayout();
32
+ $this->_setActiveMenu('megamenu/manage_megamenu');
33
+
34
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
35
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
36
+
37
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
38
+
39
+ $this->_addContent($this->getLayout()->createBlock('megamenu/adminhtml_megamenu_edit'))
40
+ ->_addLeft($this->getLayout()->createBlock('megamenu/adminhtml_megamenu_edit_tabs'));
41
+
42
+ $this->renderLayout();
43
+ } else {
44
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('megamenu')->__('Item does not exist'));
45
+ $this->_redirect('*/*/');
46
+ }
47
+ }
48
+
49
+ public function saveAction()
50
+ {
51
+ if ( $this->getRequest()->getPost() ) {
52
+ try {
53
+ $postData = $this->getRequest()->getPost();
54
+ $megamenuModel = Mage::getModel('megamenu/megamenu');
55
+
56
+ $bannerPath = Mage::helper('megamenu')->getPath();
57
+
58
+ if(isset($_FILES['filename']['name']) && $_FILES['filename']['name'] != '') {
59
+ try {
60
+
61
+ /* Starting upload */
62
+ $uploader = new Varien_File_Uploader('filename');
63
+
64
+ // Any extention would work
65
+ $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
66
+ $uploader->setAllowRenameFiles(true);
67
+
68
+ // Set the file upload mode
69
+ // false -> get the file directly in the specified folder
70
+ // true -> get the file in the product like folders
71
+ // (file.jpg will go in something like /media/f/i/file.jpg)
72
+ $uploader->setFilesDispersion(false);
73
+
74
+ // We set media as the upload dir
75
+ $path = Mage::getBaseDir('media') . DS . $bannerPath ;
76
+
77
+ $extension = pathinfo($_FILES['filename']['name'], PATHINFO_EXTENSION);
78
+ $result = $uploader->save($path, md5( $imageName . date('d.m.Y_H.m.i') ) . '.' . $extension );
79
+
80
+ //For thumb
81
+ Mage::helper('megamenu')->resizeImg($result['file'], 100, 75);
82
+ //For thumb ends
83
+
84
+ $test = $bannerPath.$result['file'];
85
+
86
+ if(isset($postData['filename']['delete']) && $postData['filename']['delete'] == 1)
87
+ {
88
+ unlink(Mage_Core_Model_Store::URL_TYPE_MEDIA. DS .$postData['filename']['value']);
89
+ unlink(Mage_Core_Model_Store::URL_TYPE_MEDIA. DS . Mage::helper('megamenu')->getThumbsPath($postData['filename']['value']));
90
+ }
91
+ $postData['filename'] = $test;
92
+
93
+ } catch (Exception $e) {
94
+ $postData['filename'] = $_FILES['filename']['name'];
95
+ }
96
+ }
97
+ else {
98
+ if(isset($postData['filename']['delete']) && $postData['filename']['delete'] == 1){
99
+ unlink(Mage_Core_Model_Store::URL_TYPE_MEDIA. DS .$postData['filename']['value']);
100
+ unlink(Mage_Core_Model_Store::URL_TYPE_MEDIA. DS .Mage::helper('megamenu')->getThumbsPath($postData['filename']['value']));
101
+ $postData['filename'] = '';
102
+ }
103
+ else
104
+ unset($postData['filename']);
105
+ }
106
+ if(isset($postData['stores'])) {
107
+ if(in_array('0',$postData['stores'])){
108
+ $postData['stores'] = '0';
109
+ }else{
110
+ $postData['stores'] = implode(",", $postData['stores']);
111
+ }
112
+ }
113
+
114
+ if($postData['stores'] == "")
115
+ {
116
+ $postData['stores'] = '0';
117
+ }
118
+
119
+ $times = explode(" ", now());
120
+ if ( $postData['start_time'] ) {
121
+ $postData['start_time'] = $postData['start_time']. " " . $times[1];
122
+ }else{
123
+ $postData['start_time'] = null;
124
+ }
125
+ if ( $postData['end_time'] ) {
126
+ $postData['end_time'] = $postData['end_time'] . " " . $times[1];
127
+ }else{
128
+ $postData['end_time'] = null;
129
+ }
130
+
131
+ $megamenuModel->setId($this->getRequest()->getParam('id'))
132
+ ->setTitle($postData['title'])
133
+ ->setUrl($postData['url'])
134
+ ->setTarget($postData['target'])
135
+ ->setBlockId($postData['block_id'])
136
+ ->setProductId($postData['product_id'])
137
+ ->setFilename($postData['filename'])
138
+ ->setStatus($postData['status'])
139
+ ->setStores($postData['stores'])
140
+ ->setCategory($postData['category'])
141
+ ->setStartTime($postData['start_time'])
142
+ ->setEndTime($postData['end_time'])
143
+ ->save();
144
+
145
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully saved'));
146
+ Mage::getSingleton('adminhtml/session')->setSlideshowData(false);
147
+
148
+ $this->_redirect('*/*/');
149
+ return;
150
+ } catch (Exception $e) {
151
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
152
+ Mage::getSingleton('adminhtml/session')->setSlideshowData($this->getRequest()->getPost());
153
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
154
+ return;
155
+ }
156
+ }
157
+ $this->_redirect('*/*/');
158
+ }
159
+
160
+ public function deleteAction()
161
+ {
162
+ $id = $this->getRequest()->getParam('id');
163
+ if( $id > 0 ) {
164
+ try {
165
+ $model = Mage::getModel('megamenu/megamenu')->load($id);
166
+ $image = $model->getFilename();
167
+ $model->delete();
168
+
169
+ if( $image != '' && $image != null && file_exists( Mage_Core_Model_Store::URL_TYPE_MEDIA .$image ) ){
170
+ unlink( Mage_Core_Model_Store::URL_TYPE_MEDIA .$image );
171
+
172
+ if( file_exists( Mage_Core_Model_Store::URL_TYPE_MEDIA . Mage::helper('megamenu')->getThumbsPath( $image ) ) ){
173
+ unlink( Mage_Core_Model_Store::URL_TYPE_MEDIA . Mage::helper('megamenu')->getThumbsPath( $image ) );
174
+ }
175
+ }
176
+
177
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
178
+ $this->_redirect('*/*/');
179
+ } catch (Exception $e) {
180
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
181
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
182
+ }
183
+ }
184
+ $this->_redirect('*/*/');
185
+ }
186
+
187
+ /**
188
+ * Product grid for AJAX request.
189
+ * Sort and filter result for example.
190
+ */
191
+ public function gridAction()
192
+ {
193
+ $this->loadLayout();
194
+ $this->getResponse()->setBody(
195
+ $this->getLayout()->createBlock('megamenu/adminhtml_megamenu_grid')->toHtml()
196
+ );
197
+ }
198
+ }
199
+ ?>
app/code/community/LeonamBernini/MegaMenu/etc/adminhtml.xml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ <megamenu translate="title" module="megamenu">
12
+ <title>MegaMenu Settings - NEX</title>
13
+ </megamenu>
14
+ </children>
15
+ </config>
16
+ </children>
17
+ </system>
18
+ </children>
19
+ </admin>
20
+ </resources>
21
+ </acl>
22
+ <menu>
23
+ <megamenu module="megamenu" translate="title">
24
+ <title>MegaMenu (nex)</title>
25
+ <sort_order>99</sort_order>
26
+ <children>
27
+ <items module="megamenu" translate="title">
28
+ <title>Manage Items</title>
29
+ <sort_order>0</sort_order>
30
+ <action>megamenu/adminhtml_index</action>
31
+ </items>
32
+ </children>
33
+ </megamenu>
34
+ </menu>
35
+ </config>
app/code/community/LeonamBernini/MegaMenu/etc/config.xml ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <LeonamBernini_MegaMenu>
5
+ <version>1.0.1</version>
6
+ </LeonamBernini_MegaMenu>
7
+ </modules>
8
+
9
+ <frontend>
10
+ <routers>
11
+ <megamenu>
12
+ <use>standard</use>
13
+ <args>
14
+ <frontName>megamenu</frontName>
15
+ <module>LeonamBernini_MegaMenu</module>
16
+ </args>
17
+ </megamenu>
18
+ </routers>
19
+ <layout>
20
+ <updates>
21
+ <megamenu>
22
+ <file>leonambernini/megamenu.xml</file>
23
+ </megamenu>
24
+ </updates>
25
+ </layout>
26
+ </frontend>
27
+
28
+ <global>
29
+ <blocks>
30
+ <megamenu>
31
+ <class>LeonamBernini_MegaMenu_Block</class>
32
+ </megamenu>
33
+ <page>
34
+ <rewrite>
35
+ <html_topmenu>LeonamBernini_MegaMenu_Block_Html_Topmenu</html_topmenu>
36
+ </rewrite>
37
+ </page>
38
+ </blocks>
39
+
40
+ <helpers>
41
+ <megamenu>
42
+ <class>LeonamBernini_MegaMenu_Helper</class>
43
+ </megamenu>
44
+ </helpers>
45
+
46
+ <models>
47
+ <megamenu>
48
+ <class>LeonamBernini_MegaMenu_Model</class>
49
+ <resourceModel>megamenu_mysql4</resourceModel>
50
+ </megamenu>
51
+ <megamenu_mysql4>
52
+ <class>LeonamBernini_MegaMenu_Model_Mysql4</class>
53
+ <entities>
54
+ <megamenu>
55
+ <table>lb_megamenu</table>
56
+ </megamenu>
57
+ </entities>
58
+ </megamenu_mysql4>
59
+ </models>
60
+ </global>
61
+
62
+ <adminhtml>
63
+ <acl>
64
+ <resources>
65
+ <admin>
66
+ <children>
67
+ <system>
68
+ <children>
69
+ <config>
70
+ <children>
71
+ <megamenu>
72
+ <title>MegaMenu Settings - NEX</title>
73
+ </megamenu>
74
+ </children>
75
+ </config>
76
+ </children>
77
+ </system>
78
+ </children>
79
+ </admin>
80
+ </resources>
81
+ </acl>
82
+ </adminhtml>
83
+
84
+ <admin>
85
+ <routers>
86
+ <megamenu>
87
+ <use>admin</use>
88
+ <args>
89
+ <module>LeonamBernini_MegaMenu</module>
90
+ <frontName>megamenu</frontName>
91
+ </args>
92
+ </megamenu>
93
+ </routers>
94
+ </admin>
95
+
96
+ <default>
97
+ <megamenu>
98
+ <general>
99
+ <enabled>0</enabled>
100
+ <levels>1</levels>
101
+ <action>hover</action>
102
+ <home_link>1</home_link>
103
+ <home_link_title>home</home_link_title>
104
+ <featured_img>1</featured_img>
105
+ <box_center>1</box_center>
106
+ </general>
107
+ <levels>
108
+ <box_width>600</box_width>
109
+ <item_width>0</item_width>
110
+ <display>inline-block</display>
111
+ <invert_box>7</invert_box>
112
+ </levels>
113
+ </megamenu>
114
+ </default>
115
+
116
+ </config>
app/code/community/LeonamBernini/MegaMenu/etc/system.xml ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <tabs>
4
+ <leonambernini translate="label">
5
+ <label>Leonam Bernini</label>
6
+ <sort_order>100</sort_order>
7
+ </leonambernini>
8
+ </tabs>
9
+ <sections>
10
+ <megamenu translate="label" module="megamenu">
11
+ <label>Mega Menu</label>
12
+ <class>megamenu-section</class>
13
+ <tab>leonambernini</tab>
14
+ <frontend_type>text</frontend_type>
15
+ <sort_order>9999</sort_order>
16
+ <show_in_default>1</show_in_default>
17
+ <show_in_website>1</show_in_website>
18
+ <show_in_store>1</show_in_store>
19
+ <groups>
20
+ <general translate="label">
21
+ <label>General</label>
22
+ <frontend_type>text</frontend_type>
23
+ <sort_order>1</sort_order>
24
+ <show_in_default>1</show_in_default>
25
+ <show_in_website>1</show_in_website>
26
+ <show_in_store>1</show_in_store>
27
+ <fields>
28
+ <enabled translate="label comment">
29
+ <label>Enable</label>
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
+ <levels translate="label comment">
38
+ <label>Levels</label>
39
+ <frontend_type>select</frontend_type>
40
+ <comment>amount of sublevels that appears</comment>
41
+ <source_model>megamenu/source_qtyLevels</source_model>
42
+ <sort_order>2</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
+ </levels>
47
+ <action translate="label comment">
48
+ <label>Action</label>
49
+ <frontend_type>select</frontend_type>
50
+ <comment>activate when you click or hover</comment>
51
+ <source_model>megamenu/source_action</source_model>
52
+ <sort_order>3</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>1</show_in_website>
55
+ <show_in_store>1</show_in_store>
56
+ </action>
57
+ <home_link translate="label comment">
58
+ <label>Show home button</label>
59
+ <frontend_type>select</frontend_type>
60
+ <source_model>adminhtml/system_config_source_yesno</source_model>
61
+ <sort_order>4</sort_order>
62
+ <show_in_default>1</show_in_default>
63
+ <show_in_website>1</show_in_website>
64
+ <show_in_store>1</show_in_store>
65
+ </home_link>
66
+ <home_link_title translate="label comment">
67
+ <label>Button home title</label>
68
+ <frontend_type>text</frontend_type>
69
+ <sort_order>5</sort_order>
70
+ <show_in_default>1</show_in_default>
71
+ <show_in_website>1</show_in_website>
72
+ <show_in_store>1</show_in_store>
73
+ </home_link_title>
74
+ <featured_img translate="label comment">
75
+ <label>Show image</label>
76
+ <frontend_type>select</frontend_type>
77
+ <source_model>adminhtml/system_config_source_yesno</source_model>
78
+ <comment>allow viewing of featured picture on sublevel</comment>
79
+ <sort_order>6</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
+ </featured_img>
84
+ <box_center translate="label comment">
85
+ <label>Add box to align center?</label>
86
+ <frontend_type>select</frontend_type>
87
+ <source_model>adminhtml/system_config_source_yesno</source_model>
88
+ <comment>add box with class "center" for config in css.</comment>
89
+ <sort_order>7</sort_order>
90
+ <show_in_default>1</show_in_default>
91
+ <show_in_website>1</show_in_website>
92
+ <show_in_store>1</show_in_store>
93
+ </box_center>
94
+ </fields>
95
+ </general>
96
+ <levels translate="label">
97
+ <label>Levels</label>
98
+ <frontend_type>text</frontend_type>
99
+ <sort_order>2</sort_order>
100
+ <show_in_default>1</show_in_default>
101
+ <show_in_website>1</show_in_website>
102
+ <show_in_store>1</show_in_store>
103
+ <fields>
104
+ <box_width translate="label comment">
105
+ <label>Width of Box</label>
106
+ <frontend_type>text</frontend_type>
107
+ <comment>in px or 0 for editing in css</comment>
108
+ <validate>required-entry validate-number</validate>
109
+ <sort_order>1</sort_order>
110
+ <show_in_default>1</show_in_default>
111
+ <show_in_website>1</show_in_website>
112
+ <show_in_store>1</show_in_store>
113
+ </box_width>
114
+ <item_width translate="label comment">
115
+ <label>Width of Items</label>
116
+ <frontend_type>text</frontend_type>
117
+ <comment>in px or 0 for editing in css</comment>
118
+ <validate>required-entry validate-number</validate>
119
+ <sort_order>2</sort_order>
120
+ <show_in_default>1</show_in_default>
121
+ <show_in_website>1</show_in_website>
122
+ <show_in_store>1</show_in_store>
123
+ </item_width>
124
+ <display translate="label comment">
125
+ <label>Display</label>
126
+ <frontend_type>select</frontend_type>
127
+ <source_model>megamenu/source_displaySublevel</source_model>
128
+ <sort_order>3</sort_order>
129
+ <show_in_default>1</show_in_default>
130
+ <show_in_website>1</show_in_website>
131
+ <show_in_store>1</show_in_store>
132
+ </display>
133
+ <invert_box translate="label comment">
134
+ <label>Reverse side opening level</label>
135
+ <frontend_type>text</frontend_type>
136
+ <comment>from the number indicated an 'open-left' class will be added, making the sublevel open to left</comment>
137
+ <validate>required-entry validate-number</validate>
138
+ <sort_order>4</sort_order>
139
+ <show_in_default>1</show_in_default>
140
+ <show_in_website>1</show_in_website>
141
+ <show_in_store>1</show_in_store>
142
+ </invert_box>
143
+ </fields>
144
+ </levels>
145
+ </groups>
146
+ </megamenu>
147
+ </sections>
148
+ </config>
app/code/community/LeonamBernini/MegaMenu/sql/megamenu_setup/mysql4-install-1.0.1.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+ -- DROP TABLE IF EXISTS {$this->getTable('lb_megamenu')};
10
+ CREATE TABLE {$this->getTable('lb_megamenu')} (
11
+ `id` int(11) unsigned NOT NULL auto_increment,
12
+ `category` int(11) unsigned not null,
13
+ `product_id` int(11) unsigned null,
14
+ `block_id` varchar(50) null,
15
+ `title` varchar(255) NOT NULL default '',
16
+ `filename` varchar(255) NOT NULL default '',
17
+ `url` varchar(500) NOT NULL default '',
18
+ `target` varchar(255) NOT NULL default '',
19
+ `status` smallint(6) NOT NULL default '0',
20
+ `stores` VARCHAR( 255 ) NOT NULL DEFAULT '0',
21
+ `start_time` datetime NULL default NULL,
22
+ `end_time` datetime NULL default NULL,
23
+ PRIMARY KEY (`id`)
24
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
25
+
26
+ ");
27
+
28
+ $installer->endSetup();
app/design/frontend/base/default/layout/leonambernini/megamenu.xml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addCss"><stylesheet>leonam_bernini/megamenu/css/megamenu.css</stylesheet></action>
6
+ </reference>
7
+ <reference name="catalog.topnav">
8
+ <action method="setTemplate"><template>leonambernini/megamenu/topmenu.phtml</template></action>
9
+ <block type="megamenu/html_topmenu_renderer" name="leonambernini.megamenu.renderer" template="leonambernini/megamenu/topmenu/renderer.phtml"/>
10
+ </reference>
11
+ </default>
12
+ </layout>
app/design/frontend/base/default/template/leonambernini/megamenu/topmenu.phtml ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_menu = $this->getHtml('level-top') ?>
2
+ <?php $showHomeButton = Mage::getStoreConfig("megamenu/general/home_link"); ?>
3
+ <?php $homeButtonTitle = Mage::getStoreConfig("megamenu/general/home_link_title"); ?>
4
+ <?php $action = Mage::getStoreConfig("megamenu/general/action"); ?>
5
+ <?php $classCenter = Mage::getStoreConfig("megamenu/general/box_center"); ?>
6
+
7
+ <?php if($_menu): ?>
8
+ <nav id="nav" class="nav-megamenu">
9
+ <?php if( $classCenter ): ?>
10
+ <div class="center">
11
+ <?php endif; ?>
12
+ <ol class="nav-megamenu">
13
+ <?php if( $showHomeButton ): ?>
14
+ <li id="mega-menu-home-link" class="level0"><a href="<?php echo $this->getUrl('') ?>" title="" class="mega-menu-link level0 transition"><?php echo $homeButtonTitle ?></a></li>
15
+ <?php endif; ?>
16
+ <?php echo $_menu ?>
17
+ </ol>
18
+ <?php if( $classCenter ): ?>
19
+ </div>
20
+ <?php endif; ?>
21
+ </nav>
22
+
23
+ <?php if( $action == 'click' ): ?>
24
+
25
+ <script type="text/javascript">
26
+ jQuery(document).ready(function() {
27
+
28
+ var megaMenuHideElement = function( $element ){
29
+ $element.slideUp(200);
30
+ };
31
+ var $buttons = jQuery('.mega-menu-link');
32
+ var $children = jQuery('.box-children');
33
+ if( $buttons.length ){
34
+
35
+ $buttons.live( 'click', function(){
36
+ var $this = jQuery(this);
37
+ var dataLevel = $this.attr('data-level');
38
+ var $child = $this.parent('li.'+dataLevel).children('.box-'+dataLevel);
39
+
40
+ if( $child.length ){
41
+ if( $child.is(':visible') ){
42
+ return true;
43
+ }else{
44
+ megaMenuHideElement( $children );
45
+ $child.slideDown(1000);
46
+ return false;
47
+ }
48
+ }
49
+ });
50
+
51
+ $buttons.parent('li').mouseleave( function(){
52
+ megaMenuHideElement( $children );
53
+ });
54
+ }
55
+ });
56
+ </script>
57
+
58
+ <?php endif; ?>
59
+
60
+ <?php endif; ?>
app/design/frontend/base/default/template/leonambernini/megamenu/topmenu/renderer.phtml ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // GET ALL MEGA MENU ITEMS
3
+ $today = date("Y-m-d");
4
+ $megaMenu = Mage::getModel('megamenu/megamenu')
5
+ ->getCollection()
6
+ ->addFieldToFilter(
7
+ array('stores', 'stores'),
8
+ array(
9
+ array('finset'=>Mage::app()->getStore()->getId()),
10
+ array('eq'=>'0'))
11
+ )
12
+ ->addFieldToFilter('start_time', array( array('lteq' => $today), array('null' => true)))
13
+ ->addFieldToFilter('end_time', array(array('gteq' => $today), array('null' => true)))
14
+ ->addFieldToFilter('status', array('eq' => '1'))
15
+ ->setOrder("id","ASC");
16
+ $megaItems = array();
17
+ foreach ( $megaMenu as $item ){
18
+ $megaItems[ 'category-node-' . $item->getCategory() ]['id'] = $item->getId();
19
+ $megaItems[ 'category-node-' . $item->getCategory() ]['title'] = $item->getTitle();
20
+ $megaItems[ 'category-node-' . $item->getCategory() ]['filename'] = $item->getFilename();
21
+ $megaItems[ 'category-node-' . $item->getCategory() ]['url'] = ( strpos( $item->getUrl(), 'http://' ) > -1 || strpos( $item->getUrl(), 'https://' ) > -1 ) ? $item->getUrl() : 'http://' . $item->getUrl();
22
+ $megaItems[ 'category-node-' . $item->getCategory() ]['target'] = $item->getTarget();
23
+ $megaItems[ 'category-node-' . $item->getCategory() ]['product_id'] = $item->getProductId();
24
+ $megaItems[ 'category-node-' . $item->getCategory() ]['block_id'] = $item->getBlockId();
25
+ }
26
+
27
+ // BEGGIN THE HTML RETURN CODE
28
+ $html = '';
29
+
30
+ $children = $menuTree->getChildren();
31
+ $parentLevel = $menuTree->getLevel();
32
+ $childLevel = is_null($parentLevel) ? 0 : $parentLevel + 1;
33
+
34
+ $counter = 1;
35
+ $counterCols = 1;
36
+ $childrenCount = $levels;
37
+
38
+ $parentPositionClass = $menuTree->getPositionClass();
39
+ $itemPositionClassPrefix = $parentPositionClass ? $parentPositionClass . '-' : 'nav-';
40
+
41
+ // LOOPING LEVELS OF MENU
42
+ foreach ($children as $child) {
43
+
44
+ // SETTING CONFIGS MEGA MENU
45
+ $levels = Mage::getStoreConfig("megamenu/general/levels");
46
+ $action = Mage::getStoreConfig("megamenu/general/action");
47
+ $showImage = Mage::getStoreConfig("megamenu/general/featured_img");
48
+ $display = 'levels-display-' . Mage::getStoreConfig("megamenu/levels/display");
49
+ $cols = Mage::getStoreConfig("megamenu/levels/cols_sublevel");
50
+ $id = $child->getId();
51
+
52
+ $child->setLevel($childLevel);
53
+ $child->setIsFirst($counter == 1);
54
+ $child->setIsLast($counter == $childrenCount);
55
+ $child->setPositionClass($itemPositionClassPrefix . $counter);
56
+
57
+ $widthItems = '';
58
+ if ( $childLevel > 0 ) {
59
+ $widthItems = Mage::getStoreConfig("megamenu/levels/item_width");
60
+ $widthItems = ( $widthItems == 0 ) ? '' : 'style="width: ' . $widthItems . 'px;"';
61
+ }
62
+
63
+ $widthBox = '';
64
+ if ( $childLevel == 0 ) {
65
+ $widthBox = Mage::getStoreConfig("megamenu/levels/box_width");
66
+ $widthBox = ( $widthBox == 0 ) ? '' : 'style="width: ' . $widthBox . 'px;"';
67
+ }
68
+
69
+ $nextChildLevel = $childLevel + 1;
70
+
71
+ $outermostClassCode = 'level'. $childLevel;
72
+ $_hasChildren = ( $child->hasChildren() && ( $nextChildLevel <= $levels ) ) ? 'has-children' : '';
73
+
74
+ if( $counter > Mage::getStoreConfig("megamenu/levels/invert_box") ){ $child->setClass('open-left'); }
75
+ $html .= '<li '. $this->_getRenderedMenuItemAttributes($child) .' '.$widthItems.'>';
76
+
77
+ $html .= '<a href="'. $child->getUrl() .'" data-level="'. $outermostClassCode .'" class="transition mega-menu-link ' . $outermostClassCode .' '. $_hasChildren .'">'. $this->escapeHtml($this->__($child->getName())) .'</a>';
78
+
79
+ if (!empty($childrenWrapClass)) {
80
+ $html .= '<span class="'. $childrenWrapClass .'">';
81
+ }
82
+
83
+ if (!empty($_hasChildren) ) {
84
+
85
+ $html .= '<span class="box-children box-' . $outermostClassCode . '" id="box-chield-' . $id .'" '.$widthBox.'>';
86
+ //$htmlChild = '<ul class="level'. $childLevel .' ' . $display . '">';
87
+ $htmlChild = $this->render($child, $childrenWrapClass);
88
+ //$htmlChild .= '</ul>';
89
+
90
+ if( $showImage && ( $megaItems && isset( $megaItems[$id] ) ) ){
91
+ $html .= '<ul class="have-mega-menu-item level'. $childLevel .' ' . $display . '">';
92
+ $html .= $htmlChild;
93
+ $html .= '</ul>';
94
+
95
+ $printImage = false;
96
+ $printBlock = false;
97
+ $printProduct = false;
98
+
99
+ /* print de product element */
100
+ if( $megaItems[$id]['product_id'] > 0 ){
101
+ //$product = Mage::getModel('catalog/product')->load($megaItems[$id]['product_id']);
102
+ $product = Mage::getModel('catalog/product')->load($megaItems[$id]['product_id']);
103
+ if( $product ){
104
+ $html .= '<span class="mega-menu-product-item" id="mega-menu-item' . $megaItems[$id]['id'] . '">';
105
+ $html .= '<a href="' . $product->getProductUrl() . '" title="' . $product->getName() . '" class="mega-menu-product-img">';
106
+ $html .= '<img src="' . Mage::helper('catalog/image')->init($product, 'image') . '" alt="' . $product->getName() . '" title="' . $product->getName() . '" class="mega-menu-product-img"/>';
107
+ $html .= '<b class="mega-menu-product-name transition">' . $product->getName() . '</b>';
108
+ $html .= '<span class="mega-menu-product-value">' . Mage::helper('core')->currency($product->getPrice()) . '</span>';
109
+ $html .= '</a>';
110
+ $html .= '</span>';
111
+ $printProduct = true;
112
+ }
113
+ }
114
+
115
+ /* print de block element */
116
+ if( !$printProduct && !$printImage && $megaItems[$id]['block_id'] != '' ){
117
+ if( Mage::getModel('cms/block')->load($megaItems[$id]['block_id'])->getIsActive() ){
118
+ $html .= '<span class="mega-menu-block-item" id="mega-menu-item' . $megaItems[$id]['id'] . '">';
119
+ $html .= $this->getLayout()->createBlock('cms/block')->setBlockId($megaItems[$id]['block_id'])->toHtml();
120
+ $html .= '</span>';
121
+ $printBlock = true;
122
+ }
123
+ }
124
+
125
+ /* print de image element */
126
+ if( !$printBlock && !$printProduct ){
127
+ $html .= '<span class="mega-menu-item" id="mega-menu-item-' . $megaItems[$id]['id'] . '">';
128
+ $html .= '<a href="' . $megaItems[$id]['url'] . '" title="' . $megaItems[$id]['title'] . '" target="' . $megaItems[$id]['target'] . '"><img class="mega-menu-item-img" src="' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . $megaItems[$id]['filename'] . '" title="' . $megaItems[$id]['title'] . '" alt="' . $megaItems[$id]['title'] . '"></a>';
129
+ $html .= '</span>';
130
+ }
131
+ }else{
132
+ $html .= '<ul class="level'. $childLevel .' ' . $display . '">';
133
+ $html .= $htmlChild;
134
+ $html .= '</ul>';
135
+ }
136
+ $html .= '</span>';
137
+ }
138
+
139
+ if (!empty($childrenWrapClass)) {
140
+ $html .= '</span>';
141
+ }
142
+
143
+ $html .= '</li>';
144
+ $counter++;
145
+ }
146
+
147
+ return $html;
app/etc/modules/LeonamBernini_MegaMenu.xml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ * @category LeonamBernini
4
+ * @package LeonamBernini_MegaMenu
5
+ * @copyright Copyright (c) 2014 Leonam Bernini. (http://www.agencianex.com.br)
6
+ */
7
+ -->
8
+ <config>
9
+ <modules>
10
+ <LeonamBernini_MegaMenu>
11
+ <active>true</active>
12
+ <codePool>community</codePool>
13
+ </LeonamBernini_MegaMenu>
14
+ </modules>
15
+ </config>
app/locale/en_US/LeonamBernini_MegaMenu.csv ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Mega Menu","Mega Menu"
2
+ "General","General"
3
+ "Enable",Enable"
4
+ "Disable","Disable"
5
+ "Levels","Levels"
6
+ "Action","Action"
7
+ "Show home button","Show home button"
8
+ "Button home title","Button home title"
9
+ "Show image","Show image"
10
+ "Add box to align center?","Add box to align center?"
11
+ "Width of Box","Width of Box"
12
+ "Width of Items","Width of Items"
13
+ "Display","Display"
14
+ "Reverse side opening level","Reverse side opening level"
15
+
16
+ "amount of sublevels that appears","amount of sublevels that appears"
17
+ "activate when you click or hover","activate when you click or hover"
18
+ "allow viewing of featured picture on sublevel","allow viewing of featured picture on sublevel"
19
+ "add box with class "center" for config in css.","add box with class "center" for config in css."
20
+ "in px or 0 for editing in css","in px or 0 for editing in css"
21
+ "from the number indicated an 'open-left' class will be added, making the sublevel open to left","from the number indicated an 'open-left' class will be added, making the sublevel open to left"
22
+
23
+ "MegaMenu Settings - NEX","MegaMenu Settings - NEX"
24
+ "MegaMenu (nex)","MegaMenu (nex)"
25
+ "Manage Items","Manage Items"
26
+
27
+ "Items Manager","Items Manager"
28
+ "Item Manager","Item Manager"
29
+ "Item News","Item News"
30
+ "Item does not exist","Item does not exist"
31
+ "Item was successfully saved","Item was successfully saved"
32
+ "Item was successfully deleted","Item was successfully deleted"
33
+ "Add Item","Add Item"
34
+ "Save Item","Save Item"
35
+ "Delete Item","Delete Item"
36
+ "Edit Item '%s'","Edit Item '%s'"
37
+ "Item Information","Item Information"
38
+
39
+ "ID","ID"
40
+ "Image","Image"
41
+ "Category","Category"
42
+ "Title","Title"
43
+ "Product ID","Product ID"
44
+ "Block ID","Block ID"
45
+ "URL","URL"
46
+ "Store","Store"
47
+ "Start Time","Start Time"
48
+ "Start date","Start date"
49
+ "End Time","End Time"
50
+ "End date","End date"
51
+ "Status","Status"
52
+ "Active","Active"
53
+ "Inactive","Inactive"
54
+ "Target","Target"
55
+ "Select Store","Select Store"
56
+ "Blank","Blank"
57
+ "New","New"
58
+ "Image File","Image File"
59
+
60
+ "none","none"
61
+ "one level","one level"
62
+ "two levels","two levels"
63
+ "three levels","three levels"
64
+ "on hover","on hover"
65
+ "on click","on click"
66
+ "inline block","inline block"
67
+ "block","block"
app/locale/pt_BR/LeonamBernini_MegaMenu.csv ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Mega Menu","Mega Menu"
2
+ "General","Geral"
3
+ "Enable",Habilitar"
4
+ "Disable","Desabilitar"
5
+ "Levels","Niveis"
6
+ "Action","Ação"
7
+ "Show home button","Exibir botão home"
8
+ "Button home title","Titulo do botão home"
9
+ "Show image","Exibir imagem"
10
+ "Add box to align center?","Adicionar box 'center'?"
11
+ "Width of Box","Largura do box"
12
+ "Width of Items","Largura dos subitens"
13
+ "Display","Display"
14
+ "Reverse side opening level","Inverter o lado de abertura do nivel"
15
+
16
+ "amount of sublevels that appears","quantidade permitida de subniveis"
17
+ "activate when you click or hover","como sera ativado, com clique ou hover"
18
+ "allow viewing of featured picture on sublevel","permitir a visualização da imagem em destaque no subnível"
19
+ "add box with class "center" for config in css.","caixa com classe "center" para manipular com css."
20
+ "in px or 0 for editing in css","em px ou 0 para editar pelo css"
21
+ "from the number indicated an 'open-left' class will be added, making the sublevel open to left","apartir do número indicado sera inserido uma classe de 'abrir-esquerda' fazendo com que o subnivel abra para a esquerda"
22
+
23
+ "MegaMenu Settings - NEX","MegaMenu Configurações - NEX"
24
+ "MegaMenu (nex)","MegaMenu (nex)"
25
+ "Manage Items","Gerenciar Itens"
26
+
27
+ "Items Manager","Gerenciar Itens"
28
+ "Item Manager","Gerenciar Item"
29
+ "Item News","Novos"
30
+ "Item does not exist","Este item não existe"
31
+ "Item was successfully saved","O item foi salvo com sucesso"
32
+ "Item was successfully deleted","O item foi deletado com sucesso"
33
+ "Add Item","Novo"
34
+ "Save Item","Salvar"
35
+ "Delete Item","Deletar"
36
+ "Edit Item '%s'","Editar item '%s'"
37
+ "Item Information","Informação do Item"
38
+
39
+ "ID","ID"
40
+ "Image","Imagem"
41
+ "Category","Categoria"
42
+ "Title","Titulo"
43
+ "Product ID","ID do Produto"
44
+ "Block ID","ID do Bloco"
45
+ "URL","URL"
46
+ "Store","Loja"
47
+ "Start Time","Data de Inicio"
48
+ "Start date","Data de Inicio"
49
+ "End Time","Data fim"
50
+ "End date","Data fim"
51
+ "Status","Status"
52
+ "Active","Ativo"
53
+ "Inactive","Inativo"
54
+ "Target","Target"
55
+ "Select Store","Selecione a loja"
56
+ "Blank","Blank"
57
+ "New","New"
58
+ "Image File","Arquivo de Imagem"
59
+
60
+ "none","nenhum"
61
+ "one level","um nivel"
62
+ "two levels","dois niveis"
63
+ "three levels","três niveis"
64
+ "on hover","on hover"
65
+ "on click","on click"
66
+ "inline block","inline block"
67
+ "block","block"
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>easy_mega_menu</name>
4
+ <version>1.0.1</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/mit-license.php">MIT License</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Easy Mega Menu extension for magento</summary>
10
+ <description>Mega menu easy to use yet full, was now easy to create a menu with quality and flexibility.</description>
11
+ <notes>First version stable</notes>
12
+ <authors><author><name>Leonam Bernini</name><user>leonambernini</user><email>leonam.b@hotmail.com</email></author></authors>
13
+ <date>2014-10-28</date>
14
+ <time>05:02:47</time>
15
+ <contents><target name="magecommunity"><dir name="LeonamBernini"><dir name="MegaMenu"><dir name="Block"><dir name="Adminhtml"><dir name="Grid"><dir name="Renderer"><file name="Image.php" hash="7a3d8dc2e6a21199958f2f98fffea348"/></dir></dir><dir name="Megamenu"><dir name="Edit"><file name="Form.php" hash="87d678533750097e5938cb01296857d4"/><dir name="Tab"><file name="Form.php" hash="fab2d32a105abfa695a344794e455b8d"/></dir><file name="Tabs.php" hash="20b207b19806a416088034dfecd410e9"/></dir><file name="Edit.php" hash="21f4da1931881a4fb5ae1b6f5ad14d99"/><file name="Grid.php" hash="b489d4001814f90d7cfa69962619da33"/></dir><file name="Megamenu.php" hash="89a8d8d78268d870fa448d88c679d1b0"/></dir><dir name="Html"><dir name="Topmenu"><file name="Renderer.php" hash="154c25975739ee821ab4293d2b6ba351"/></dir><file name="Topmenu.php" hash="8f3a240393aa4eaec837f78665bec4c0"/></dir><file name="Megamenu.php" hash="247f835affc88afaa71922a37c93ab19"/></dir><dir name="Helper"><file name="Data.php" hash="210840c7cea69df7a9c7308b64c6707f"/></dir><dir name="Model"><file name="Megamenu.php" hash="6fd2e85d4b0ad1900bb9fdc3e40e02ae"/><dir name="Mysql4"><dir name="Megamenu"><file name="Collection.php" hash="72d11f622ce9383b96b2d6cc3c85a848"/></dir><file name="Megamenu.php" hash="d9b2a354ec5e9b8e4d5fc8efa629775b"/></dir><dir name="Source"><file name="Action.php" hash="842a4ce1ff706ab41f24dafc225a2637"/><file name="DisplaySublevel.php" hash="3ecdc0f31448aeacabf3027cc0167cdc"/><file name="QtyLevels.php" hash="4775ba835e639d26a7aaa62899331490"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="IndexController.php" hash="ff6b3e45d45e9a461814410800467a4d"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="bffda75f55addc4ec9c743d64fce81d1"/><file name="config.xml" hash="5a1c291e2b4ac03c91b2679e71a7270b"/><file name="system.xml" hash="76d9c87958bb23baa48264a9a39ec92b"/></dir><dir name="sql"><dir name="megamenu_setup"><file name="mysql4-install-1.0.1.php" hash="c6c7e05f751a14078f78bf9f34f166b7"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="leonambernini"><file name="megamenu.xml" hash="e8b67090c61987e2eaa2da09064d66ae"/></dir></dir><dir name="template"><dir name="leonambernini"><dir name="megamenu"><dir name="topmenu"><file name="renderer.phtml" hash="3c9ea895a459540449ec3da289080266"/></dir><file name="topmenu.phtml" hash="59f8af11fc2792170d7470fdc663b7a3"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="LeonamBernini_MegaMenu.xml" hash="f63cc8dd91baef54618b05974f869b13"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="leonam_bernini"><dir name="megamenu"><dir name="css"><file name="megamenu.css" hash="bf037792139d88ee3cb8c8cc3ed28ceb"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir><dir name="en_US"><file name="LeonamBernini_MegaMenu.csv" hash="bf8dcd3e8fce2df2457d68a7ec745fae"/></dir><dir name="pt_BR"><file name="LeonamBernini_MegaMenu.csv" hash="1f8e29b1d013633ae59192e082241478"/></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>
skin/frontend/base/default/leonam_bernini/megamenu/css/megamenu.css ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ To change this license header, choose License Headers in Project Properties.
3
+ To change this template file, choose Tools | Templates
4
+ and open the template in the editor.
5
+ */
6
+ /*
7
+ Created on : 24/10/2014, 21:35:27
8
+ Author : Leonam
9
+ */
10
+ .nav-megamenu{ position: relative; z-index: 999999; }
11
+
12
+ .transition{ -webkit-transition: 150ms all linear 0s; -moz-transition: 150ms all linear 0s; -o-transition: 150ms all linear 0s; transition: 150ms all linear 0s; }
13
+ .center{ display: block; margin: 0 auto; max-width: 1200px; min-width: 1200px; width: 100%; }
14
+
15
+ .nav-megamenu li.level0,
16
+ .nav-megamenu .box-children ul,
17
+ .levels-display-inline-block > li{ display: inline-block; vertical-align: top; /* Setting a common base */ margin: 0; padding: 0; /* For IE 7 */ zoom: 1; *display: inline; }
18
+ .levels-display-block > li{ display: block; }
19
+
20
+ .nav-megamenu li{ position: relative; }
21
+
22
+ .nav-megamenu li.level0:hover .box-level0,
23
+ .nav-megamenu li.level1:hover .box-level1,
24
+ .nav-megamenu li.level2:hover .box-level2,
25
+ .nav-megamenu li.level3:hover .box-level3{ display: block; }
26
+
27
+ .nav-megamenu .box-children{ display: none; padding: 15px; position: absolute; }
28
+
29
+ .nav-megamenu .box-level0{ background-color: #fff; border-radius: 0 0 5px 5px; left: 0; top: 50px; min-width: 300px; z-index: 10; }
30
+ .nav-megamenu .open-left .box-level0{ left: auto; right: 0; }
31
+ .nav-megamenu .box-level1{ background-color: #000; border-radius: 0 0 5px 5px; right: 0; top: 50px; z-index: 20; }
32
+ .nav-megamenu .open-left .box-level1{ left: 0; right: auto; }
33
+ .nav-megamenu .box-level2{ background-color: #fff; left: 250px; top: 0; z-index: 30; }
34
+
35
+ .nav-megamenu .box-children ul{ position: relative; }
36
+ .nav-megamenu .box-children ul.have-mega-menu-item{ max-width: 270px; }
37
+
38
+ /* BOX MEGA MENU IMAGEM */
39
+ .nav-megamenu .mega-menu-item{ float: right; max-height: 300px; max-width: 300px; padding-left: 5px; }
40
+ .nav-megamenu .mega-menu-item a{ display: block; }
41
+ .nav-megamenu .mega-menu-item img{ display: block; max-height: 100%; max-width: 100%; }
42
+
43
+ /* BOX MEGA MENU IMAGEM */
44
+ .nav-megamenu .mega-menu-product-item{ float: right; width: 250px; padding-left: 5px; }
45
+ .nav-megamenu .mega-menu-product-item a{ border-left: 1px solid #008AFF; display: block; padding: 0 0 0 15px; text-decoration: none; }
46
+ .nav-megamenu .mega-menu-product-item a:hover .mega-menu-product-name{ color: #0413C0; }
47
+ .nav-megamenu .mega-menu-product-item .mega-menu-product-img{ display: block; max-width: 100%; }
48
+ .nav-megamenu .mega-menu-product-item .mega-menu-product-name{ color: #008AFF; display: block; font: 400 13px/15px 'Tahoma', sans-serif; letter-spacing: -1px; padding: 5px 0; }
49
+ .nav-megamenu .mega-menu-product-item .mega-menu-product-value{ color: #084; display: block; font: 400 15px/18px 'Tahoma', sans-serif; letter-spacing: -1px; padding: 5px 0; }
50
+
51
+
52
+
53
+ .nav-megamenu li.level0 .mega-menu-link{ display: block; font: 400 16px/20px 'Tahoma', sans-serif; padding: 15px 20px; text-decoration: none; }
54
+
55
+ .nav-megamenu li.level0 > .mega-menu-link{ color: #060606; }
56
+ .nav-megamenu li.level0 > .mega-menu-link:hover{ color: #007ED1; }
57
+
58
+ .nav-megamenu li.level1 > .mega-menu-link{ color: #060606; }
59
+ .nav-megamenu li.level1 > .mega-menu-link:hover{ color: #007ED1; }
60
+
61
+ .nav-megamenu li.level2 > .mega-menu-link{ color: #fff; }
62
+ .nav-megamenu li.level2 > .mega-menu-link:hover{ color: #e6ffff; }