Auriga_Footertip - Version 1.0.0

Version Notes

First Preview Release

Download this release

Release Info

Developer Nishant Gauttam
Extension Auriga_Footertip
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/local/Auriga/Footertip/Block/Adminhtml/Footertip.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Auriga_Footertip_Block_Adminhtml_Footertip extends Mage_Adminhtml_Block_Widget_Grid_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+ $this->_controller = 'adminhtml_footertip';
8
+ $this->_blockGroup = 'footertip';
9
+ $this->_headerText = Mage::helper('footertip')->__('Footer Tip Manager');
10
+ $this->_addButtonLabel = Mage::helper('footertip')->__('Add Tip');
11
+ parent::__construct();
12
+ }
13
+ }
app/code/local/Auriga/Footertip/Block/Adminhtml/Footertip/Addnew.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Auriga_Footertip_Block_Adminhtml_Footertip_Addnew extends Mage_Adminhtml_Block_Widget_Form_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+
8
+ $this->_objectId = 'id';
9
+ $this->_blockGroup = 'footertip';
10
+ $this->_controller = 'adminhtml_footertip';
11
+ $this->_mode = 'addnew';
12
+ parent::__construct();
13
+ $this->_removeButton('save', 'label', Mage::helper('footertip')->__('Save Tip'));
14
+ $this->_updateButton('delete', 'label', Mage::helper('footertip')->__('Delete Item'));
15
+ }
16
+
17
+ public function getHeaderText()
18
+ {
19
+ return Mage::helper('footertip')->__('Add Tip');
20
+
21
+ }
22
+ }
app/code/local/Auriga/Footertip/Block/Adminhtml/Footertip/Addnew/Form.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Auriga_Footertip_Block_Adminhtml_Footertip_Addnew_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
+ ));
12
+
13
+ $form->setUseContainer(true);
14
+ $this->setForm($form);
15
+ $fieldset = $form->addFieldset('footertip_form', array('legend'=>Mage::helper('footertip')->__('Tip information')));
16
+
17
+ $fieldset->addField('footertip','editor', array(
18
+ 'label' => Mage::helper('footertip')->__('Footer tip'),
19
+ 'required' => true,
20
+ 'style' => 'width:200%; height:100px;',
21
+ 'name' => 'footertip',
22
+ 'wysiwyg' => false,
23
+ 'required' => true,
24
+ ));
25
+
26
+ $fieldset->addfield('submit','submit',array(
27
+ 'name' => 'submit',
28
+ 'value' => 'Submit',
29
+ ));
30
+
31
+ if ( Mage::getSingleton('adminhtml/session')->getfootertipData() )
32
+ {
33
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getFootertipData());
34
+ Mage::getSingleton('adminhtml/session')->setFootertipData(null);
35
+ } elseif ( Mage::registry('footertip_data') ) {
36
+ $form->setValues(Mage::registry('footertip_data')->getData());
37
+ }
38
+ return parent::_prepareForm();
39
+ }
40
+ }
app/code/local/Auriga/Footertip/Block/Adminhtml/Footertip/Edit.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Auriga_Footertip_Block_Adminhtml_Footertip_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 = 'footertip';
11
+ $this->_controller = 'adminhtml_footertip';
12
+
13
+ $this->_updateButton('save', 'label', Mage::helper('footertip')->__('Save Tip'));
14
+ $this->_updateButton('delete', 'label', Mage::helper('footertip')->__('Delete Tip'));
15
+ }
16
+
17
+ public function getHeaderText()
18
+ {
19
+ if( Mage::registry('footertip_data') && Mage::registry('footertip_data')->getId() ) {
20
+ return Mage::helper('footertip')->__("Edit Tip '%s'", $this->htmlEscape(Mage::registry('footertip_data')->getFootertip()));
21
+ } else {
22
+ return Mage::helper('footertip')->__('Add Item');
23
+ }
24
+ }
25
+ }
app/code/local/Auriga/Footertip/Block/Adminhtml/Footertip/Edit/Form.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Auriga_Footertip_Block_Adminhtml_Footertip_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
+ ));
12
+
13
+ $form->setUseContainer(true);
14
+ $this->setForm($form);
15
+ $fieldset = $form->addFieldset('footertip_form', array('legend'=>Mage::helper('footertip')->__('Tip information')));
16
+
17
+ $fieldset->addField('footertip','editor', array(
18
+ 'label' => Mage::helper('footertip')->__('Footer tip'),
19
+ 'required' => true,
20
+ 'style' => 'width:200%; height:100px;',
21
+ 'name' => 'footertip',
22
+ 'wysiwyg' => false,
23
+ 'required' => true,
24
+ ));
25
+
26
+
27
+
28
+ if ( Mage::getSingleton('adminhtml/session')->getfootertipData() )
29
+ {
30
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getFootertipData());
31
+ Mage::getSingleton('adminhtml/session')->setFootertipData(null);
32
+ } elseif ( Mage::registry('footertip_data') ) {
33
+ $form->setValues(Mage::registry('footertip_data')->getData());
34
+ }
35
+ return parent::_prepareForm();
36
+ }
37
+ }
app/code/local/Auriga/Footertip/Block/Adminhtml/Footertip/Edit/Tab/Form.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Auriga_Footertip_Block_Adminhtml_Footertip_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('footertip_form', array('legend'=>Mage::helper('footertip')->__('Item information')));
10
+
11
+ $fieldset->addField('title', 'text', array(
12
+ 'label' => Mage::helper('footertip')->__('Title'),
13
+ 'class' => 'required-entry',
14
+ 'required' => true,
15
+ 'name' => 'title',
16
+ ));
17
+
18
+ $fieldset->addField('status', 'select', array(
19
+ 'label' => Mage::helper('footertip')->__('Status'),
20
+ 'name' => 'status',
21
+ 'values' => array(
22
+ array(
23
+ 'value' => 1,
24
+ 'label' => Mage::helper('footertip')->__('Active'),
25
+ ),
26
+
27
+ array(
28
+ 'value' => 0,
29
+ 'label' => Mage::helper('footertip')->__('Inactive'),
30
+ ),
31
+ ),
32
+ ));
33
+
34
+ $fieldset->addField('content', 'editor', array(
35
+ 'name' => 'content',
36
+ 'label' => Mage::helper('footertip')->__('Content'),
37
+ 'title' => Mage::helper('footertip')->__('Content'),
38
+ 'style' => 'width:98%; height:400px;',
39
+ 'wysiwyg' => false,
40
+ 'required' => true,
41
+ ));
42
+
43
+ if ( Mage::getSingleton('adminhtml/session')->getfootertipData() )
44
+ {
45
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getFootertipData());
46
+ Mage::getSingleton('adminhtml/session')->setFootertipData(null);
47
+ } elseif ( Mage::registry('footertip_data') ) {
48
+ $form->setValues(Mage::registry('footertip_data')->getData());
49
+ }
50
+ return parent::_prepareForm();
51
+ }
52
+ }
app/code/local/Auriga/Footertip/Block/Adminhtml/Footertip/Edit/Tabs.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Auriga_Footertip_Block_Adminhtml_Footertip_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId('footertip_tabs');
10
+ $this->setDestElementId('edit_form');
11
+ $this->setTitle(Mage::helper('footertip')->__('News Information'));
12
+ }
13
+
14
+ protected function _beforeToHtml()
15
+ {
16
+ $this->addTab('form_section', array(
17
+ 'label' => Mage::helper('footertip')->__('Item Information'),
18
+ 'name' => Mage::helper('footertip')->__('Item Information'),
19
+ 'remark' => $this->getLayout()->createBlock('footertip/adminhtml_footertip_edit_tab_form')->toHtml(),
20
+ ));
21
+
22
+ return parent::_beforeToHtml();
23
+ }
24
+ }
app/code/local/Auriga/Footertip/Block/Adminhtml/Footertip/Grid.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Auriga_Footertip_Block_Adminhtml_Footertip_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('footertipGrid');
9
+ // This is the primary key of the database
10
+ $this->setDefaultSort('footertip_id');
11
+ $this->setDefaultDir('ASC');
12
+ $this->setSaveParametersInSession(true);
13
+ }
14
+ protected function _prepareMassaction()
15
+ {
16
+ $this->setMassactionIdField('footertip_id');
17
+ $this->getMassactionBlock()->setFormFieldName('status');
18
+ $this->getMassactionBlock()->addItem('enabled', array(
19
+ 'label' => Mage::helper('footertip')->__('Enabled'),
20
+ 'url' => $this->getUrl('*/*/massEnable'),
21
+ ));
22
+
23
+ $this->getMassactionBlock()->addItem('disabled', array(
24
+ 'label' => Mage::helper('footertip')->__('Disabled'),
25
+ 'url' => $this->getUrl('*/*/massDisable'),
26
+ ));
27
+
28
+ return $this;
29
+ }
30
+ protected function _prepareCollection()
31
+ {
32
+ $collection = Mage::getModel('footertip/footertip')->getCollection();
33
+ $this->setCollection($collection);
34
+ return parent::_prepareCollection();
35
+ }
36
+
37
+ protected function _prepareColumns()
38
+ {
39
+ $this->addColumn('footertip_id', array(
40
+ 'header' => Mage::helper('footertip')->__('ID'),
41
+ 'align' =>'right',
42
+ 'width' => '50px',
43
+ 'index' => 'footertip_id',
44
+ ));
45
+
46
+ $this->addColumn('footertip', array(
47
+ 'header' => Mage::helper('footertip')->__('Footer Tip'),
48
+ 'align' =>'left',
49
+ 'index' => 'footertip',
50
+ ));
51
+
52
+
53
+ $this->addColumn('status', array(
54
+ 'header' => Mage::helper('footertip')->__('Status'),
55
+ 'width' => '150px',
56
+ 'index' => 'status',
57
+ ));
58
+
59
+
60
+
61
+ return parent::_prepareColumns();
62
+ }
63
+
64
+ public function getRowUrl($row)
65
+ {
66
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
67
+ }
68
+
69
+
70
+ }
app/code/local/Auriga/Footertip/Helper/Data.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Auriga_Footertip_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ }
app/code/local/Auriga/Footertip/Model/Footertip.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Auriga_Footertip_Model_Footertip extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('footertip/footertip');
9
+ }
10
+ }
app/code/local/Auriga/Footertip/Model/Mysql4/Footertip.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Auriga_Footertip_Model_Mysql4_Footertip extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ $this->_init('footertip/footertip','footertip_id');
8
+ }
9
+ }
app/code/local/Auriga/Footertip/Model/Mysql4/Footertip/Collection.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Auriga_Footertip_Model_Mysql4_Footertip_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ //parent::__construct();
8
+ $this->_init('footertip/footertip');
9
+ }
10
+
11
+
12
+ public function setRandomOrder()
13
+ {
14
+ $this->setPageSize(1)->getSelect()->order(new Zend_Db_Expr('RAND()'));
15
+ return $this;
16
+ }
17
+
18
+
19
+
20
+ }
app/code/local/Auriga/Footertip/controllers/Adminhtml/FootertipController.php ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Auriga_Footertip_Adminhtml_FootertipController extends Mage_Adminhtml_Controller_Action
5
+ {
6
+
7
+ protected function _initAction()
8
+ {
9
+ $this->loadLayout()
10
+ ->_setActiveMenu('footertip/items')
11
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
12
+ return $this;
13
+ }
14
+
15
+ public function indexAction() {
16
+ $this->_initAction();
17
+ $this->_addContent($this->getLayout()->createBlock('footertip/adminhtml_footertip'));
18
+ $this->renderLayout();
19
+ }
20
+
21
+ public function editAction()
22
+ {
23
+ $footertipId = $this->getRequest()->getParam('id');
24
+ $footertipModel = Mage::getModel('footertip/footertip')->load($footertipId);
25
+
26
+ if ($footertipModel->getId() || $footertipId == 0) {
27
+
28
+ Mage::register('footertip_data', $footertipModel);
29
+
30
+ $this->loadLayout();
31
+ $this->_setActiveMenu('footertip/items');
32
+
33
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
34
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
35
+
36
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
37
+
38
+ $this->_addContent($this->getLayout()->createBlock('footertip/adminhtml_footertip_edit'))
39
+ ->_addLeft($this->getLayout()->createBlock('footertip/adminhtml_footertip_edit_tabs'));
40
+
41
+ $this->renderLayout();
42
+ } else {
43
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('footertip')->__('Item does not exist'));
44
+ $this->_redirect('*/*/');
45
+ }
46
+ }
47
+
48
+ public function newAction()
49
+ {
50
+ $this->_initAction();
51
+ $this->_addContent($this->getLayout()->createBlock('footertip/adminhtml_footertip_addnew'));
52
+ $this->renderLayout();
53
+
54
+ }
55
+
56
+ public function saveAction()
57
+ {
58
+ if ( $this->getRequest()->getPost() ) {
59
+ try {
60
+ $postData = $this->getRequest()->getPost();
61
+ $footertipModel = Mage::getModel('footertip/footertip');
62
+ $footertipModel->setId($this->getRequest()->getParam('id'))->setFootertip($postData['footertip'])->save();
63
+ //$postData['footertip']
64
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully saved'));
65
+ Mage::getSingleton('adminhtml/session')->setfootertipData(false);
66
+
67
+ $this->_redirect('*/*/');
68
+ return;
69
+ } catch (Exception $e) {
70
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
71
+ Mage::getSingleton('adminhtml/session')->setFootertipData($this->getRequest()->getPost());
72
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
73
+ return;
74
+ }
75
+ }
76
+ $this->_redirect('*/*/');
77
+ }
78
+
79
+ public function deleteAction()
80
+ {
81
+ if( $this->getRequest()->getParam('id') > 0 ) {
82
+ try {
83
+ $footertipModel = Mage::getModel('footertip/footertip');
84
+
85
+ $footertipModel->setId($this->getRequest()->getParam('id'))
86
+ ->delete();
87
+
88
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
89
+ $this->_redirect('*/*/');
90
+ } catch (Exception $e) {
91
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
92
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
93
+ }
94
+ }
95
+ $this->_redirect('*/*/');
96
+ }
97
+ /**
98
+ * Product grid for AJAX request.
99
+ * Sort and filter result for example.
100
+ */
101
+ public function gridAction()
102
+ {
103
+ $this->loadLayout();
104
+ $this->getResponse()->setBody(
105
+ $this->getLayout()->createBlock('importedit/adminhtml_footertip_grid')->toHtml()
106
+ );
107
+ }
108
+
109
+
110
+ public function massEnableAction()
111
+ {
112
+ $footerTipIds = $this->getRequest()->getParam('status');
113
+ $footerTipLabel = $this->getRequest()->getParam();
114
+
115
+
116
+
117
+ if(!is_array($footerTipIds)) {
118
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('footertip')->__('Please select product(s)'));
119
+ } else {
120
+ try {
121
+ $footertip = Mage::getModel('footertip/footertip');
122
+
123
+ foreach ($footerTipIds as $footerTipId)
124
+ {
125
+ $footertipModel = Mage::getModel('footertip/footertip');
126
+ $footertipModel->setId($footerTipId)->setStatus('Enabled')->save();
127
+ }
128
+ Mage::getSingleton('adminhtml/session')->addSuccess(
129
+ Mage::helper('footertip')->__(
130
+ 'Total of %d footer tip(s) were successfully updated', count($footerTipIds)
131
+ )
132
+ );
133
+ } catch (Exception $e) {
134
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
135
+ }
136
+ }
137
+
138
+ $this->_redirect('*/*/index');
139
+
140
+ }
141
+ public function massDisableAction()
142
+ {
143
+ $footerTipIds = $this->getRequest()->getParam('status');
144
+ $footerTipLabel = $this->getRequest()->getParam();
145
+
146
+
147
+
148
+ if(!is_array($footerTipIds)) {
149
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('footertip')->__('Please select product(s)'));
150
+ } else {
151
+ try {
152
+ $footertip = Mage::getModel('footertip/footertip');
153
+
154
+ foreach ($footerTipIds as $footerTipId)
155
+ {
156
+ $footertipModel = Mage::getModel('footertip/footertip');
157
+ $footertipModel->setId($footerTipId)->setStatus('Disabled')->save();
158
+ }
159
+ Mage::getSingleton('adminhtml/session')->addSuccess(
160
+ Mage::helper('footertip')->__(
161
+ 'Total of %d footer tip(s) were successfully updated', count($footerTipIds)
162
+ )
163
+ );
164
+ } catch (Exception $e) {
165
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
166
+ }
167
+ }
168
+
169
+ $this->_redirect('*/*/index');
170
+
171
+ }
172
+ }
app/code/local/Auriga/Footertip/etc/adminhtml.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <all>
6
+ <title>Allow Everything</title>
7
+ </all>
8
+ <admin>
9
+ <children>
10
+ <footertip>
11
+ <title>Footertip Module</title>
12
+ <sort_order>200</sort_order>
13
+ </footertip>
14
+ </children>
15
+ </admin>
16
+ </resources>
17
+ </acl>
18
+ </config>
app/code/local/Auriga/Footertip/etc/config.xml ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Auriga_Footertip>
5
+ <version>0.1.0</version>
6
+ </Auriga_Footertip>
7
+ </modules>
8
+ <frontend>
9
+ <layout>
10
+ <updates>
11
+ <footertip module="footertip">
12
+ <file>footertip.xml</file>
13
+ </footertip>
14
+ </updates>
15
+ </layout>
16
+ </frontend>
17
+ <admin>
18
+ <routers>
19
+ <!-- Includes our controller, so when we add the adminhtml menu item below, it is found! -->
20
+ <adminhtml>
21
+ <args>
22
+ <modules>
23
+ <footertip before="Mage_Adminhtml">Auriga_Footertip_Adminhtml</footertip>
24
+ </modules>
25
+ </args>
26
+ </adminhtml>
27
+ </routers>
28
+ </admin>
29
+ <adminhtml>
30
+ <menu>
31
+ <footertip module="footertip">
32
+ <title>Auriga Modules</title>
33
+ <sort_order>101</sort_order>
34
+ <children>
35
+ <footertip translate="title" module="footertip">
36
+ <title>Manage Footer Tips</title>
37
+ <action>adminhtml/footertip</action>
38
+ <sort_order>0</sort_order>
39
+ </footertip>
40
+
41
+ </children>
42
+ </footertip>
43
+ </menu>
44
+ <acl>
45
+ <resources>
46
+ <all>
47
+ <title>Allow Everything</title>
48
+ </all>
49
+ <admin>
50
+ <children>
51
+ <footertip>
52
+ <title>footertip Module</title>
53
+ <sort_order>200</sort_order>
54
+ </footertip>
55
+ </children>
56
+ </admin>
57
+ </resources>
58
+ </acl>
59
+ </adminhtml>
60
+ <global>
61
+ <models>
62
+ <footertip>
63
+ <class>Auriga_Footertip_Model</class>
64
+ <resourceModel>footertip_mysql4</resourceModel>
65
+ </footertip>
66
+ <footertip_mysql4>
67
+ <class>Auriga_Footertip_Model_Mysql4</class>
68
+ <entities>
69
+ <footertip>
70
+ <table>footertip</table>
71
+ </footertip>
72
+ </entities>
73
+ </footertip_mysql4>
74
+ </models>
75
+ <resources>
76
+ <footertip_setup>
77
+ <setup>
78
+ <module>Auriga_Footertip</module>
79
+ </setup>
80
+ <connection>
81
+ <use>core_setup</use>
82
+ </connection>
83
+ </footertip_setup>
84
+ <footertip_write>
85
+ <connection>
86
+ <use>core_write</use>
87
+ </connection>
88
+
89
+
90
+ </footertip_write>
91
+ <footertip_read>
92
+ <connection>
93
+ <use>core_read</use>
94
+ </connection>
95
+ </footertip_read>
96
+ </resources>
97
+ <blocks>
98
+ <footertip>
99
+ <class>Auriga_Footertip_Block</class>
100
+ </footertip>
101
+ </blocks>
102
+ <helpers>
103
+ <footertip>
104
+ <class>Auriga_Footertip_Helper</class>
105
+ </footertip>
106
+ </helpers>
107
+ </global>
108
+ </config>
app/code/local/Auriga/Footertip/sql/footertip_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+
10
+ CREATE TABLE IF NOT EXISTS footertip(
11
+ `footertip_id` int(11) unsigned NOT NULL auto_increment,
12
+ `footertip` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
13
+ `status` VARCHAR( 20 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'Enabled',
14
+ PRIMARY KEY (`footertip_id`)
15
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
16
+
17
+ ");
18
+ $installer->endSetup();
app/design/frontend/base/default/layout/footertip.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="footer">
5
+ <action method="unsetData"><key>cache_lifetime</key></action>
6
+ <action method="unsetData"><key>cache_tags</key></action>
7
+ <block type="core/template" name="footertip" template="footertip/footertip.phtml" before="-" />
8
+ </reference>
9
+ </default>
10
+ </layout>
app/design/frontend/base/default/template/footertip/footertip.phtml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //$footer_tip = Mage::getStoreConfig('tab1/footertip/active');
3
+ //if($footer_tip == 1)
4
+ {
5
+
6
+
7
+ $collection = Mage::getModel('footertip/footertip')
8
+ ->getCollection()->addFieldToFilter('status','Enabled')
9
+ ->setRandomOrder();
10
+ $data= $collection->getData();
11
+
12
+ $countTip=count($data);
13
+ $tipArray=$data[0]['footertip'];
14
+ ?>
15
+ <script>
16
+
17
+ var tipArray=<?php echo json_encode($tipArray);?>;
18
+
19
+
20
+ function setTip()
21
+
22
+ {
23
+ document.getElementById('tip').innerHTML=tipArray;
24
+
25
+ }
26
+ </script>
27
+ <h2><span id="tip"><script>setTip();</script></span></h2>
28
+
29
+ <?php }?>
app/etc/modules/Auriga_Footertip.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Auriga_Footertip>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </Auriga_Footertip>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Auriga_Footertip</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>Open Software License (OSL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>This extension allow to show tips in the footer.</summary>
10
+ <description>In this extension we can manage footer tip from the admin panel of magento and these tips will change when page will refresh.</description>
11
+ <notes>First Preview Release</notes>
12
+ <authors><author><name>Nishant Gauttam</name><user>nishantgauttam</user><email>nishant.gauttam@gmail.com</email></author></authors>
13
+ <date>2013-09-03</date>
14
+ <time>10:24:28</time>
15
+ <contents><target name="magelocal"><dir name="Auriga"><dir name="Footertip"><dir name="Block"><dir name="Adminhtml"><dir name="Footertip"><dir name="Addnew"><file name="Form.php" hash="3af957e975e2c6efab5a52811a4cec2f"/></dir><file name="Addnew.php" hash="7b1ee76e0182b91a20425ae836bb1128"/><dir name="Edit"><file name="Form.php" hash="84ddad684233cc409134a3f297fc4cd9"/><dir name="Tab"><file name="Form.php" hash="2066c277bf04d9ef5b54ead2c72ef4ea"/></dir><file name="Tabs.php" hash="a3a19f1451c6500ccfc33f52658edf3a"/></dir><file name="Edit.php" hash="f64fe3fb72cd8364656a77385bf37b7f"/><file name="Grid.php" hash="ca389c785ed45c9a4a857a73ad73db4b"/></dir><file name="Footertip.php" hash="2035efdae4e699a9007d457c9e47307f"/></dir></dir><dir name="Helper"><file name="Data.php" hash="2c663e2136d6142b1e20130b6a92f815"/></dir><dir name="Model"><file name="Footertip.php" hash="f9d7e339feccd00fc805a4dd8fd5daa2"/><dir name="Mysql4"><dir name="Footertip"><file name="Collection.php" hash="5043c3eea2c695c24fe4a65aef15a9ce"/></dir><file name="Footertip.php" hash="d89ad8a6044f0d8eb4e00693fa635f04"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="FootertipController.php" hash="8bfe43b4507476d1cf4363b737787e6d"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="c53c561f8519eb80f4cf56876ee84762"/><file name="config.xml" hash="c33ba386bb3f899ceded42ca444ab85d"/></dir><dir name="sql"><dir name="footertip_setup"><file name="mysql4-install-0.1.0.php" hash="33abcdebe8ef027c145d9433f1cd6ee6"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="footertip"><file name="footertip.phtml" hash="7a56fdfc46e3988d1c07385a020885a2"/></dir></dir><dir name="layout"><file name="footertip.xml" hash="167fbb692b411653295df59fa59f8508"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Auriga_Footertip.xml" hash="79f2712ca990ffc64be28db1f2f3a228"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>