Version Notes
First stable release
Download this release
Release Info
Developer | Leandro Villagran |
Extension | Venu_Menu |
Version | 1.0.0.0 |
Comparing to | |
See all releases |
Version 1.0.0.0
- app/code/community/Vstudio/Venu/Block/Adminhtml/Menumanager.php +14 -0
- app/code/community/Vstudio/Venu/Block/Adminhtml/Menumanager/Edit.php +48 -0
- app/code/community/Vstudio/Venu/Block/Adminhtml/Menumanager/Edit/Form.php +17 -0
- app/code/community/Vstudio/Venu/Block/Adminhtml/Menumanager/Edit/Tab/Categories.php +85 -0
- app/code/community/Vstudio/Venu/Block/Adminhtml/Menumanager/Edit/Tab/Custom.php +30 -0
- app/code/community/Vstudio/Venu/Block/Adminhtml/Menumanager/Edit/Tab/Form.php +195 -0
- app/code/community/Vstudio/Venu/Block/Adminhtml/Menumanager/Edit/Tab/Pages.php +29 -0
- app/code/community/Vstudio/Venu/Block/Adminhtml/Menumanager/Edit/Tabs.php +37 -0
- app/code/community/Vstudio/Venu/Block/Adminhtml/Menumanager/Grid.php +87 -0
- app/code/community/Vstudio/Venu/Block/Menu.php +133 -0
- app/code/community/Vstudio/Venu/Helper/Data.php +4 -0
- app/code/community/Vstudio/Venu/Model/MenuItem.php +12 -0
- app/code/community/Vstudio/Venu/Model/Options.php +44 -0
- app/code/community/Vstudio/Venu/Model/Resource/Menuitem.php +8 -0
- app/code/community/Vstudio/Venu/Model/Resource/Menuitem/Collection.php +8 -0
- app/code/community/Vstudio/Venu/Model/Resource/Venu.php +8 -0
- app/code/community/Vstudio/Venu/Model/Resource/Venu/Collection.php +8 -0
- app/code/community/Vstudio/Venu/Model/Venu.php +21 -0
- app/code/community/Vstudio/Venu/controllers/Adminhtml/Venu/MenuController.php +300 -0
- app/code/community/Vstudio/Venu/controllers/VenuController.php +10 -0
- app/code/community/Vstudio/Venu/data/vstudio_venu_setup/data-install-1.0.0.0.php +66 -0
- app/code/community/Vstudio/Venu/etc/adminhtml.xml +48 -0
- app/code/community/Vstudio/Venu/etc/config.xml +87 -0
- app/code/community/Vstudio/Venu/etc/system.xml +47 -0
- app/code/community/Vstudio/Venu/sql/vstudio_venu_setup/install-1.0.0.0.php +82 -0
- app/design/adminhtml/default/default/layout/venu.xml +28 -0
- app/design/adminhtml/default/default/template/vstudio/venu/edit/tab/category.phtml +114 -0
- app/design/frontend/default/default/layout/venu.xml +19 -0
- app/design/frontend/default/default/template/vstudio/venu/menu.phtml +18 -0
- app/etc/modules/Vstudio_Venu.xml +12 -0
- package.xml +76 -0
- skin/frontend/default/default/vstudio/venu/master.css +193 -0
app/code/community/Vstudio/Venu/Block/Adminhtml/Menumanager.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Vstudio_Venu_Block_Adminhtml_MenuManager
|
4 |
+
extends Mage_Adminhtml_Block_Widget_Grid_Container {
|
5 |
+
public function __construct() {
|
6 |
+
// $this->_blockGroup.'/' . $this->_controller . '_grid'
|
7 |
+
$this -> _controller = 'adminhtml_menumanager';
|
8 |
+
$this -> _blockGroup = 'vstudio_venu';
|
9 |
+
$this -> _headerText = Mage::helper('vstudio_venu') -> __('Menu Manager');
|
10 |
+
$this -> _addButtonLabel = Mage::helper('vstudio_venu') -> __('Add Menu');
|
11 |
+
parent::__construct();
|
12 |
+
}
|
13 |
+
|
14 |
+
}
|
app/code/community/Vstudio/Venu/Block/Adminhtml/Menumanager/Edit.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
*
|
5 |
+
* When clicked on an items grid
|
6 |
+
* this is the container for that item
|
7 |
+
*/
|
8 |
+
class Vstudio_Venu_Block_Adminhtml_MenuManager_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
9 |
+
{
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
parent::__construct();
|
13 |
+
$this->_objectId = 'menu_id';
|
14 |
+
$this->_blockGroup = 'vstudio_venu';
|
15 |
+
$this->_controller = 'adminhtml_menumanager';
|
16 |
+
|
17 |
+
$this->_updateButton('save', 'label', Mage::helper('vstudio_venu')->__('Save Menu'));
|
18 |
+
$this->_updateButton('delete', 'label', Mage::helper('vstudio_venu')->__('Delete Menu'));
|
19 |
+
|
20 |
+
$this->_addButton('saveandcontinue', array(
|
21 |
+
'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
|
22 |
+
'onclick' => 'saveAndContinueEdit()',
|
23 |
+
'class' => 'save',
|
24 |
+
), -100);
|
25 |
+
|
26 |
+
$this->_formScripts[] = "
|
27 |
+
function saveAndContinueEdit(){
|
28 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
29 |
+
}
|
30 |
+
";
|
31 |
+
}
|
32 |
+
|
33 |
+
protected function _prepareLayout() {
|
34 |
+
parent::_prepareLayout();
|
35 |
+
if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
|
36 |
+
$this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
public function getHeaderText()
|
41 |
+
{
|
42 |
+
if( Mage::registry('venu_data') && Mage::registry('venu_data')->getId() ) {
|
43 |
+
return Mage::helper('vstudio_venu')->__("Edit Menu '%s'", $this->htmlEscape(Mage::registry('venu_data')->getData('menu_title')));
|
44 |
+
} else {
|
45 |
+
return Mage::helper('vstudio_venu')->__('Add New Menu');
|
46 |
+
}
|
47 |
+
}
|
48 |
+
}
|
app/code/community/Vstudio/Venu/Block/Adminhtml/Menumanager/Edit/Form.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Vstudio_Venu_Block_Adminhtml_MenuManager_Edit_Form extends Mage_Adminhtml_Block_Widget_Form {
|
3 |
+
|
4 |
+
protected function _prepareForm() {
|
5 |
+
$form = new Varien_Data_Form(array(
|
6 |
+
'id' => 'edit_form',
|
7 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
8 |
+
'method' => 'post',
|
9 |
+
'enctype' => 'multipart/form-data'
|
10 |
+
)
|
11 |
+
);
|
12 |
+
|
13 |
+
$form->setUseContainer(true);
|
14 |
+
$this->setForm($form);
|
15 |
+
return parent::_prepareForm();
|
16 |
+
}
|
17 |
+
}
|
app/code/community/Vstudio/Venu/Block/Adminhtml/Menumanager/Edit/Tab/Categories.php
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Vstudio_Venu_Block_Adminhtml_MenuManager_Edit_Tab_Categories
|
4 |
+
extends Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Categories {
|
5 |
+
protected $_categoryIds = null;
|
6 |
+
protected $_selectedNodes = null;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Specify template to use
|
10 |
+
*/
|
11 |
+
public function __construct()
|
12 |
+
{
|
13 |
+
parent::__construct();
|
14 |
+
$this->setTemplate('vstudio/venu/edit/tab/category.phtml');
|
15 |
+
$this->_withProductCount = false;
|
16 |
+
}
|
17 |
+
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Return array with category IDs which the product is assigned to
|
21 |
+
*
|
22 |
+
* @return array
|
23 |
+
*/
|
24 |
+
protected function getCategoryIds()
|
25 |
+
{
|
26 |
+
return $this->getMenu()->getCategoryIds();
|
27 |
+
}
|
28 |
+
/**
|
29 |
+
* Checks when this block is readonly
|
30 |
+
*
|
31 |
+
* @return boolean
|
32 |
+
*/
|
33 |
+
public function isReadonly()
|
34 |
+
{
|
35 |
+
return $this->getMenu()->getCategoriesReadonly();
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Retrieve currently edited product
|
40 |
+
*
|
41 |
+
* @return Vstudio_Venu_Model_Venu
|
42 |
+
*/
|
43 |
+
public function getMenu()
|
44 |
+
{
|
45 |
+
return Mage::registry('current_menu');
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Returns array with configuration of current node
|
50 |
+
*
|
51 |
+
* @param Varien_Data_Tree_Node $node
|
52 |
+
* @param int $level How deep is the node in the tree
|
53 |
+
* @return array
|
54 |
+
*/
|
55 |
+
protected function _getNodeJson($node, $level = 1)
|
56 |
+
{
|
57 |
+
|
58 |
+
$item = parent::_getNodeJson($node, $level);
|
59 |
+
|
60 |
+
if ($this->_isParentSelectedCategory($node)) {
|
61 |
+
$item['expanded'] = true;
|
62 |
+
}
|
63 |
+
|
64 |
+
if (in_array($node->getId(), $this->getCategoryIds())) {
|
65 |
+
|
66 |
+
$item['checked'] = true;
|
67 |
+
}
|
68 |
+
|
69 |
+
if ($this->isReadonly()) {
|
70 |
+
$item['disabled'] = true;
|
71 |
+
}
|
72 |
+
|
73 |
+
return $item;
|
74 |
+
}
|
75 |
+
/**
|
76 |
+
* Returns URL for loading tree
|
77 |
+
*
|
78 |
+
* @param null $expanded
|
79 |
+
* @return string
|
80 |
+
*/
|
81 |
+
public function getLoadTreeUrl($expanded = null)
|
82 |
+
{
|
83 |
+
return $this->getUrl('*/*/categoriesJson', array('_current' => true));
|
84 |
+
}
|
85 |
+
}
|
app/code/community/Vstudio/Venu/Block/Adminhtml/Menumanager/Edit/Tab/Custom.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Vstudio_Venu_Block_Adminhtml_MenuManager_Edit_Tab_Custom extends Mage_Adminhtml_Block_Widget_Form {
|
4 |
+
|
5 |
+
protected function _prepareForm() {
|
6 |
+
$form = new Varien_Data_Form();
|
7 |
+
$this->setForm($form);
|
8 |
+
$fieldset = $form->addFieldset('menu_edit_custom_form', array('legend' => Mage::helper('vstudio_venu')->__('Create Custom Menu')));
|
9 |
+
|
10 |
+
$fieldset->addField('custom_title', 'text', array(
|
11 |
+
'label' => Mage::helper('vstudio_venu')->__('Link Title'),
|
12 |
+
'name' => 'custom[0][title]',
|
13 |
+
));
|
14 |
+
$fieldset->addField('custom_link', 'text', array(
|
15 |
+
'label' => Mage::helper('vstudio_venu')->__('Link Url'),
|
16 |
+
'name' => 'custom[0][link]',
|
17 |
+
));
|
18 |
+
/** set form data **/
|
19 |
+
if (Mage::getSingleton('adminhtml/session') -> getVenuData()) {
|
20 |
+
$form -> setValues(Mage::getSingleton('adminhtml/session') -> getVenuData());
|
21 |
+
Mage::getSingleton('adminhtml/session') -> setVenuData(null);
|
22 |
+
} elseif (Mage::registry('venu_data')) {
|
23 |
+
$menuItems = Mage::registry('venu_data') -> getData('menu_items');
|
24 |
+
$form -> setValues(Mage::registry('venu_data') -> getData());
|
25 |
+
}
|
26 |
+
|
27 |
+
return parent::_prepareForm();
|
28 |
+
}
|
29 |
+
|
30 |
+
}
|
app/code/community/Vstudio/Venu/Block/Adminhtml/Menumanager/Edit/Tab/Form.php
ADDED
@@ -0,0 +1,195 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Vstudio_Venu_Block_Adminhtml_MenuManager_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {
|
4 |
+
|
5 |
+
protected function _prepareForm() {
|
6 |
+
$form = new Varien_Data_Form();
|
7 |
+
$this->setForm($form);
|
8 |
+
$fieldset = $form->addFieldset('menu_edit_form', array('legend' => Mage::helper('vstudio_venu')->__('Menu information')));
|
9 |
+
$options = Mage::getSingleton('vstudio_venu/options');
|
10 |
+
|
11 |
+
$fieldset->addField('menu_title', 'text', array(
|
12 |
+
'label' => Mage::helper('vstudio_venu')->__('Menu Title'),
|
13 |
+
'class' => 'required-entry',
|
14 |
+
'required' => true,
|
15 |
+
'name' => 'menu_title',
|
16 |
+
));
|
17 |
+
|
18 |
+
$fieldset->addField('menu_orientation', 'select', array(
|
19 |
+
'label' => Mage::helper('vstudio_venu')->__('Menu Orientation'),
|
20 |
+
'name' => "menu_options[menu_orientation]",
|
21 |
+
'values' => $options->getOptionOrientation(),
|
22 |
+
));
|
23 |
+
|
24 |
+
$fieldset->addField('menu_status', 'select', array(
|
25 |
+
'label' => Mage::helper('vstudio_venu')->__('Status'),
|
26 |
+
'name' => 'menu_status',
|
27 |
+
'values' => $options->getOptionStatus(),
|
28 |
+
));
|
29 |
+
|
30 |
+
$fieldset->addField('advance_options', 'hidden', array('after_element_html' => '<button class="scalable save" type="button" title="Edit Menu Item" id="hide_advance">
|
31 |
+
<span><span><span>Show Advance Options</span></span></span></button>
|
32 |
+
<script>
|
33 |
+
document.observe("dom:loaded", function() {
|
34 |
+
$$(\'.advance-options\').invoke(\'up\').invoke(\'up\').invoke(\'hide\');
|
35 |
+
$(\'hide_advance\').observe(\'click\', function(event) {
|
36 |
+
$$(\'.advance-options\').invoke(\'up\').invoke(\'up\').invoke(\'toggle\');
|
37 |
+
});
|
38 |
+
});
|
39 |
+
</script>', ));
|
40 |
+
$fieldset->addField('menu_css_id', 'text', array(
|
41 |
+
'label' => Mage::helper('vstudio_venu')->__('Menu CSS Id'),
|
42 |
+
'name' => "menu_options[menu_css_id]",
|
43 |
+
'class' => 'advance-options',
|
44 |
+
'after_element_html' => '<p class="note"><span>The ID that is applied to the ul element which encloses the menu items.</span></p>',
|
45 |
+
));
|
46 |
+
$fieldset->addField('menu_css_class', 'text', array(
|
47 |
+
'label' => Mage::helper('vstudio_venu')->__('Menu CSS Class'),
|
48 |
+
'name' => "menu_options[menu_css_class]",
|
49 |
+
'class' => 'advance-options',
|
50 |
+
'after_element_html' => '<p class="note"><span>The class that is applied to the ul element which encloses the menu items.</span></p>',
|
51 |
+
));
|
52 |
+
|
53 |
+
$fieldset->addField('container_id', 'text', array(
|
54 |
+
'label' => Mage::helper('vstudio_venu')->__('Menu container id'),
|
55 |
+
'name' => "menu_options[container_id]",
|
56 |
+
'class' => 'advance-options',
|
57 |
+
'after_element_html' => '<p class="note"><span>The css id that is applied to the container</span></p>',
|
58 |
+
));
|
59 |
+
$fieldset->addField('container_class', 'text', array(
|
60 |
+
'label' => Mage::helper('vstudio_venu')->__('Menu container class'),
|
61 |
+
'name' => "menu_options[container_class]",
|
62 |
+
'class' => 'advance-options',
|
63 |
+
'after_element_html' => '<p class="note"><span>The css class that is applied to the container</span></p>',
|
64 |
+
));
|
65 |
+
$fieldset->addField('menu_container', 'select', array(
|
66 |
+
'label' => Mage::helper('vstudio_venu')->__('Menu Container'),
|
67 |
+
'class' => 'advance-options',
|
68 |
+
'name' => "menu_options[menu_container]",
|
69 |
+
'onclick' => "",
|
70 |
+
'onchange' => "",
|
71 |
+
'value' => '4',
|
72 |
+
'values' => array(
|
73 |
+
'1' => array(
|
74 |
+
'value' => 'nav',
|
75 |
+
'label' => 'Use a nav'
|
76 |
+
),
|
77 |
+
'2' => array(
|
78 |
+
'value' => 'div',
|
79 |
+
'label' => 'Use a div'
|
80 |
+
),
|
81 |
+
'3' => array(
|
82 |
+
'value' => 'none',
|
83 |
+
'label' => 'Use nothing'
|
84 |
+
),
|
85 |
+
),
|
86 |
+
'after_element_html' => '<p class="note"><span>Whether to wrap the ul, You can use div and nav tags</span></p>',
|
87 |
+
));
|
88 |
+
|
89 |
+
/** set form data **/
|
90 |
+
if (Mage::getSingleton('adminhtml/session')->getVenuData()) {
|
91 |
+
$form->setValues(Mage::getSingleton('adminhtml/session')->getVenuData());
|
92 |
+
Mage::getSingleton('adminhtml/session')->setVenuData(null);
|
93 |
+
} elseif (Mage::registry('venu_data')) {
|
94 |
+
|
95 |
+
$data = Mage::registry('venu_data')->getData();
|
96 |
+
// decode menu options and add it to the right field
|
97 |
+
if ( ! empty($data['menu_options'])) {
|
98 |
+
$options = json_decode($data['menu_options']);
|
99 |
+
foreach ($options as $option => $value) {
|
100 |
+
$data[$option] = $value;
|
101 |
+
}
|
102 |
+
}
|
103 |
+
$menuItems = Mage::registry('venu_data')->getData('menu_items');
|
104 |
+
$form->setValues($data);
|
105 |
+
|
106 |
+
$code = Mage::registry('venu_data')->getData('menu_code');
|
107 |
+
if ( ! empty($code)) {
|
108 |
+
$fieldset->addField('menu_code', 'textarea', array(
|
109 |
+
'label' => Mage::helper('vstudio_venu')->__('Menu Code'),
|
110 |
+
'name' => 'menu_code',
|
111 |
+
'value' => $code,
|
112 |
+
'onclick' => "this.select();",
|
113 |
+
'after_element_html' => '<p class="note">
|
114 |
+
<span style="width:100%; color:red;">
|
115 |
+
Use this to add this menu into pages,
|
116 |
+
category pages or static blocks
|
117 |
+
</span></p>',
|
118 |
+
));
|
119 |
+
}
|
120 |
+
|
121 |
+
if ($menuItems > 0 && ! empty($menuItems)) {
|
122 |
+
$field = 0;
|
123 |
+
|
124 |
+
$this->_sortFields($menuItems, SORT_ASC, 'sort_order');
|
125 |
+
foreach ($menuItems as $item) {
|
126 |
+
$fieldset = $form->addFieldset("menu_edit_form_$field", array('legend' => Mage::helper('vstudio_venu')->__("Menu Item {$item['item_label']} Menu Id : {$item['id']}")));
|
127 |
+
|
128 |
+
$fieldset->addField('item_collapse_' . $field, 'hidden', array(
|
129 |
+
'label' => Mage::helper('vstudio_venu')->__('Navigation Label'),
|
130 |
+
'after_element_html' => '<button style="" onclick="$$(\'#menu_edit_form_' . $field . ' tr:gt(0) \').invoke(\'toggle\')" class="scalable save" type="button" title="Edit Menu Item" id=""><span><span><span>Edit Menu Link</span></span></span></button>',
|
131 |
+
));
|
132 |
+
$fieldset->addField('item_label_' . $field, 'text', array(
|
133 |
+
'label' => Mage::helper('vstudio_venu')->__('Navigation Label'),
|
134 |
+
'name' => 'item[' . $item['id'] . '][item_label]',
|
135 |
+
'value' => $item['item_label'],
|
136 |
+
));
|
137 |
+
$fieldset->addField('item_hidden_' . $field, 'hidden', array(
|
138 |
+
'label' => Mage::helper('vstudio_venu')->__('Navigation Label'),
|
139 |
+
'name' => 'item[' . $item['id'] . '][id]',
|
140 |
+
'value' => $item['id'],
|
141 |
+
));
|
142 |
+
$fieldset->addField('item_link_' . $field, 'text', array(
|
143 |
+
'label' => Mage::helper('vstudio_venu')->__('Url Link'),
|
144 |
+
'name' => 'item[' . $item['id'] . '][item_link]',
|
145 |
+
'value' => urldecode($item['item_link']),
|
146 |
+
));
|
147 |
+
$fieldset->addField('sort_order_' . $field, 'text', array(
|
148 |
+
'label' => Mage::helper('vstudio_venu')->__('Menu Item Position'),
|
149 |
+
'name' => 'item[' . $item['id'] . '][sort_order]',
|
150 |
+
'style' => 'width:30%;',
|
151 |
+
'value' => $item['sort_order'],
|
152 |
+
));
|
153 |
+
$fieldset->addField('parent_id_' . $field, 'text', array(
|
154 |
+
'label' => Mage::helper('vstudio_venu')->__('Parent Id'),
|
155 |
+
'name' => 'item[' . $item['id'] . '][parent_id]',
|
156 |
+
'style' => 'width:30%;',
|
157 |
+
'value' => $item['parent_id'],
|
158 |
+
));
|
159 |
+
$fieldset->addField('delete_' . $field, 'checkbox', array(
|
160 |
+
'label' => Mage::helper('vstudio_venu')->__('Delete Menu Item'),
|
161 |
+
'name' => 'item[' . $item['id'] . '][delete]',
|
162 |
+
'value' => $item['id'],
|
163 |
+
));
|
164 |
+
|
165 |
+
$fieldset->addField('hide_elements_' . $field, 'hidden', array(
|
166 |
+
'label' => Mage::helper('vstudio_venu')->__('Navigation Label'),
|
167 |
+
'after_element_html' => '<script>document.observe("dom:loaded", function() { $$(\'#menu_edit_form_' . $field . ' tr:gt(0) \').invoke(\'hide\'); });</script>',
|
168 |
+
));
|
169 |
+
|
170 |
+
$field++;
|
171 |
+
}
|
172 |
+
}
|
173 |
+
}
|
174 |
+
return parent::_prepareForm();
|
175 |
+
}
|
176 |
+
|
177 |
+
/**
|
178 |
+
* Sort a multidimensional array by reference
|
179 |
+
*
|
180 |
+
* @param $data array
|
181 |
+
* @param $order order to be sorted
|
182 |
+
* @param $sortBy key to be sorted
|
183 |
+
*/
|
184 |
+
protected function _sortFields(&$data, $order = SORT_ASC, $sortBy = 'sort_order') {
|
185 |
+
// Obtain a list of columns
|
186 |
+
foreach ($data as $key => $row) {
|
187 |
+
$sortOrder[$key] = $row[$sortBy];
|
188 |
+
}
|
189 |
+
|
190 |
+
// Sort the data with $sortBy ascending, edition ascending
|
191 |
+
// Add $data as the last parameter, to sort by the common key
|
192 |
+
array_multisort($sortOrder, $order, $data);
|
193 |
+
}
|
194 |
+
|
195 |
+
}
|
app/code/community/Vstudio/Venu/Block/Adminhtml/Menumanager/Edit/Tab/Pages.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @author contact@leandrovillagran.com
|
5 |
+
*/
|
6 |
+
class Vstudio_Venu_Block_Adminhtml_MenuManager_Edit_Tab_Pages extends Mage_Adminhtml_Block_Widget_Form {
|
7 |
+
|
8 |
+
protected function _prepareForm() {
|
9 |
+
$form = new Varien_Data_Form();
|
10 |
+
$this->setForm($form);
|
11 |
+
|
12 |
+
$fieldset = $form->addFieldset('banner_form', array('legend' => Mage::helper('vstudio_venu')->__('Menu Pages')));
|
13 |
+
$fieldset->addField('pages', 'multiselect', array(
|
14 |
+
'label' => Mage::helper('vstudio_venu')->__('Visible In'),
|
15 |
+
'name' => 'pages[]',
|
16 |
+
'values' => Mage::getSingleton('vstudio_venu/options')->getOptionPages(),
|
17 |
+
));
|
18 |
+
|
19 |
+
if (Mage::getSingleton('adminhtml/session')->getVliderData()) {
|
20 |
+
$form->setValues(Mage::getSingleton('adminhtml/session')->getVliderData());
|
21 |
+
Mage::getSingleton('adminhtml/session')->setVliderData(null);
|
22 |
+
} elseif (Mage::registry('venu_data')) {
|
23 |
+
$form->setValues(Mage::registry('venu_data')->getData());
|
24 |
+
}
|
25 |
+
|
26 |
+
return parent::_prepareForm();
|
27 |
+
}
|
28 |
+
|
29 |
+
}
|
app/code/community/Vstudio/Venu/Block/Adminhtml/Menumanager/Edit/Tabs.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Vstudio_Venu_Block_Adminhtml_MenuManager_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs {
|
3 |
+
|
4 |
+
public function __construct() {
|
5 |
+
parent::__construct();
|
6 |
+
$this->setId('venu_manage_tabs');
|
7 |
+
$this->setDestElementId('edit_form');
|
8 |
+
$this->setTitle(Mage::helper('vstudio_venu')->__('Menu Information'));
|
9 |
+
}
|
10 |
+
|
11 |
+
protected function _beforeToHtml() {
|
12 |
+
$this->addTab('form_section', array(
|
13 |
+
'label' => Mage::helper('vstudio_venu')->__('Menu Information'),
|
14 |
+
'title' => Mage::helper('vstudio_venu')->__('Menu Information'),
|
15 |
+
'content' => $this->getLayout()->createBlock('vstudio_venu/adminhtml_menumanager_edit_tab_form')->toHtml(),
|
16 |
+
|
17 |
+
));
|
18 |
+
$this->addTab('form_custom', array(
|
19 |
+
'label' => Mage::helper('vstudio_venu')->__('Add Custom Menu Link'),
|
20 |
+
'title' => Mage::helper('vstudio_venu')->__('Add Custom Menu Link'),
|
21 |
+
'content' => $this->getLayout()->createBlock('vstudio_venu/adminhtml_menumanager_edit_tab_custom')->toHtml(),
|
22 |
+
|
23 |
+
));
|
24 |
+
$this->addTab('form_pages', array(
|
25 |
+
'label' => Mage::helper('vstudio_venu')->__('Add Page Menu Link'),
|
26 |
+
'title' => Mage::helper('vstudio_venu')->__('Add Page Menu Link'),
|
27 |
+
'content' => $this->getLayout()->createBlock('vstudio_venu/adminhtml_menumanager_edit_tab_pages')->toHtml(),
|
28 |
+
|
29 |
+
));
|
30 |
+
$this->addTab('categories', array(
|
31 |
+
'label' => Mage::helper('catalog')->__('Add Category Menu Link'),
|
32 |
+
'url' => $this->getUrl('*/*/categories', array('_current' => true)),
|
33 |
+
'class' => 'ajax',
|
34 |
+
));
|
35 |
+
return parent::_beforeToHtml();
|
36 |
+
}
|
37 |
+
}
|
app/code/community/Vstudio/Venu/Block/Adminhtml/Menumanager/Grid.php
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Leandro Villagran
|
4 |
+
* @category Vstudio
|
5 |
+
* @package Vstudio_Venu
|
6 |
+
* @copyright Copyright (c) 2010-2011 Leandro Villagran. (http://www.leandrovillagran.com)
|
7 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
8 |
+
*/
|
9 |
+
class Vstudio_Venu_Block_Adminhtml_MenuManager_Grid extends Mage_Adminhtml_Block_Widget_Grid {
|
10 |
+
|
11 |
+
public function __construct() {
|
12 |
+
parent::__construct();
|
13 |
+
$this -> setId('manageMenuGrid');
|
14 |
+
$this -> setUseAjax(true);
|
15 |
+
$this -> setDefaultSort('menu_id');
|
16 |
+
$this -> setDefaultDir('ASC');
|
17 |
+
$this -> setSaveParametersInSession(true);
|
18 |
+
}
|
19 |
+
|
20 |
+
protected function _prepareCollection() {
|
21 |
+
// lets get all our menus
|
22 |
+
$collection = Mage::getModel('vstudio_venu/venu') -> getCollection();
|
23 |
+
// lets set the collection for a our grid
|
24 |
+
$this -> setCollection($collection);
|
25 |
+
return parent::_prepareCollection();
|
26 |
+
}
|
27 |
+
|
28 |
+
protected function _prepareColumns() {
|
29 |
+
$options = Mage::getSingleton('vstudio_venu/options');
|
30 |
+
|
31 |
+
$this -> addColumn('menu_id', array(
|
32 |
+
'header' => Mage::helper('vstudio_venu') -> __('ID'),
|
33 |
+
'align' => 'right',
|
34 |
+
'width' => '50px',
|
35 |
+
'index' => 'menu_id',
|
36 |
+
));
|
37 |
+
|
38 |
+
$this -> addColumn('menu_title', array(
|
39 |
+
'header' => Mage::helper('vstudio_venu') -> __('Title'),
|
40 |
+
'align' => 'left',
|
41 |
+
'index' => 'menu_title',
|
42 |
+
));
|
43 |
+
|
44 |
+
$this -> addColumn('menu_status', array(
|
45 |
+
'header' => Mage::helper('vstudio_venu') -> __('Status'),
|
46 |
+
'align' => 'left',
|
47 |
+
'width' => '80px',
|
48 |
+
'index' => 'menu_status',
|
49 |
+
'type' => 'options',
|
50 |
+
'options' => $options -> getOptionStatus(),
|
51 |
+
));
|
52 |
+
|
53 |
+
$this -> addColumn('action', array(
|
54 |
+
'header' => Mage::helper('vstudio_venu') -> __('Action'),
|
55 |
+
'width' => '100',
|
56 |
+
'type' => 'action',
|
57 |
+
'getter' => 'getId',
|
58 |
+
'actions' => array( array(
|
59 |
+
'caption' => Mage::helper('vstudio_venu') -> __('Edit'),
|
60 |
+
'url' => array('base' => '*/*/edit'),
|
61 |
+
'field' => 'id'
|
62 |
+
)),
|
63 |
+
'filter' => false,
|
64 |
+
'sortable' => false,
|
65 |
+
'index' => 'stores',
|
66 |
+
'is_system' => true,
|
67 |
+
));
|
68 |
+
return parent::_prepareColumns();
|
69 |
+
}
|
70 |
+
|
71 |
+
protected function _prepareMassaction() {
|
72 |
+
$this -> setMassactionIdField('menu_id');
|
73 |
+
$this -> getMassactionBlock() -> setFormFieldName('menu_delete');
|
74 |
+
$this -> getMassactionBlock() -> addItem('delete', array(
|
75 |
+
'label' => Mage::helper('vstudio_venu') -> __('Delete'),
|
76 |
+
'url' => $this -> getUrl('*/*/massDelete'),
|
77 |
+
'confirm' => Mage::helper('vstudio_venu') -> __('Are you sure?')
|
78 |
+
));
|
79 |
+
return $this;
|
80 |
+
}
|
81 |
+
|
82 |
+
public function getRowUrl($row) {
|
83 |
+
// This is where our row data will link to
|
84 |
+
return $this -> getUrl('*/*/edit', array('id' => $row -> getId()));
|
85 |
+
}
|
86 |
+
|
87 |
+
}
|
app/code/community/Vstudio/Venu/Block/Menu.php
ADDED
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Vstudio_Venu_Block_Menu extends Mage_Core_Block_Template
|
4 |
+
{
|
5 |
+
|
6 |
+
public static $count = 0;
|
7 |
+
|
8 |
+
public function _prepareLayout()
|
9 |
+
{
|
10 |
+
return parent::_prepareLayout();
|
11 |
+
}
|
12 |
+
|
13 |
+
public function getMenu($name = null)
|
14 |
+
{
|
15 |
+
$storeId = Mage::app()->getStore()->getId();
|
16 |
+
if ($name) {
|
17 |
+
$menu = Mage::getModel('vstudio_venu/venu')
|
18 |
+
->getCollection()
|
19 |
+
->addFieldToFilter('menu_title', $name)
|
20 |
+
->addFieldToFilter('menu_status', 1);
|
21 |
+
$id = $menu->getColumnValues('menu_id');
|
22 |
+
if (empty($id)) {
|
23 |
+
return array();
|
24 |
+
}
|
25 |
+
|
26 |
+
$collection = Mage::getModel('vstudio_venu/menuitem')
|
27 |
+
->getCollection()
|
28 |
+
->addFieldToFilter('menu_id', $id)
|
29 |
+
->addFieldToFilter('item_status', 1)->setOrder('sort_order', 'ASC');
|
30 |
+
} else {
|
31 |
+
$menus = Mage::getModel('vstudio_venu/venu')
|
32 |
+
->getCollection()
|
33 |
+
->addFieldToFilter('menu_status', 1);
|
34 |
+
$menuItems = array();
|
35 |
+
|
36 |
+
foreach ($menus as $menu) {
|
37 |
+
$menuItems[] = Mage::getModel('vstudio_venu/menuitem')
|
38 |
+
->getCollection()
|
39 |
+
->addFieldToFilter('menu_id', $menu->getId())
|
40 |
+
->getData();
|
41 |
+
|
42 |
+
}
|
43 |
+
|
44 |
+
}
|
45 |
+
|
46 |
+
return $collection->getData();
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
*
|
51 |
+
* @name name of the menu
|
52 |
+
* @return returns an associative array of options
|
53 |
+
*/
|
54 |
+
public function getMenuOptions($name)
|
55 |
+
{
|
56 |
+
|
57 |
+
$menu = Mage::getModel('vstudio_venu/venu')
|
58 |
+
->getCollection()
|
59 |
+
->addFieldToFilter('menu_title', $name)
|
60 |
+
->addFieldToFilter('menu_status', 1);
|
61 |
+
$options = $menu->getColumnValues('menu_options');
|
62 |
+
|
63 |
+
if (!empty($options)) {
|
64 |
+
$options = json_decode(array_shift($options), true);
|
65 |
+
}
|
66 |
+
|
67 |
+
return $options;
|
68 |
+
}
|
69 |
+
|
70 |
+
|
71 |
+
public function display_menu($items = array(), $parent = 0, $isChild = false, $options = array('menu_orientation' => 'horz'))
|
72 |
+
{
|
73 |
+
if (!empty($items[$parent])) {
|
74 |
+
|
75 |
+
if (!empty($options)){
|
76 |
+
extract($options);
|
77 |
+
}
|
78 |
+
|
79 |
+
$containerTag = '';
|
80 |
+
$containerEndTag = '';
|
81 |
+
$menu_orientation = (!empty($menu_orientation)) ? $menu_orientation : '';
|
82 |
+
$menuId = (!empty($menu_css_id)) ? "id='{$menu_css_id}'" : '';
|
83 |
+
$menuClass = (!empty($menu_css_class)) ? $menu_css_class : '';
|
84 |
+
$containerId = (!empty($container_id)) ? "id='{$container_id}'" : '';
|
85 |
+
$containerClass = (!empty($container_class)) ? $container_class : '';
|
86 |
+
$menu_container = (!empty($menu_container)) ? $menu_container : '';
|
87 |
+
$title = (!empty($title)) ? $title : '';
|
88 |
+
|
89 |
+
switch ($menu_container) {
|
90 |
+
case 'nav':
|
91 |
+
$containerTag = '<nav ' . $containerId . ' class=" venu-container ' . $containerClass . '">';
|
92 |
+
$containerEndTag = '</nav>';
|
93 |
+
break;
|
94 |
+
case 'div':
|
95 |
+
$containerTag = '<div ' . $containerId . ' class=" venu-container ' . $containerClass . '">';
|
96 |
+
$containerEndTag = '</div>';
|
97 |
+
break;
|
98 |
+
case 'none':
|
99 |
+
$containerTag = '';
|
100 |
+
$containerEndTag = '';
|
101 |
+
break;
|
102 |
+
|
103 |
+
default:
|
104 |
+
|
105 |
+
break;
|
106 |
+
}
|
107 |
+
|
108 |
+
$i = 0;
|
109 |
+
echo ($isChild) ? '<ul class="venu-menu-sub">' : '' . $containerTag . '<ul ' . $menuId . 'class="venu-menu '.$title.' venu-menu-' . $menu_orientation . ' ' . $menuClass . '">';
|
110 |
+
foreach ($items[$parent] as $item) {
|
111 |
+
switch ($i++) {
|
112 |
+
case 0:
|
113 |
+
$class = ' first';
|
114 |
+
break;
|
115 |
+
case (count($items[$parent]) - 1) :
|
116 |
+
$class = ' last';
|
117 |
+
break;
|
118 |
+
default:
|
119 |
+
$class = '';
|
120 |
+
break;
|
121 |
+
}
|
122 |
+
echo "<li class='venu-item {$class}'>";
|
123 |
+
echo '<a href="' . urldecode($item['item_link']) . '">';
|
124 |
+
echo $item['item_label'];
|
125 |
+
echo "</a>";
|
126 |
+
$this->display_menu($items, $item['id'], true, $options);
|
127 |
+
echo "</li>";
|
128 |
+
}
|
129 |
+
echo ($isChild) ? "</ul>" : "</ul>$containerEndTag";
|
130 |
+
}
|
131 |
+
}
|
132 |
+
|
133 |
+
}
|
app/code/community/Vstudio/Venu/Helper/Data.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Vstudio_Venu_Helper_Data extends Mage_Core_Helper_Data {
|
3 |
+
|
4 |
+
}
|
app/code/community/Vstudio/Venu/Model/MenuItem.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Vstudio_Venu_Model_MenuItem extends Mage_Core_Model_Abstract {
|
3 |
+
protected $_eventPrefix = 'vstudio_venu_menuitem';
|
4 |
+
protected $_eventObject = 'venu';
|
5 |
+
protected $_categoryInstance = null;
|
6 |
+
|
7 |
+
protected function _construct() {
|
8 |
+
$this -> _init('vstudio_venu/menuitem');
|
9 |
+
}
|
10 |
+
|
11 |
+
|
12 |
+
}
|
app/code/community/Vstudio/Venu/Model/Options.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Vstudio_Venu_Model_Options
|
4 |
+
extends Mage_Core_Model_Abstract {
|
5 |
+
|
6 |
+
const STATUS_ENABLED = 1;
|
7 |
+
const STATUS_DISABLED = 0;
|
8 |
+
const HORZ_ORIENTATION = 'horz';
|
9 |
+
const VERT_ORIENTATION = 'vert';
|
10 |
+
|
11 |
+
public function getOptionStatus() {
|
12 |
+
return array(
|
13 |
+
self::STATUS_ENABLED => Mage::helper('vstudio_venu') -> __('Active'),
|
14 |
+
self::STATUS_DISABLED => Mage::helper('vstudio_venu') -> __('Non Active')
|
15 |
+
);
|
16 |
+
}
|
17 |
+
|
18 |
+
public function getOptionOrientation() {
|
19 |
+
return array(
|
20 |
+
self::HORZ_ORIENTATION => Mage::helper('vstudio_venu') -> __('Horizontal'),
|
21 |
+
self::VERT_ORIENTATION => Mage::helper('vstudio_venu') -> __('Vertical')
|
22 |
+
);
|
23 |
+
}
|
24 |
+
|
25 |
+
public function getOptionPages() {
|
26 |
+
$_collection = Mage::getSingleton('cms/page') -> getCollection() -> addFieldToFilter('is_active', 1);
|
27 |
+
|
28 |
+
$_result = array( array(
|
29 |
+
'value' => -1,
|
30 |
+
'label' => 'None'
|
31 |
+
));
|
32 |
+
|
33 |
+
foreach ($_collection as $item) {
|
34 |
+
$data = array(
|
35 |
+
'value' => $item -> getData('page_id'),
|
36 |
+
'label' => $item -> getData('title')
|
37 |
+
);
|
38 |
+
|
39 |
+
$_result[] = $data;
|
40 |
+
}
|
41 |
+
return $_result;
|
42 |
+
}
|
43 |
+
|
44 |
+
}
|
app/code/community/Vstudio/Venu/Model/Resource/Menuitem.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Vstudio_Venu_Model_Resource_MenuItem
|
3 |
+
extends Mage_Core_Model_Resource_Db_Abstract {
|
4 |
+
protected function _construct() {
|
5 |
+
$this -> _init('vstudio_venu/menuitem', 'id');
|
6 |
+
}
|
7 |
+
|
8 |
+
}
|
app/code/community/Vstudio/Venu/Model/Resource/Menuitem/Collection.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Vstudio_Venu_Model_Resource_MenuItem_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
|
3 |
+
|
4 |
+
public function _construct() {
|
5 |
+
$this -> _init('vstudio_venu/menuitem');
|
6 |
+
}
|
7 |
+
|
8 |
+
}
|
app/code/community/Vstudio/Venu/Model/Resource/Venu.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Vstudio_Venu_Model_Resource_Venu
|
3 |
+
extends Mage_Core_Model_Resource_Db_Abstract {
|
4 |
+
protected function _construct() {
|
5 |
+
$this -> _init('vstudio_venu/venu', 'menu_id');
|
6 |
+
}
|
7 |
+
|
8 |
+
}
|
app/code/community/Vstudio/Venu/Model/Resource/Venu/Collection.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Vstudio_Venu_Model_Resource_Venu_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
|
3 |
+
|
4 |
+
public function _construct() {
|
5 |
+
$this -> _init('vstudio_venu/venu');
|
6 |
+
}
|
7 |
+
|
8 |
+
}
|
app/code/community/Vstudio/Venu/Model/Venu.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Vstudio_Venu_Model_Venu extends Mage_Core_Model_Abstract {
|
3 |
+
protected $_eventPrefix = 'vstudio_venu_menu';
|
4 |
+
protected $_eventObject = 'venu';
|
5 |
+
protected $_categoryInstance = null;
|
6 |
+
|
7 |
+
protected function _construct() {
|
8 |
+
$this -> _init('vstudio_venu/venu');
|
9 |
+
}
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Retrieve assigned category Ids
|
13 |
+
*
|
14 |
+
* @return array
|
15 |
+
*/
|
16 |
+
public function getCategoryIds() {
|
17 |
+
|
18 |
+
return array();
|
19 |
+
}
|
20 |
+
|
21 |
+
}
|
app/code/community/Vstudio/Venu/controllers/Adminhtml/Venu/MenuController.php
ADDED
@@ -0,0 +1,300 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Vstudio_Venu_Adminhtml_Venu_MenuController
|
4 |
+
extends Mage_Adminhtml_Controller_Action
|
5 |
+
{
|
6 |
+
|
7 |
+
protected function _initAction()
|
8 |
+
{
|
9 |
+
$this->loadLayout()->_setActiveMenu('vstudio_venu_menu')
|
10 |
+
->_addBreadcrumb(Mage::helper('adminhtml')->__('Menu Manager'), Mage::helper('adminhtml')->__('Menu Manager'));
|
11 |
+
return $this;
|
12 |
+
}
|
13 |
+
|
14 |
+
public function indexAction()
|
15 |
+
{
|
16 |
+
$this->_initAction()->renderLayout();
|
17 |
+
return $this;
|
18 |
+
}
|
19 |
+
|
20 |
+
public function editAction()
|
21 |
+
{
|
22 |
+
// lets get the id of the menu
|
23 |
+
$id = $this->getRequest()->getParam('id');
|
24 |
+
// lets load our menu from the database
|
25 |
+
$model = Mage::getModel('vstudio_venu/venu')->load($id);
|
26 |
+
|
27 |
+
if ($model->getId() || $id == 0) {
|
28 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
29 |
+
if (!empty($data)) {
|
30 |
+
$model->setData($data);
|
31 |
+
}
|
32 |
+
|
33 |
+
$menuItems = Mage::getModel('vstudio_venu/menuitem')->getCollection()->addFieldToFilter('menu_id', $model->getId());
|
34 |
+
$items = array();
|
35 |
+
|
36 |
+
if (!empty($menuItems)) {
|
37 |
+
foreach ($menuItems as $item) {
|
38 |
+
$items[] = $item->getData();
|
39 |
+
}
|
40 |
+
}
|
41 |
+
|
42 |
+
$model->setData('menu_items', $items);
|
43 |
+
Mage::register('venu_data', $model);
|
44 |
+
|
45 |
+
$this->loadLayout();
|
46 |
+
// set our menu from adminhtml.xml
|
47 |
+
$this->_setActiveMenu('vstudio_venu_menu');
|
48 |
+
|
49 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Menu Manager'), Mage::helper('adminhtml')->__('Menu Manager'));
|
50 |
+
|
51 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Menu News'), Mage::helper('adminhtml')->__('Menu News'));
|
52 |
+
|
53 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
54 |
+
|
55 |
+
$block = $this->getLayout()->getBlock('catalog.wysiwyg.js');
|
56 |
+
if ($block) {
|
57 |
+
$block->setStoreId($product->getStoreId());
|
58 |
+
}
|
59 |
+
|
60 |
+
$this->_addLeft($this->getLayout()->createBlock('vstudio_venu/adminhtml_menumanager_edit_tabs'));
|
61 |
+
|
62 |
+
$this->renderLayout();
|
63 |
+
} else {
|
64 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('vstudio_venu')->__('Menu does not exist'));
|
65 |
+
$this->_redirect('*/*/');
|
66 |
+
}
|
67 |
+
|
68 |
+
}
|
69 |
+
|
70 |
+
public function saveAction()
|
71 |
+
{
|
72 |
+
if ($data = $this->getRequest()->getPost()) {
|
73 |
+
$model = Mage::getModel('vstudio_venu/venu');
|
74 |
+
|
75 |
+
$menuId = $this->getRequest()->getParam('id');
|
76 |
+
|
77 |
+
if (isset($data['menu_title']) && !empty($data['menu_title'])) {
|
78 |
+
$title = $data['menu_title'];
|
79 |
+
$code = strtolower(implode('_', explode(' ', $title)));
|
80 |
+
$data['menu_options']["title"] = $code;
|
81 |
+
$blockCod = '{{block type="vstudio_venu/menu" block_id="' . $code . '" template="vstudio/venu/menu.phtml" menu_title="' . $title . '"}}';
|
82 |
+
$data['menu_code'] = $blockCod;
|
83 |
+
}
|
84 |
+
if (isset($data['menu_options']) && !empty($data['menu_options'])) {
|
85 |
+
$data['menu_options'] = json_encode($data['menu_options']);
|
86 |
+
}
|
87 |
+
$model->setData($data)->setId($menuId);
|
88 |
+
try {
|
89 |
+
$model->save();
|
90 |
+
// create menu item
|
91 |
+
$this->createMenuItem($model->getId());
|
92 |
+
|
93 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('vstudio_venu')->__('Menu was successfully saved'));
|
94 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
95 |
+
|
96 |
+
if ($this->getRequest()->getParam('back')) {
|
97 |
+
$this->_redirect('*/*/edit', array('id' => $model->getId()));
|
98 |
+
return;
|
99 |
+
}
|
100 |
+
|
101 |
+
$this->_redirect('*/*/');
|
102 |
+
return;
|
103 |
+
} catch (Exception $e) {
|
104 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
105 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
106 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
107 |
+
return;
|
108 |
+
}
|
109 |
+
}
|
110 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('vstudio_venu')->__('Unable to find item to save'));
|
111 |
+
$this->_redirect('*/*/');
|
112 |
+
}
|
113 |
+
|
114 |
+
protected function createMenuItem($menu_id)
|
115 |
+
{
|
116 |
+
|
117 |
+
if ($selectedPages = $this->getRequest()->getPost('pages')) {
|
118 |
+
$_cmsPages = Mage::getSingleton('cms/page')
|
119 |
+
->getCollection()
|
120 |
+
->addFieldToFilter('is_active', 1)
|
121 |
+
->addFieldToFilter('page_id', array('in' => $selectedPages));
|
122 |
+
|
123 |
+
if (!empty($_cmsPages)) {
|
124 |
+
foreach ($_cmsPages as $page) {
|
125 |
+
$url = Mage::helper('cms/page')->getPageUrl($page->getId());
|
126 |
+
$menuItem = Mage::getModel('vstudio_venu/menuitem');
|
127 |
+
$menuItem->setItemLabel($page->getTitle());
|
128 |
+
$menuItem->setItemLink(urlencode($url));
|
129 |
+
$menuItem->setMenuId($menu_id);
|
130 |
+
try {
|
131 |
+
$menuItem->save();
|
132 |
+
} catch (Exception $e) {
|
133 |
+
Mage::log("Problem saving page menu item " . $e->getMessage());
|
134 |
+
}
|
135 |
+
|
136 |
+
}
|
137 |
+
}
|
138 |
+
|
139 |
+
}
|
140 |
+
|
141 |
+
if ($customItems = $this->getRequest()->getPost('custom')) {
|
142 |
+
|
143 |
+
if (!empty($customItems)) {
|
144 |
+
foreach ($customItems as $item) {
|
145 |
+
if (empty($item['title']) || empty($item['link']))
|
146 |
+
continue;
|
147 |
+
|
148 |
+
$menuItem = Mage::getModel('vstudio_venu/menuitem');
|
149 |
+
$menuItem->setItemLabel($item['title']);
|
150 |
+
$menuItem->setItemLink(urlencode($item['link']));
|
151 |
+
$menuItem->setMenuId($menu_id);
|
152 |
+
try {
|
153 |
+
$menuItem->save();
|
154 |
+
} catch (Exception $e) {
|
155 |
+
Mage::log("Problem saving custom menu item " . $e->getMessage());
|
156 |
+
}
|
157 |
+
}
|
158 |
+
}
|
159 |
+
}
|
160 |
+
|
161 |
+
if ($items = $this->getRequest()->getPost('item')) {
|
162 |
+
if (!empty($items)) {
|
163 |
+
foreach ($items as $item) {
|
164 |
+
$item['item_link'] = urlencode($item['item_link']);
|
165 |
+
$menuItem = Mage::getModel('vstudio_venu/menuitem')->setData($item)->setId($item['id']);
|
166 |
+
|
167 |
+
if (isset($item['delete'])) {
|
168 |
+
$menuItem->delete();
|
169 |
+
} else {
|
170 |
+
try {
|
171 |
+
$menuItem->save();
|
172 |
+
} catch (Exception $e) {
|
173 |
+
Mage::log("error saving menu item " . $e->getMessage());
|
174 |
+
}
|
175 |
+
}
|
176 |
+
|
177 |
+
}
|
178 |
+
}
|
179 |
+
}
|
180 |
+
|
181 |
+
if ($categoryIds = $this->getRequest()->getPost('categories')) {
|
182 |
+
if (!empty($categoryIds)) {
|
183 |
+
$categoryIds = explode(',', $categoryIds);
|
184 |
+
if (is_array($categoryIds)) {
|
185 |
+
$categoryIds = array_unique($categoryIds);
|
186 |
+
} else {
|
187 |
+
throw new Exception("Error trying to save category item : categories must be an array", 1);
|
188 |
+
}
|
189 |
+
foreach ($categoryIds as $id) {
|
190 |
+
if (empty($id))
|
191 |
+
continue;
|
192 |
+
$_category = Mage::getModel('catalog/category')->load($id);
|
193 |
+
$menuItem = Mage::getModel('vstudio_venu/menuitem');
|
194 |
+
$menuItem->setItemLabel($_category->getName());
|
195 |
+
$menuItem->setItemLink(urlencode($_category->getUrl()));
|
196 |
+
$menuItem->setMenuId($menu_id);
|
197 |
+
try {
|
198 |
+
$menuItem->save();
|
199 |
+
} catch (Exception $ex) {
|
200 |
+
Mage::log("error saving category menu item " . $ex->getMessage());
|
201 |
+
}
|
202 |
+
}
|
203 |
+
}
|
204 |
+
}
|
205 |
+
|
206 |
+
return;
|
207 |
+
}
|
208 |
+
|
209 |
+
public function newAction()
|
210 |
+
{
|
211 |
+
$this->_forward('edit');
|
212 |
+
}
|
213 |
+
|
214 |
+
public function massDeleteAction()
|
215 |
+
{
|
216 |
+
$menuIds = $this->getRequest()->getParam('menu_delete');
|
217 |
+
if (!is_array($menuIds)) {
|
218 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('vstudio_venu')->__('Please select one or more menus.'));
|
219 |
+
} else {
|
220 |
+
try {
|
221 |
+
|
222 |
+
$menu = Mage::getModel('vstudio_venu/venu');
|
223 |
+
|
224 |
+
foreach ($menuIds as $menuId) {
|
225 |
+
$menu->load($menuId)->delete();
|
226 |
+
// get tables associated with this menu
|
227 |
+
$menuItems = Mage::getModel('vstudio_venu/menuitem')->getCollection()->addFilter('menu_id', $menuId);
|
228 |
+
|
229 |
+
if (!empty($menuItems)) {
|
230 |
+
foreach ($menuItems as $item) {
|
231 |
+
$item->delete();
|
232 |
+
}
|
233 |
+
}
|
234 |
+
}
|
235 |
+
|
236 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Total of %d record(s) were deleted.', count($menuIds)));
|
237 |
+
} catch (Exception $e) {
|
238 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
239 |
+
}
|
240 |
+
}
|
241 |
+
$this->_redirect('*/*/index');
|
242 |
+
}
|
243 |
+
|
244 |
+
public function deleteAction()
|
245 |
+
{
|
246 |
+
if ($menuId = $this->getRequest()->getParam('id')) {
|
247 |
+
try {
|
248 |
+
$menu = Mage::getModel('vstudio_venu/venu');
|
249 |
+
$menu->load($menuId)->delete();
|
250 |
+
// get tables associated with this menu
|
251 |
+
$menuItems = Mage::getModel('vstudio_venu/menuitem')->getCollection()->addFilter('menu_id', $menuId);
|
252 |
+
|
253 |
+
if (!empty($menuItems)) {
|
254 |
+
foreach ($menuItems as $item) {
|
255 |
+
$item->delete();
|
256 |
+
}
|
257 |
+
}
|
258 |
+
|
259 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Menu was successfully deleted'));
|
260 |
+
$this->_redirect('*/*/');
|
261 |
+
} catch (Exception $e) {
|
262 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
263 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
264 |
+
}
|
265 |
+
}
|
266 |
+
$this->_redirect('*/*/');
|
267 |
+
}
|
268 |
+
|
269 |
+
protected function _initMenu()
|
270 |
+
{
|
271 |
+
$menuId = (int)$this->getRequest()->getParam('id');
|
272 |
+
$menu = Mage::getModel('vstudio_venu/venu');
|
273 |
+
|
274 |
+
if ($menuId) {
|
275 |
+
$menu->load($menuId);
|
276 |
+
}
|
277 |
+
Mage::register('venu_data', $menu);
|
278 |
+
Mage::register('current_menu', $menu);
|
279 |
+
return $menu;
|
280 |
+
}
|
281 |
+
|
282 |
+
public function categoriesAction()
|
283 |
+
{
|
284 |
+
$this->_initMenu();
|
285 |
+
$this->loadLayout();
|
286 |
+
$this->renderLayout();
|
287 |
+
}
|
288 |
+
|
289 |
+
public function categoriesJsonAction()
|
290 |
+
{
|
291 |
+
$this->_initMenu();
|
292 |
+
$this->getResponse()->setBody($this->getLayout()->createBlock('vstudio_venu/adminhtml_menumanager_edit_tab_categories')->getCategoryChildrenJson($this->getRequest()->getParam('category')));
|
293 |
+
}
|
294 |
+
|
295 |
+
protected function _isAllowed()
|
296 |
+
{
|
297 |
+
return Mage::getSingleton('admin/session')->isAllowed('admin/vstudio_venu_menu');
|
298 |
+
}
|
299 |
+
|
300 |
+
}
|
app/code/community/Vstudio/Venu/controllers/VenuController.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Vstudio_Venu_VenuController
|
4 |
+
extends Mage_Core_Controller_Front_Action {
|
5 |
+
|
6 |
+
public function indexAction() {
|
7 |
+
$this -> loadLayout() -> renderLayout();
|
8 |
+
}
|
9 |
+
|
10 |
+
}
|
app/code/community/Vstudio/Venu/data/vstudio_venu_setup/data-install-1.0.0.0.php
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
function createVenuSampleData()
|
3 |
+
{
|
4 |
+
$model = Mage::getModel('vstudio_venu/venu');
|
5 |
+
$homeUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
6 |
+
|
7 |
+
$menu = array(
|
8 |
+
'menu_title' => 'Sample Menu',
|
9 |
+
'menu_options' => json_encode(array('menu_orientation' => 'horz', 'menu_container' => 'nav', 'title' => 'sample_menu')),
|
10 |
+
'menu_status' => 1,
|
11 |
+
'menu_code' => '{{block type="vstudio_venu/menu" block_id="sample_menu" template="vstudio/venu/menu.phtml" menu_title="Sample Menu"}}',
|
12 |
+
);
|
13 |
+
|
14 |
+
$customItems = array(
|
15 |
+
array(
|
16 |
+
'title' => 'Home',
|
17 |
+
'link' => $homeUrl,
|
18 |
+
'position' => 0,
|
19 |
+
),
|
20 |
+
array(
|
21 |
+
'title' => 'Advance Search',
|
22 |
+
'link' => $homeUrl . 'index.php/catalogsearch/advanced/',
|
23 |
+
'position' => 1,
|
24 |
+
),
|
25 |
+
array(
|
26 |
+
'title' => 'Orders and Returns',
|
27 |
+
'link' => $homeUrl . 'index.php/sales/guest/form/',
|
28 |
+
'position' => 2,
|
29 |
+
),
|
30 |
+
array(
|
31 |
+
'title' => 'Search Terms',
|
32 |
+
'link' => $homeUrl . 'index.php/catalogsearch/term/popular/',
|
33 |
+
'position' => 3,
|
34 |
+
),
|
35 |
+
array(
|
36 |
+
'title' => 'Sitemap',
|
37 |
+
'link' => $homeUrl . 'index.php/catalog/seo_sitemap/category/',
|
38 |
+
'position' => 4,
|
39 |
+
),
|
40 |
+
array(
|
41 |
+
'title' => 'Contact Us',
|
42 |
+
'link' => $homeUrl . 'index.php/contacts/',
|
43 |
+
'position' => 5,
|
44 |
+
),
|
45 |
+
|
46 |
+
);
|
47 |
+
|
48 |
+
$menuId = $model->setData($menu)->save();
|
49 |
+
|
50 |
+
if (!empty($customItems)) {
|
51 |
+
foreach ($customItems as $item) {
|
52 |
+
$menuItem = Mage::getModel('vstudio_venu/menuitem');
|
53 |
+
$menuItem->setItemLabel($item['title']);
|
54 |
+
$menuItem->setItemLink(urlencode($item['link']));
|
55 |
+
$menuItem->setSortOrder(urlencode($item['position']));
|
56 |
+
$menuItem->setMenuId($menuId->getId());
|
57 |
+
try {
|
58 |
+
$menuItem->save();
|
59 |
+
} catch (Exception $e) {
|
60 |
+
Mage::log("Problem saving custom menu item " . $e->getMessage());
|
61 |
+
}
|
62 |
+
}
|
63 |
+
}
|
64 |
+
}
|
65 |
+
|
66 |
+
createVenuSampleData();
|
app/code/community/Vstudio/Venu/etc/adminhtml.xml
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<menu>
|
4 |
+
<vstudio_venu_menu module="vstudio_venu" translate="title">
|
5 |
+
<title>Menus</title>
|
6 |
+
<sort_order>80</sort_order>
|
7 |
+
<children>
|
8 |
+
<manage module="vstudio_venu" translate="title">
|
9 |
+
<title>Manage Menus</title>
|
10 |
+
<sort_order>1</sort_order>
|
11 |
+
<action>adminhtml/venu_menu/</action>
|
12 |
+
</manage>
|
13 |
+
</children>
|
14 |
+
</vstudio_venu_menu>
|
15 |
+
</menu>
|
16 |
+
<acl>
|
17 |
+
<resources>
|
18 |
+
<all>
|
19 |
+
<title>Allow Everything</title>
|
20 |
+
</all>
|
21 |
+
<admin>
|
22 |
+
<children>
|
23 |
+
<vstudio_venu_menu translate="title" module="vstudio_venu">
|
24 |
+
<title>Venu Menus</title>
|
25 |
+
<sort_order>80</sort_order>
|
26 |
+
<children>
|
27 |
+
<manage translate="title">
|
28 |
+
<title>Manage Menus</title>
|
29 |
+
<sort_order>1</sort_order>
|
30 |
+
</manage>
|
31 |
+
</children>
|
32 |
+
</vstudio_venu_menu>
|
33 |
+
<system>
|
34 |
+
<children>
|
35 |
+
<config>
|
36 |
+
<children>
|
37 |
+
<vstudio_venu_config module="vstudio_venu">
|
38 |
+
<title>Venu Menu</title>
|
39 |
+
</vstudio_venu_config>
|
40 |
+
</children>
|
41 |
+
</config>
|
42 |
+
</children>
|
43 |
+
</system>
|
44 |
+
</children>
|
45 |
+
</admin>
|
46 |
+
</resources>
|
47 |
+
</acl>
|
48 |
+
</config>
|
app/code/community/Vstudio/Venu/etc/config.xml
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Vstudio_Venu>
|
5 |
+
<version>1.0.0.0</version>
|
6 |
+
</Vstudio_Venu>
|
7 |
+
</modules>
|
8 |
+
<adminhtml>
|
9 |
+
<layout>
|
10 |
+
<updates>
|
11 |
+
<venu module="vstudio_venu">
|
12 |
+
<file>venu.xml</file>
|
13 |
+
</venu>
|
14 |
+
</updates>
|
15 |
+
</layout>
|
16 |
+
</adminhtml>
|
17 |
+
<admin>
|
18 |
+
<routers>
|
19 |
+
<adminhtml>
|
20 |
+
<args>
|
21 |
+
<modules>
|
22 |
+
<Vstudio_Venu after="Mage_Adminhtml">Vstudio_Venu_Adminhtml</Vstudio_Venu>
|
23 |
+
</modules>
|
24 |
+
</args>
|
25 |
+
</adminhtml>
|
26 |
+
</routers>
|
27 |
+
</admin>
|
28 |
+
<frontend>
|
29 |
+
<routers>
|
30 |
+
<vstudio_venu>
|
31 |
+
<use>standard</use>
|
32 |
+
<args>
|
33 |
+
<module>Vstudio_Venu</module>
|
34 |
+
<frontName>venu</frontName>
|
35 |
+
</args>
|
36 |
+
</vstudio_venu>
|
37 |
+
</routers>
|
38 |
+
<!-- this will add layout file at app > design > frontend > default > layout -->
|
39 |
+
<layout>
|
40 |
+
<updates>
|
41 |
+
<venu module="vstudio_venu">
|
42 |
+
<file>venu.xml</file>
|
43 |
+
</venu>
|
44 |
+
</updates>
|
45 |
+
</layout>
|
46 |
+
</frontend>
|
47 |
+
<global>
|
48 |
+
<!-- … create a block elements ... -->
|
49 |
+
<blocks>
|
50 |
+
<vstudio_venu>
|
51 |
+
<class>Vstudio_Venu_Block</class>
|
52 |
+
</vstudio_venu>
|
53 |
+
</blocks>
|
54 |
+
<models>
|
55 |
+
<vstudio_venu>
|
56 |
+
<!-- root name -->
|
57 |
+
<class>Vstudio_Venu_Model</class>
|
58 |
+
<resourceModel>vstudio_venu_resource</resourceModel>
|
59 |
+
</vstudio_venu>
|
60 |
+
<vstudio_venu_resource>
|
61 |
+
<class>Vstudio_Venu_Model_Resource</class>
|
62 |
+
<entities>
|
63 |
+
<venu>
|
64 |
+
<table>vstudio_venu_menu</table>
|
65 |
+
</venu>
|
66 |
+
<menuitem>
|
67 |
+
<table>vstudio_venu_menuitem</table>
|
68 |
+
</menuitem>
|
69 |
+
</entities>
|
70 |
+
</vstudio_venu_resource>
|
71 |
+
</models>
|
72 |
+
<resources>
|
73 |
+
<vstudio_venu_setup>
|
74 |
+
<setup>
|
75 |
+
<module>Vstudio_Venu</module>
|
76 |
+
<model>Vstudio_Venu</model>
|
77 |
+
</setup>
|
78 |
+
</vstudio_venu_setup>
|
79 |
+
</resources>
|
80 |
+
<!-- … other elements ... -->
|
81 |
+
<helpers>
|
82 |
+
<vstudio_venu>
|
83 |
+
<class>Vstudio_Venu_Helper</class>
|
84 |
+
</vstudio_venu>
|
85 |
+
</helpers>
|
86 |
+
</global>
|
87 |
+
</config>
|
app/code/community/Vstudio/Venu/etc/system.xml
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<venu_config module="vstudio_venu">
|
5 |
+
<label>Menu Settings</label>
|
6 |
+
<sort_order>120</sort_order>
|
7 |
+
</venu_config>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<vstudio_venu_config module="vstudio_venu">
|
11 |
+
<label>Menu Settings</label>
|
12 |
+
<tab>venu_config</tab>
|
13 |
+
<sort_order>10</sort_order>
|
14 |
+
<show_in_default>1</show_in_default>
|
15 |
+
<groups>
|
16 |
+
<general translate="label">
|
17 |
+
<label>General Configuration</label>
|
18 |
+
<sort_order>50</sort_order>
|
19 |
+
<show_in_default>1</show_in_default>
|
20 |
+
<show_in_website>1</show_in_website>
|
21 |
+
<show_in_store>1</show_in_store>
|
22 |
+
<fields>
|
23 |
+
<enable_container translate="label">
|
24 |
+
<label>Use container</label>
|
25 |
+
<frontend_type>select</frontend_type>
|
26 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
27 |
+
<sort_order>1</sort_order>
|
28 |
+
<show_in_default>1</show_in_default>
|
29 |
+
<show_in_website>1</show_in_website>
|
30 |
+
<show_in_store>1</show_in_store>
|
31 |
+
<comment>Whether to wrap the ul</comment>
|
32 |
+
</enable_container>
|
33 |
+
<container_element translate="label">
|
34 |
+
<label>Container element</label>
|
35 |
+
<frontend_type>text</frontend_type>
|
36 |
+
<sort_order>2</sort_order>
|
37 |
+
<show_in_default>1</show_in_default>
|
38 |
+
<show_in_website>1</show_in_website>
|
39 |
+
<show_in_store>1</show_in_store>
|
40 |
+
<comment>You can use div and nav tags</comment>
|
41 |
+
</container_element>
|
42 |
+
</fields>
|
43 |
+
</general>
|
44 |
+
</groups>
|
45 |
+
</vstudio_venu_config>
|
46 |
+
</sections>
|
47 |
+
</config>
|
app/code/community/Vstudio/Venu/sql/vstudio_venu_setup/install-1.0.0.0.php
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$menuTable = $installer->getConnection()
|
6 |
+
->newTable($installer->getTable('vstudio_venu/venu'))
|
7 |
+
->addColumn('menu_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null,
|
8 |
+
array(
|
9 |
+
'identity' => true,
|
10 |
+
'unsigned' => true,
|
11 |
+
'nullable' => false,
|
12 |
+
'primary' => true,), 'Menu Id')
|
13 |
+
->addColumn('menu_title', Varien_Db_Ddl_Table::TYPE_VARCHAR, 30,
|
14 |
+
array(
|
15 |
+
'nullable' => false,
|
16 |
+
), 'Menu Title')
|
17 |
+
->addColumn('menu_position', Varien_Db_Ddl_Table::TYPE_TINYINT, 4,
|
18 |
+
array(
|
19 |
+
'nullable' => false,
|
20 |
+
), 'menu_position')
|
21 |
+
->addColumn('menu_status', Varien_Db_Ddl_Table::TYPE_SMALLINT, 6,
|
22 |
+
array(
|
23 |
+
'nullable' => false,
|
24 |
+
'default' => 1,
|
25 |
+
), 'Menu Status')
|
26 |
+
->setComment('Vstudio_Venu Menu Entity')
|
27 |
+
->addColumn('menu_code', Varien_Db_Ddl_Table::TYPE_LONGVARCHAR, 500,
|
28 |
+
array(
|
29 |
+
'nullable' => false,
|
30 |
+
), 'Menu Code')
|
31 |
+
->addColumn('menu_options', Varien_Db_Ddl_Table::TYPE_LONGVARCHAR, 500,
|
32 |
+
array(
|
33 |
+
'nullable' => false,
|
34 |
+
), 'Menu Options');
|
35 |
+
|
36 |
+
|
37 |
+
$itemTable = $installer->getConnection()
|
38 |
+
->newTable($installer->getTable('vstudio_venu/menuitem'))/* name on the config.xml entity tag*/
|
39 |
+
->addColumn('id', Varien_Db_Ddl_Table::TYPE_SMALLINT, 8,
|
40 |
+
array(
|
41 |
+
'identity' => true,
|
42 |
+
'unsigned' => true,
|
43 |
+
'nullable' => false,
|
44 |
+
'primary' => true,), 'Id')
|
45 |
+
->addColumn('item_label', Varien_Db_Ddl_Table::TYPE_VARCHAR, 30,
|
46 |
+
array(
|
47 |
+
'nullable' => false,
|
48 |
+
), 'Item Label')
|
49 |
+
->addColumn('item_link', Varien_Db_Ddl_Table::TYPE_VARCHAR, 500,
|
50 |
+
array(
|
51 |
+
'nullable' => false,
|
52 |
+
), 'Item Link')
|
53 |
+
->addColumn('item_attributes', Varien_Db_Ddl_Table::TYPE_LONGVARCHAR, 25000,
|
54 |
+
array(
|
55 |
+
'nullable' => false,), 'Attributes')
|
56 |
+
->addColumn('parent_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 11,
|
57 |
+
array(
|
58 |
+
'unsigned' => true,
|
59 |
+
'nullable' => false,
|
60 |
+
'default' => 0,
|
61 |
+
), 'Parent')
|
62 |
+
->addColumn('sort_order', Varien_Db_Ddl_Table::TYPE_INTEGER, 11,
|
63 |
+
array(
|
64 |
+
'unsigned' => true,
|
65 |
+
'nullable' => false,
|
66 |
+
'default' => 0,
|
67 |
+
), 'Sort Order')
|
68 |
+
->addColumn('item_status', Varien_Db_Ddl_Table::TYPE_TINYINT, 3,
|
69 |
+
array(
|
70 |
+
'unsigned' => true,
|
71 |
+
'nullable' => false,
|
72 |
+
'default' => 1,
|
73 |
+
), 'Item Status')
|
74 |
+
->addColumn('menu_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, 6,
|
75 |
+
array(
|
76 |
+
'unsigned' => true,
|
77 |
+
'nullable' => false,
|
78 |
+
'primary' => true,), 'Menu Id');
|
79 |
+
|
80 |
+
$installer->getConnection()->createTable($menuTable);
|
81 |
+
$installer->getConnection()->createTable($itemTable);
|
82 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/venu.xml
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Villagran Studio
|
5 |
+
* @category Vstudio
|
6 |
+
* @package Vstudio_Venu
|
7 |
+
* @copyright Copyright (c) 2010-2011 villagran Studio. (http://www.villagranstudio.com)
|
8 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
9 |
+
*/
|
10 |
+
-->
|
11 |
+
<layout version="1.0.0">
|
12 |
+
<adminhtml_venu_menu_index>
|
13 |
+
<reference name="content">
|
14 |
+
<block type="vstudio_venu/adminhtml_menumanager" name="manage.menu.grid" />
|
15 |
+
</reference>
|
16 |
+
</adminhtml_venu_menu_index>
|
17 |
+
<adminhtml_venu_menu_edit>
|
18 |
+
<reference name="content">
|
19 |
+
<block type="vstudio_venu/adminhtml_menumanager_edit" name="manage.menu.edit.grid" />
|
20 |
+
</reference>
|
21 |
+
</adminhtml_venu_menu_edit>
|
22 |
+
<adminhtml_venu_menu_categories>
|
23 |
+
<block type="core/text_list" name="root" output="toHtml">
|
24 |
+
<block type="vstudio_venu/adminhtml_menumanager_edit_tab_categories" name="manage.menu.edit.tab.categories"/>
|
25 |
+
</block>
|
26 |
+
</adminhtml_venu_menu_categories>
|
27 |
+
</layout>
|
28 |
+
|
app/design/adminhtml/default/default/template/vstudio/venu/edit/tab/category.phtml
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="entry-edit">
|
2 |
+
<div class="entry-edit-head">
|
3 |
+
<h4 class="icon-head head-edit-form fieldset-legend">
|
4 |
+
<?php echo Mage::helper('vstudio_venu')->__('Categories') ?>
|
5 |
+
|
6 |
+
</h4>
|
7 |
+
</div>
|
8 |
+
<fieldset id="grop_fields">
|
9 |
+
<input type="hidden" name="categories" id="venu_categories" value="<?php echo $this->getIdsString() ?>">
|
10 |
+
<div id="venu-categories" class="tree"></div>
|
11 |
+
</fieldset>
|
12 |
+
</div>
|
13 |
+
<?php if($this->getRootNode() && $this->getRootNode()->hasChildren()): ?>
|
14 |
+
<script type="text/javascript">
|
15 |
+
Ext.EventManager.onDocumentReady(function() {
|
16 |
+
var categoryLoader = new Ext.tree.TreeLoader({
|
17 |
+
dataUrl: '<?php echo $this->getLoadTreeUrl()?>'
|
18 |
+
});
|
19 |
+
categoryLoader.createNode = function(config) {
|
20 |
+
config.uiProvider = Ext.tree.CheckboxNodeUI;
|
21 |
+
var node;
|
22 |
+
if (config.children && !config.children.length) {
|
23 |
+
delete(config.children);
|
24 |
+
node = new Ext.tree.AsyncTreeNode(config);
|
25 |
+
}
|
26 |
+
else {
|
27 |
+
node = new Ext.tree.TreeNode(config);
|
28 |
+
}
|
29 |
+
return node;
|
30 |
+
};
|
31 |
+
categoryLoader.on("beforeload", function(treeLoader, node) {
|
32 |
+
treeLoader.baseParams.category = node.attributes.id;
|
33 |
+
});
|
34 |
+
|
35 |
+
categoryLoader.on("load", function(treeLoader, node, config) {
|
36 |
+
varienWindowOnload();
|
37 |
+
});
|
38 |
+
var tree = new Ext.tree.TreePanel('venu-categories', {
|
39 |
+
animate:true,
|
40 |
+
loader: categoryLoader,
|
41 |
+
enableDD:false,
|
42 |
+
containerScroll: true,
|
43 |
+
rootUIProvider: Ext.tree.CheckboxNodeUI,
|
44 |
+
selModel: new Ext.tree.CheckNodeMultiSelectionModel(),
|
45 |
+
rootVisible: '<?php echo $this->getRootNode()->getIsVisible() ?>'
|
46 |
+
});
|
47 |
+
tree.on('check', function(node) {
|
48 |
+
if(node.attributes.checked) {
|
49 |
+
categoryAdd(node.id);
|
50 |
+
} else {
|
51 |
+
categoryRemove(node.id);
|
52 |
+
}
|
53 |
+
varienElementMethods.setHasChanges(node.getUI().checkbox);
|
54 |
+
}, tree);
|
55 |
+
var root = new Ext.tree.TreeNode({
|
56 |
+
text: '<?php echo $this->jsQuoteEscape($this->getRootNode()->getName()) ?>',
|
57 |
+
draggable:false,
|
58 |
+
checked:'<?php echo $this->getRootNode()->getChecked() ?>',
|
59 |
+
id:'<?php echo $this->getRootNode()->getId() ?>',
|
60 |
+
disabled: <?php echo ($this->getRootNode()->getDisabled() ? 'true' : 'false') ?>,
|
61 |
+
uiProvider: Ext.tree.CheckboxNodeUI
|
62 |
+
});
|
63 |
+
tree.setRootNode(root);
|
64 |
+
bildCategoryTree(root, <?php echo $this->getTreeJson() ?>);
|
65 |
+
tree.addListener('click', categoryClick.createDelegate(this));
|
66 |
+
tree.render();
|
67 |
+
root.expand();
|
68 |
+
});
|
69 |
+
function bildCategoryTree(parent, config){
|
70 |
+
if (!config) {
|
71 |
+
return null;
|
72 |
+
}
|
73 |
+
if (parent && config && config.length){
|
74 |
+
for (var i = 0; i < config.length; i++){
|
75 |
+
config[i].uiProvider = Ext.tree.CheckboxNodeUI;
|
76 |
+
var node;
|
77 |
+
var _node = Object.clone(config[i]);
|
78 |
+
if (_node.children && !_node.children.length) {
|
79 |
+
delete(_node.children);
|
80 |
+
node = new Ext.tree.AsyncTreeNode(_node);
|
81 |
+
|
82 |
+
}
|
83 |
+
else {
|
84 |
+
node = new Ext.tree.TreeNode(config[i]);
|
85 |
+
}
|
86 |
+
parent.appendChild(node);
|
87 |
+
node.loader = node.getOwnerTree().loader;
|
88 |
+
if(config[i].children){
|
89 |
+
bildCategoryTree(node, config[i].children);
|
90 |
+
}
|
91 |
+
}
|
92 |
+
}
|
93 |
+
}
|
94 |
+
function categoryClick(node, e){
|
95 |
+
if (node.disabled) {
|
96 |
+
return;
|
97 |
+
}
|
98 |
+
node.getUI().check(!node.getUI().checked());
|
99 |
+
varienElementMethods.setHasChanges(Event.element(e), e);
|
100 |
+
};
|
101 |
+
function categoryAdd(id) {
|
102 |
+
var ids = $('venu_categories').value.split(',');
|
103 |
+
ids.push(id);
|
104 |
+
$('venu_categories').value = ids.join(',');
|
105 |
+
}
|
106 |
+
function categoryRemove(id) {
|
107 |
+
var ids = $('venu_categories').value.split(',');
|
108 |
+
while (-1 != ids.indexOf(id)) {
|
109 |
+
ids.splice(ids.indexOf(id), 1);
|
110 |
+
}
|
111 |
+
$('venu_categories').value = ids.join(',');
|
112 |
+
}
|
113 |
+
</script>
|
114 |
+
<?php endif; ?>
|
app/design/frontend/default/default/layout/venu.xml
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<default>
|
4 |
+
<reference name="head">
|
5 |
+
<action method="addItem" >
|
6 |
+
<type>skin_css</type>
|
7 |
+
<name>vstudio/venu/master.css</name>
|
8 |
+
</action>
|
9 |
+
</reference>
|
10 |
+
<reference name="footer">
|
11 |
+
<block type="vstudio_venu/menu" name="vstudio.venu" as="vstudio_venu" template="vstudio/venu/menu.phtml" >
|
12 |
+
<action method="setData">
|
13 |
+
<name>menu_title</name>
|
14 |
+
<value>Sample Menu</value>
|
15 |
+
</action>
|
16 |
+
</block>
|
17 |
+
</reference>
|
18 |
+
</default>
|
19 |
+
</layout>
|
app/design/frontend/default/default/template/vstudio/venu/menu.phtml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$_menu = $this;
|
3 |
+
$selectedMenu = $_menu->getData('menu_title');
|
4 |
+
$options = $_menu->getMenuOptions($selectedMenu);
|
5 |
+
|
6 |
+
?>
|
7 |
+
|
8 |
+
<?php if ($menuItems = $_menu->getMenu($selectedMenu)) : ?>
|
9 |
+
|
10 |
+
<?php
|
11 |
+
$array = array();
|
12 |
+
foreach ($menuItems as $item) {
|
13 |
+
$array[$item['parent_id']][] = $item;
|
14 |
+
}
|
15 |
+
$_menu->display_menu($array, 0, false, $options);
|
16 |
+
?>
|
17 |
+
|
18 |
+
<?php endif; ?>
|
app/etc/modules/Vstudio_Venu.xml
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" ?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
|
5 |
+
<Vstudio_Venu>
|
6 |
+
<active>true</active>
|
7 |
+
<codePool>community</codePool>
|
8 |
+
</Vstudio_Venu>
|
9 |
+
|
10 |
+
</modules>
|
11 |
+
</config>
|
12 |
+
|
package.xml
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Venu_Menu</name>
|
4 |
+
<version>1.0.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/academic.php">("AFL") v. 3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Create simple but versatile menu navigation from CMS pages, Categories URLs, or external URLs. </summary>
|
10 |
+
<description><p>I&rsquo;m developer who enjoys the challenge of creating innovative applications.&nbsp; From back end programming (PHP, Asp.net, Ruby on Rails) to front end engineering (HTML, CSS and jQuery/Javascript), my days are spent looking for creative solutions to everyday web development problems.</p>
|
11 |
+
<p>Prior to developing websites, I worked as an IT consultant which was an amazing experience that helps me learn to see software engineering in a different way.&nbsp; I&rsquo;m passionate about web development and design. Aside from it, I enjoy reading challenging books, drawing, and singing to my daughter.</p>
|
12 |
+
<p>&nbsp;</p>
|
13 |
+
<p><strong>Introduction:</strong></p>
|
14 |
+
<p>This extension creates an admin menu with options for turning template path hints on, in the front and backend of your website.</p>
|
15 |
+
<p><strong>Features:</strong></p>
|
16 |
+
<p>- Upgrade Proof Module.<br /> - Tested for Magento version 1.7.0.0 - 1.8.1.0<br /> - Easy to install nothing to configure.</p>
|
17 |
+
<p><strong>Installation / Configuration:</strong></p>
|
18 |
+
<ol>
|
19 |
+
<li>Just copy &amp; paste the 'app' folder provided in the extension zip file to the root of your Magento installation.</li>
|
20 |
+
<li>After installation, make sure to clear you cache then:</li>
|
21 |
+
</ol>
|
22 |
+
<ul>
|
23 |
+
<li>To enable the admin path hints navigate and click on Path Hints &gt;&gt; Enable Admin Paths.</li>
|
24 |
+
<li>To disable the admin path hints navigate and click on Path Hints &gt;&gt; Disable Admin Paths.</li>
|
25 |
+
<li>To enable front-end path hints navigate and click on Path Hints &gt;&gt; Enable Front Paths.</li>
|
26 |
+
<li>To disable front-end path hints navigate and click on Path Hints &gt;&gt; Disable Front Paths.</li>
|
27 |
+
</ul>
|
28 |
+
<p>With this extension you can easily turn on template path hints for both front and back end with a click of menu. No configuration is needed.</p>
|
29 |
+
<p>&nbsp;</p>
|
30 |
+
<p>&nbsp;</p>
|
31 |
+
<p><strong>Introduction:</strong></p>
|
32 |
+
<p>Create simple but versatile menu navigation from CMS pages, Categories URLs, or external URLs. Each element has css class so you can address any element by standard css.</p>
|
33 |
+
<p><strong>Features:</strong></p>
|
34 |
+
<ul>
|
35 |
+
<li>Upgrade Proof Module.</li>
|
36 |
+
<li>Tested for Magento version 1.6.2.0 - 1.7.0.0 - 1.8.1.0.</li>
|
37 |
+
<li>&nbsp;Easy to install nothing to configure.</li>
|
38 |
+
<li>Valid HTML5 structure</li>
|
39 |
+
<li>Valid CSS</li>
|
40 |
+
<li>Support for vertical or horizontal menu orientation</li>
|
41 |
+
<li>Drop-down menu when using the horizontal menu</li>
|
42 |
+
<li>Fly-out menu when using the vertical menu</li>
|
43 |
+
<li>You can easily add any menu to pages, static block, or categories pages by copying and pasting the block code that gets generated every time you create a new menu.</li>
|
44 |
+
</ul>
|
45 |
+
<p>&nbsp;</p>
|
46 |
+
<p><strong>Installation / Configuration:</strong></p>
|
47 |
+
<ol>
|
48 |
+
<li>After installation, make sure to clear you cache then:</li>
|
49 |
+
</ol>
|
50 |
+
<ul>
|
51 |
+
<li>To create menus navigate to Menu &gt;&gt; Manage Menus</li>
|
52 |
+
</ul>
|
53 |
+
<ol>
|
54 |
+
<li>After installation a sample menu will be added to the footer of you website.</li>
|
55 |
+
</ol>
|
56 |
+
<ul>
|
57 |
+
<li>To disable the sample menu simply copy the venu.xml file located in MageDirectory\app\design\frontend\default\default\layout&nbsp; to your theme directory and remove the block reference to the sample menu.</li>
|
58 |
+
</ul>
|
59 |
+
<ol>
|
60 |
+
<li>To use Menu in your CMS pages use:</li>
|
61 |
+
</ol>
|
62 |
+
<ul>
|
63 |
+
<li>{{block type="vstudio_venu/menu" block_id="sample_menu" template="vstudio/venu/menu.phtml" menu_title="Sample Menu"}}</li>
|
64 |
+
</ul>
|
65 |
+
<ol>
|
66 |
+
<li><strong>&nbsp;NOTE:</strong> Here menu_title will be replaced with the menu name you created.</li>
|
67 |
+
</ol>
|
68 |
+
<p>&nbsp;</p></description>
|
69 |
+
<notes>First stable release</notes>
|
70 |
+
<authors><author><name>Leandro Villagran</name><user>veandro</user><email>veandro@outlook.com</email></author></authors>
|
71 |
+
<date>2014-04-21</date>
|
72 |
+
<time>10:55:00</time>
|
73 |
+
<contents><target name="mageetc"><dir><dir name="modules"><file name="Vstudio_Venu.xml" hash="9da19de899ff6e71c212774e6c4218cd"/></dir></dir></target><target name="magecommunity"><dir><dir name="Vstudio"><dir name="Venu"><dir name="Block"><dir name="Adminhtml"><dir name="Menumanager"><dir name="Edit"><file name="Form.php" hash="19e215b8bb5ff97f28a1da9c4870ee19"/><dir name="Tab"><file name="Categories.php" hash="cef84d0151c6ed2cc697642e81c07d28"/><file name="Custom.php" hash="c99783ed1eda4209c1c3239596af2cdc"/><file name="Form.php" hash="53c84d188a1b988381296eeafd00eaa4"/><file name="Pages.php" hash="e8e49286b198781e18ee5efa3241096c"/></dir><file name="Tabs.php" hash="4896cfcc4d9b83b54709583b2398caec"/></dir><file name="Edit.php" hash="32b25d351269353432f5925a21d50985"/><file name="Grid.php" hash="68395bbad24c0456e37bd8a0f2fd3ddc"/></dir><file name="Menumanager.php" hash="1006a6046a9b19cd56c343ac82202274"/></dir><file name="Menu.php" hash="f823d21dff135a711eede4deda12f44d"/></dir><dir name="Helper"><file name="Data.php" hash="7cd8247fccf0ec896ed8308b0e517209"/></dir><dir name="Model"><file name="MenuItem.php" hash="7a350ac0c1a550fa9a59ef8f1127b4c3"/><file name="Options.php" hash="ac77800626cab12b28354d8221546c31"/><dir name="Resource"><dir name="Menuitem"><file name="Collection.php" hash="9300a14f7281027d897dd0d4d747c788"/></dir><file name="Menuitem.php" hash="2649815d4c93ba40e4d6a4680f260e9a"/><dir name="Venu"><file name="Collection.php" hash="018e4a8a54ce460ab54d372a1467e49d"/></dir><file name="Venu.php" hash="2ea28ae615b6dbc8a5d0ef542f20d080"/></dir><file name="Venu.php" hash="83501fea2b353c8d7e52ef86fbbcfe32"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Venu"><file name="MenuController.php" hash="15bd684c86e4f323a052c19ed8a12bd5"/></dir></dir><file name="VenuController.php" hash="7f46cea457534d053eebf4c01833def6"/></dir><dir name="data"><dir name="vstudio_venu_setup"><file name="data-install-1.0.0.0.php" hash="efbb9acc38e7dfe72b4ec27699703d76"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="f3c85fa038d8a776800f957cf8a595f1"/><file name="config.xml" hash="4494e093a06461d2db8a0838ddf1413a"/><file name="system.xml" hash="c79e105fc5b825bf85a2479ed881883a"/></dir><dir name="sql"><dir name="vstudio_venu_setup"><file name="install-1.0.0.0.php" hash="98a6e204778f474723e9bcbb11947bc9"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="venu.xml" hash="44965e811d34f6c432aeb44feeaa88e3"/></dir><dir name="template"><dir name="vstudio"><dir name="venu"><dir name="edit"><dir name="tab"><file name="category.phtml" hash="8b42a4f731790f088bd0cd4c0a7a87fe"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="venu.xml" hash="954348f6dd922c8186d47794090e4b1e"/></dir><dir name="template"><dir name="vstudio"><dir name="venu"><file name="menu.phtml" hash="b06077bcf9e9d1c9579e443fb83b613f"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="vstudio"><dir name="venu"><file name="master.css" hash="3f7658a34ee77526fa1967fb600d747c"/></dir></dir></dir></dir></dir></dir></target></contents>
|
74 |
+
<compatible/>
|
75 |
+
<dependencies><required><php><min>5.2.0</min><max>5.4.24</max></php></required></dependencies>
|
76 |
+
</package>
|
skin/frontend/default/default/vstudio/venu/master.css
ADDED
@@ -0,0 +1,193 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.venu-container {
|
2 |
+
width:100%;
|
3 |
+
float:left;
|
4 |
+
clear: both;
|
5 |
+
}
|
6 |
+
.venu-menu {
|
7 |
+
list-style: none;
|
8 |
+
margin: 0;
|
9 |
+
padding: 0;
|
10 |
+
display: block;
|
11 |
+
box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.05);
|
12 |
+
widows: auto;
|
13 |
+
float: left;
|
14 |
+
clear:both;
|
15 |
+
width:100%;
|
16 |
+
text-align: center;
|
17 |
+
|
18 |
+
}
|
19 |
+
.venu-menu,
|
20 |
+
.venu-menu li {
|
21 |
+
margin: 0;
|
22 |
+
padding: 0;
|
23 |
+
border: 0;
|
24 |
+
list-style: none;
|
25 |
+
line-height: 1;
|
26 |
+
-webkit-box-sizing: border-box;
|
27 |
+
-moz-box-sizing: border-box;
|
28 |
+
box-sizing: border-box;
|
29 |
+
background: none;
|
30 |
+
}
|
31 |
+
.venu-menu > li {
|
32 |
+
position: relative;
|
33 |
+
}
|
34 |
+
|
35 |
+
.venu-menu li a {
|
36 |
+
text-decoration: none;
|
37 |
+
display: block;
|
38 |
+
margin: 0;
|
39 |
+
-webkit-transition: color .2s ease;
|
40 |
+
-moz-transition: color .2s ease;
|
41 |
+
-ms-transition: color .2s ease;
|
42 |
+
-o-transition: color .2s ease;
|
43 |
+
transition: color .2s ease;
|
44 |
+
}
|
45 |
+
.venu-menu ul {
|
46 |
+
position: absolute;
|
47 |
+
top: auto;
|
48 |
+
font-size: 13px;
|
49 |
+
opacity: 0;
|
50 |
+
padding: 0;
|
51 |
+
margin:0;
|
52 |
+
padding-top:6px;
|
53 |
+
}
|
54 |
+
.venu-menu li ul li {
|
55 |
+
background: #ffffff;
|
56 |
+
display: block;
|
57 |
+
position: relative;
|
58 |
+
}
|
59 |
+
.venu-menu ul ul {
|
60 |
+
padding: 0;
|
61 |
+
margin:0;
|
62 |
+
padding-left: 6px;
|
63 |
+
}
|
64 |
+
|
65 |
+
.venu-menu ul > li:hover > ul {
|
66 |
+
top: 0;
|
67 |
+
left:100%;
|
68 |
+
opacity: 1;
|
69 |
+
-webkit-transition: top 0.2s ease, opacity 0.2s ease-in;
|
70 |
+
-moz-transition: top 0.2s ease, opacity 0.2s ease-in;
|
71 |
+
-ms-transition: top 0.2s ease, opacity 0.2s ease-in;
|
72 |
+
-o-transition: top 0.2s ease, opacity 0.2s ease-in;
|
73 |
+
transition: top 0.2s ease, opacity 0.2s ease-in;
|
74 |
+
|
75 |
+
}
|
76 |
+
.venu-menu ul li a {
|
77 |
+
text-decoration: none;
|
78 |
+
font-weight: 400;
|
79 |
+
padding: 11px 25px;
|
80 |
+
width: 180px;
|
81 |
+
color: #777777;
|
82 |
+
background: #ffffff;
|
83 |
+
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.1), 1px 1px 1px rgba(0, 0, 0, 0.1), -1px 1px 1px rgba(0, 0, 0, 0.1);
|
84 |
+
}
|
85 |
+
.venu-menu ul li:hover > a {
|
86 |
+
color: #333333;
|
87 |
+
}
|
88 |
+
|
89 |
+
/*** Horizontal ***/
|
90 |
+
.venu-menu-horz > li {
|
91 |
+
float:left;
|
92 |
+
padding:10px;
|
93 |
+
}
|
94 |
+
ul.venu-menu-horz > li:hover > ul {
|
95 |
+
top: auto;
|
96 |
+
left: 0;
|
97 |
+
opacity: 1;
|
98 |
+
}
|
99 |
+
|
100 |
+
/*** Sample Menu ***/
|
101 |
+
.sample_menu {
|
102 |
+
margin: 5px auto;
|
103 |
+
text-align: center;
|
104 |
+
}
|
105 |
+
|
106 |
+
.sample_menu > li {
|
107 |
+
display: inline-block;
|
108 |
+
float:none;
|
109 |
+
}
|
110 |
+
/******************/
|
111 |
+
|
112 |
+
/*** Vertical ***/
|
113 |
+
.venu-menu-vert {
|
114 |
+
position: relative;
|
115 |
+
z-index: 597;
|
116 |
+
float: left;
|
117 |
+
width:auto;
|
118 |
+
text-align: left;
|
119 |
+
}
|
120 |
+
.venu-menu-vert > li {
|
121 |
+
float: left;
|
122 |
+
min-height: 1px;
|
123 |
+
line-height: 1em;
|
124 |
+
border-left: 3px solid #3dbd99;
|
125 |
+
display: block;
|
126 |
+
}
|
127 |
+
.venu-menu-vert > li:hover > ul {
|
128 |
+
top: 0;
|
129 |
+
left: 100%;
|
130 |
+
opacity: 1;
|
131 |
+
}
|
132 |
+
.venu-menu-vert li.hover {
|
133 |
+
position: relative;
|
134 |
+
z-index: 599;
|
135 |
+
cursor: default;
|
136 |
+
}
|
137 |
+
.venu-menu-vert ul {
|
138 |
+
visibility: hidden;
|
139 |
+
position: absolute;
|
140 |
+
top: 0;
|
141 |
+
left: 99%;
|
142 |
+
z-index: 598;
|
143 |
+
width: 99%;
|
144 |
+
}
|
145 |
+
.venu-menu-vert ul li {
|
146 |
+
float: none;
|
147 |
+
}
|
148 |
+
.venu-menu-vert li:hover > ul {
|
149 |
+
visibility: visible;
|
150 |
+
}
|
151 |
+
.venu-menu-vert li {
|
152 |
+
float: none;
|
153 |
+
}
|
154 |
+
.venu-menu-vert ul li {
|
155 |
+
font-weight: normal;
|
156 |
+
}
|
157 |
+
.venu-menu-vert ul ul {
|
158 |
+
top:0;
|
159 |
+
left:100%;
|
160 |
+
|
161 |
+
}
|
162 |
+
.venu-menu-vert ul ul li {
|
163 |
+
padding-left: 20px;
|
164 |
+
}
|
165 |
+
.venu-menu-vert > li > a {
|
166 |
+
padding: 10px 20px;
|
167 |
+
}
|
168 |
+
.venu-menu-vert > li:hover {
|
169 |
+
border-left: 3px solid #3dbd99;
|
170 |
+
}
|
171 |
+
.venu-menu-vert li:hover > a {
|
172 |
+
color: #3dbd99;
|
173 |
+
}
|
174 |
+
.venu-menu-vert ul a:link,
|
175 |
+
.venu-menu-vert ul a:visited {
|
176 |
+
font-weight: 400;
|
177 |
+
font-size: 14px;
|
178 |
+
}
|
179 |
+
.venu-menu-vert ul {
|
180 |
+
width: 180px;
|
181 |
+
background: none;
|
182 |
+
}
|
183 |
+
.venu-menu-vert ul a {
|
184 |
+
padding: 8px 0;
|
185 |
+
border-bottom: 1px solid #eeeeee;
|
186 |
+
}
|
187 |
+
.venu-menu-vert ul li {
|
188 |
+
background: #fff;
|
189 |
+
}
|
190 |
+
|
191 |
+
|
192 |
+
|
193 |
+
|