Version Notes
All features are configurable from admin like width, height, auto slideshow, display next previous arrow, show caption, show navigation images, max number of slides to display, display slide content, time between two slides.
Download this release
Release Info
Developer | Etatvasoft |
Extension | Etatvasoft_Dynamic_Image_Slider |
Version | 1.5.3 |
Comparing to | |
See all releases |
Code changes from version 1.5.2 to 1.5.3
- app/code/local/Tatva/Attachpdf/Block/Adminhtml/Attachpdf.php +12 -0
- app/code/local/Tatva/Attachpdf/Block/Adminhtml/Attachpdf/Edit.php +45 -0
- app/code/local/Tatva/Attachpdf/Block/Adminhtml/Attachpdf/Edit/Form.php +19 -0
- app/code/local/Tatva/Attachpdf/Block/Adminhtml/Attachpdf/Edit/Tab/Form.php +58 -0
- app/code/local/Tatva/Attachpdf/Block/Adminhtml/Attachpdf/Edit/Tabs.php +24 -0
- app/code/local/Tatva/Attachpdf/Block/Adminhtml/Attachpdf/Grid.php +116 -0
- app/code/local/Tatva/Attachpdf/Block/Attachpdf.php +17 -0
- app/code/local/Tatva/Attachpdf/Helper/Data.php +6 -0
- app/code/local/Tatva/Attachpdf/Model/Attachpdf.php +10 -0
- app/code/local/Tatva/Attachpdf/Model/Mysql4/Attachpdf.php +10 -0
- app/code/local/Tatva/Attachpdf/Model/Mysql4/Attachpdf/Collection.php +10 -0
- app/code/local/Tatva/Attachpdf/Model/Status.php +15 -0
- app/code/local/Tatva/Attachpdf/controllers/IndexController.php +47 -0
- app/code/local/Tatva/Attachpdf/etc/config.xml +33 -0
- app/code/local/Tatva/Catalogextensions/Block/Allproducts/List.php +65 -0
- app/code/local/Tatva/Catalogextensions/Block/Bestsellers/Home/List.php +68 -0
- app/code/local/Tatva/Catalogextensions/Block/Bestsellers/List.php +61 -0
- app/code/local/Tatva/Catalogextensions/Block/Catalogextensions.php +17 -0
- app/code/local/Tatva/Catalogextensions/Block/Featured/Home/List.php +67 -0
- app/code/local/Tatva/Catalogextensions/Block/Featured/List.php +60 -0
- app/code/local/Tatva/Catalogextensions/Block/Mostviewed/Home/List.php +68 -0
- app/code/local/Tatva/Catalogextensions/Block/Mostviewed/List.php +61 -0
- app/code/local/Tatva/Catalogextensions/Block/Newproduct/Home/List.php +69 -0
- app/code/local/Tatva/Catalogextensions/Block/Newproduct/List.php +60 -0
- app/code/local/Tatva/Catalogextensions/Block/Promotional/Home/List.php +86 -0
- app/code/local/Tatva/Catalogextensions/Block/Promotional/List.php +81 -0
- app/code/local/Tatva/Catalogextensions/Block/lastordered/Home/List.php +74 -0
- app/code/local/Tatva/Catalogextensions/Block/lastordered/List.php +69 -0
- app/code/local/Tatva/Catalogextensions/Helper/Data.php +6 -0
- app/code/local/Tatva/Catalogextensions/Model/Catalogextensions.php +10 -0
- app/code/local/Tatva/Catalogextensions/Model/Mysql4/Catalogextensions.php +10 -0
- app/code/local/Tatva/Catalogextensions/Model/Mysql4/Catalogextensions/Collection.php +10 -0
- app/code/local/Tatva/Catalogextensions/Model/Status.php +15 -0
- app/code/local/Tatva/Catalogextensions/controllers/IndexController.php +158 -0
- app/code/local/Tatva/Catalogextensions/etc/adminhtml.xml +29 -0
- app/code/local/Tatva/Catalogextensions/etc/config.xml +157 -0
- app/code/local/Tatva/Catalogextensions/etc/system.xml +266 -0
- app/code/local/Tatva/Catalogextensions/sql/catalogextensions_setup/mysql4-install-0.1.0.php +33 -0
- app/code/local/Tatva/Customtab/Block/Adminhtml/Customtab.php +12 -0
- app/code/local/Tatva/Customtab/Block/Adminhtml/Customtab/Edit.php +45 -0
- app/code/local/Tatva/Customtab/Block/Adminhtml/Customtab/Edit/Form.php +19 -0
- app/code/local/Tatva/Customtab/Block/Adminhtml/Customtab/Edit/Tab/Form.php +58 -0
- app/code/local/Tatva/Customtab/Block/Adminhtml/Customtab/Edit/Tabs.php +24 -0
- app/code/local/Tatva/Customtab/Block/Adminhtml/Customtab/Grid.php +116 -0
- app/code/local/Tatva/Customtab/Block/Customtab.php +17 -0
- app/code/local/Tatva/Customtab/Helper/Data.php +6 -0
- app/code/local/Tatva/Customtab/Model/Customtab.php +10 -0
- app/code/local/Tatva/Customtab/Model/Mysql4/Customtab.php +10 -0
- app/code/local/Tatva/Customtab/Model/Mysql4/Customtab/Collection.php +10 -0
- app/code/local/Tatva/Customtab/Model/Status.php +15 -0
- app/code/local/Tatva/Customtab/controllers/Adminhtml/CustomtabController.php +214 -0
- app/code/local/Tatva/Customtab/controllers/IndexController.php +42 -0
- app/code/local/Tatva/Customtab/etc/adminhtml.xml +43 -0
- app/code/local/Tatva/Customtab/etc/config.xml +120 -0
- app/code/local/Tatva/Customtab/sql/customtab_setup/mysql4-install-0.1.0.php +23 -0
- app/code/local/Tatva/Downloadablereport/Block/Adminhtml/Downloadablereport.php +12 -0
- app/code/local/Tatva/Downloadablereport/Block/Adminhtml/Downloadablereport/Edit.php +45 -0
- app/code/local/Tatva/Downloadablereport/Block/Adminhtml/Downloadablereport/Edit/Form.php +19 -0
- app/code/local/Tatva/Downloadablereport/Block/Adminhtml/Downloadablereport/Edit/Tab/Form.php +58 -0
- app/code/local/Tatva/Downloadablereport/Block/Adminhtml/Downloadablereport/Edit/Tabs.php +24 -0
- app/code/local/Tatva/Downloadablereport/Block/Adminhtml/Downloadablereport/Grid.php +116 -0
- app/code/local/Tatva/Downloadablereport/Block/Downloadablereport.php +17 -0
- app/code/local/Tatva/Downloadablereport/Helper/Data.php +6 -0
- app/code/local/Tatva/Downloadablereport/Model/Downloadablereport.php +10 -0
- app/code/local/Tatva/Downloadablereport/Model/Mysql4/Downloadablereport.php +10 -0
- app/code/local/Tatva/Downloadablereport/Model/Mysql4/Downloadablereport/Collection.php +10 -0
- app/code/local/Tatva/Downloadablereport/Model/Status.php +15 -0
- app/code/local/Tatva/Downloadablereport/controllers/Adminhtml/DownloadablereportController.php +214 -0
- app/code/local/Tatva/Downloadablereport/controllers/IndexController.php +47 -0
- app/code/local/Tatva/Downloadablereport/etc/config.xml +120 -0
- app/code/local/Tatva/Downloadablereport/sql/downloadablereport_setup/mysql4-install-0.1.0.php +23 -0
- app/code/local/Tatva/Editorder/Block/Adminhtml/Editorder.php +12 -0
- app/code/local/Tatva/Editorder/Block/Adminhtml/Editorder/Edit.php +45 -0
- app/code/local/Tatva/Editorder/Block/Adminhtml/Editorder/Edit/Form.php +19 -0
- app/code/local/Tatva/Editorder/Block/Adminhtml/Editorder/Edit/Tab/Form.php +58 -0
- app/code/local/Tatva/Editorder/Block/Adminhtml/Editorder/Edit/Tabs.php +24 -0
- app/code/local/Tatva/Editorder/Block/Adminhtml/Editorder/Grid.php +116 -0
- app/code/local/Tatva/Editorder/Block/Editorder.php +17 -0
- app/code/local/Tatva/Editorder/Helper/Data.php +6 -0
- app/code/local/Tatva/Editorder/Model/Editorder.php +10 -0
- app/code/local/Tatva/Editorder/Model/Mysql4/Editorder.php +10 -0
- app/code/local/Tatva/Editorder/Model/Mysql4/Editorder/Collection.php +10 -0
- app/code/local/Tatva/Editorder/Model/Status.php +15 -0
- app/code/local/Tatva/Editorder/controllers/Adminhtml/EditorderController.php +214 -0
- app/code/local/Tatva/Editorder/controllers/IndexController.php +47 -0
- app/code/local/Tatva/Editorder/etc/config.xml +120 -0
- app/code/local/Tatva/Editorder/sql/editorder_setup/mysql4-install-0.1.0.php +23 -0
- app/code/local/Tatva/Gallery/Block/Adminhtml/Gallery.php +12 -0
- app/code/local/Tatva/Gallery/Block/Adminhtml/Gallery/Edit.php +45 -0
- app/code/local/Tatva/Gallery/Block/Adminhtml/Gallery/Edit/Form.php +19 -0
- app/code/local/Tatva/Gallery/Block/Adminhtml/Gallery/Edit/Tab/Form.php +58 -0
- app/code/local/Tatva/Gallery/Block/Adminhtml/Gallery/Edit/Tabs.php +24 -0
- app/code/local/Tatva/Gallery/Block/Adminhtml/Gallery/Grid.php +116 -0
- app/code/local/Tatva/Gallery/Block/Gallery.php +17 -0
- app/code/local/Tatva/Gallery/Helper/Data.php +6 -0
- app/code/local/Tatva/Gallery/Model/Gallery.php +10 -0
- app/code/local/Tatva/Gallery/Model/Mysql4/Gallery.php +10 -0
- app/code/local/Tatva/Gallery/Model/Mysql4/Gallery/Collection.php +10 -0
- app/code/local/Tatva/Gallery/Model/Status.php +15 -0
- app/code/local/Tatva/Gallery/controllers/Adminhtml/GalleryController.php +214 -0
- app/code/local/Tatva/Gallery/controllers/IndexController.php +47 -0
- app/code/local/Tatva/Gallery/etc/config.xml +120 -0
- app/code/local/Tatva/Gallery/sql/gallery_setup/mysql4-install-0.1.0.php +23 -0
- app/code/local/Tatva/Orderreport/Block/Adminhtml/Orderreport.php +12 -0
- app/code/local/Tatva/Orderreport/Block/Adminhtml/Orderreport/Edit.php +45 -0
- app/code/local/Tatva/Orderreport/Block/Adminhtml/Orderreport/Edit/Form.php +19 -0
- app/code/local/Tatva/Orderreport/Block/Adminhtml/Orderreport/Edit/Tab/Form.php +58 -0
- app/code/local/Tatva/Orderreport/Block/Adminhtml/Orderreport/Edit/Tabs.php +24 -0
- app/code/local/Tatva/Orderreport/Block/Adminhtml/Orderreport/Grid.php +116 -0
- app/code/local/Tatva/Orderreport/Block/Orderreport.php +17 -0
- app/code/local/Tatva/Orderreport/Helper/Data.php +6 -0
- app/code/local/Tatva/Orderreport/Model/Mysql4/Orderreport.php +10 -0
- app/code/local/Tatva/Orderreport/Model/Mysql4/Orderreport/Collection.php +10 -0
- app/code/local/Tatva/Orderreport/Model/Orderreport.php +10 -0
- app/code/local/Tatva/Orderreport/Model/Status.php +15 -0
- app/code/local/Tatva/Orderreport/controllers/Adminhtml/OrderreportController.php +214 -0
- app/code/local/Tatva/Orderreport/controllers/IndexController.php +47 -0
- app/code/local/Tatva/Orderreport/etc/config.xml +120 -0
- app/code/local/Tatva/Orderreport/sql/orderreport_setup/mysql4-install-0.1.0.php +23 -0
- app/code/local/Tatva/Press/Block/Adminhtml/Press.php +17 -0
- app/code/local/Tatva/Press/Block/Adminhtml/Press/Edit.php +50 -0
- app/code/local/Tatva/Press/Block/Adminhtml/Press/Edit/Form.php +19 -0
- app/code/local/Tatva/Press/Block/Adminhtml/Press/Edit/Tab/Form.php +149 -0
- app/code/local/Tatva/Press/Block/Adminhtml/Press/Edit/Tabs.php +26 -0
- app/code/local/Tatva/Press/Block/Adminhtml/Press/Grid.php +116 -0
- app/code/local/Tatva/Press/Block/Press.php +31 -0
- app/code/local/Tatva/Press/Helper/Data.php +6 -0
- app/code/local/Tatva/Press/Model/Mysql4/Press.php +48 -0
- app/code/local/Tatva/Press/Model/Mysql4/Press/Collection.php +10 -0
- app/code/local/Tatva/Press/Model/Mysql4/Press_store.php +10 -0
- app/code/local/Tatva/Press/Model/Mysql4/Press_store/Collection.php +10 -0
- app/code/local/Tatva/Press/Model/Press.php +10 -0
- app/code/local/Tatva/Press/Model/Press_store.php +10 -0
- app/code/local/Tatva/Press/Model/Status.php +15 -0
- app/code/local/Tatva/Press/controllers/Adminhtml/PressController.php +275 -0
- app/code/local/Tatva/Press/controllers/IndexController.php +35 -0
- app/code/local/Tatva/Press/etc/adminhtml.xml +51 -0
- app/code/local/Tatva/Press/etc/config.xml +151 -0
- app/code/local/Tatva/Press/etc/system.xml +114 -0
- app/code/local/Tatva/Press/sql/press_setup/mysql4-install-0.1.0.php +21 -0
- app/code/local/Tatva/Press/sql/press_setup/mysql4-upgrade-0.1.0-0.1.1.php +15 -0
- app/code/local/Tatva/Press/sql/press_setup/mysql4-upgrade-0.1.1-0.1.2.php +20 -0
- app/code/local/Tatva/Promotionalbanner/Block/Adminhtml/Promotionalbanner.php +12 -0
- app/code/local/Tatva/Promotionalbanner/Block/Adminhtml/Promotionalbanner/Edit.php +45 -0
- app/code/local/Tatva/Promotionalbanner/Block/Adminhtml/Promotionalbanner/Edit/Form.php +19 -0
- app/code/local/Tatva/Promotionalbanner/Block/Adminhtml/Promotionalbanner/Edit/Tab/Form.php +71 -0
- app/code/local/Tatva/Promotionalbanner/Block/Adminhtml/Promotionalbanner/Edit/Tabs.php +24 -0
- app/code/local/Tatva/Promotionalbanner/Block/Adminhtml/Promotionalbanner/Grid.php +116 -0
- app/code/local/Tatva/Promotionalbanner/Block/Promotionalbanner.php +17 -0
- app/code/local/Tatva/Promotionalbanner/Helper/Data.php +6 -0
- app/code/local/Tatva/Promotionalbanner/Model/Mysql4/Promotionalbanner.php +10 -0
- app/code/local/Tatva/Promotionalbanner/Model/Mysql4/Promotionalbanner/Collection.php +10 -0
- app/code/local/Tatva/Promotionalbanner/Model/Promotionalbanner.php +10 -0
- app/code/local/Tatva/Promotionalbanner/Model/Status.php +15 -0
- app/code/local/Tatva/Promotionalbanner/controllers/Adminhtml/PromotionalbannerController.php +214 -0
- app/code/local/Tatva/Promotionalbanner/controllers/IndexController.php +47 -0
- app/code/local/Tatva/Promotionalbanner/etc/config.xml +120 -0
- app/code/local/Tatva/Promotionalbanner/sql/promotionalbanner_setup/mysql4-install-0.1.0.php +24 -0
- app/code/local/Tatva/Slider/Block/Adminhtml/Slider/Edit/Tabs.php +1 -1
- app/code/local/Tatva/Slider/etc/adminhtml.xml +5 -0
- app/code/local/Tatva/Slider/etc/config.xml +5 -0
- app/design/frontend/default/default/template/slider/slider.phtml +19 -11
- package.xml +4 -4
app/code/local/Tatva/Attachpdf/Block/Adminhtml/Attachpdf.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Tatva_Attachpdf_Block_Adminhtml_Attachpdf extends Mage_Adminhtml_Block_Widget_Grid_Container
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
$this->_controller = 'adminhtml_attachpdf';
|
7 |
+
$this->_blockGroup = 'attachpdf';
|
8 |
+
$this->_headerText = Mage::helper('attachpdf')->__('Item Manager');
|
9 |
+
$this->_addButtonLabel = Mage::helper('attachpdf')->__('Add Item');
|
10 |
+
parent::__construct();
|
11 |
+
}
|
12 |
+
}
|
app/code/local/Tatva/Attachpdf/Block/Adminhtml/Attachpdf/Edit.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Attachpdf_Block_Adminhtml_Attachpdf_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 = 'attachpdf';
|
11 |
+
$this->_controller = 'adminhtml_attachpdf';
|
12 |
+
|
13 |
+
$this->_updateButton('save', 'label', Mage::helper('attachpdf')->__('Save Item'));
|
14 |
+
$this->_updateButton('delete', 'label', Mage::helper('attachpdf')->__('Delete Item'));
|
15 |
+
|
16 |
+
$this->_addButton('saveandcontinue', array(
|
17 |
+
'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
|
18 |
+
'onclick' => 'saveAndContinueEdit()',
|
19 |
+
'class' => 'save',
|
20 |
+
), -100);
|
21 |
+
|
22 |
+
$this->_formScripts[] = "
|
23 |
+
function toggleEditor() {
|
24 |
+
if (tinyMCE.getInstanceById('attachpdf_content') == null) {
|
25 |
+
tinyMCE.execCommand('mceAddControl', false, 'attachpdf_content');
|
26 |
+
} else {
|
27 |
+
tinyMCE.execCommand('mceRemoveControl', false, 'attachpdf_content');
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
function saveAndContinueEdit(){
|
32 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
33 |
+
}
|
34 |
+
";
|
35 |
+
}
|
36 |
+
|
37 |
+
public function getHeaderText()
|
38 |
+
{
|
39 |
+
if( Mage::registry('attachpdf_data') && Mage::registry('attachpdf_data')->getId() ) {
|
40 |
+
return Mage::helper('attachpdf')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('attachpdf_data')->getTitle()));
|
41 |
+
} else {
|
42 |
+
return Mage::helper('attachpdf')->__('Add Item');
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
app/code/local/Tatva/Attachpdf/Block/Adminhtml/Attachpdf/Edit/Form.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Attachpdf_Block_Adminhtml_Attachpdf_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
4 |
+
{
|
5 |
+
protected function _prepareForm()
|
6 |
+
{
|
7 |
+
$form = new Varien_Data_Form(array(
|
8 |
+
'id' => 'edit_form',
|
9 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
10 |
+
'method' => 'post',
|
11 |
+
'enctype' => 'multipart/form-data'
|
12 |
+
)
|
13 |
+
);
|
14 |
+
|
15 |
+
$form->setUseContainer(true);
|
16 |
+
$this->setForm($form);
|
17 |
+
return parent::_prepareForm();
|
18 |
+
}
|
19 |
+
}
|
app/code/local/Tatva/Attachpdf/Block/Adminhtml/Attachpdf/Edit/Tab/Form.php
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Attachpdf_Block_Adminhtml_Attachpdf_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('attachpdf_form', array('legend'=>Mage::helper('attachpdf')->__('Item information')));
|
10 |
+
|
11 |
+
$fieldset->addField('title', 'text', array(
|
12 |
+
'label' => Mage::helper('attachpdf')->__('Title'),
|
13 |
+
'class' => 'required-entry',
|
14 |
+
'required' => true,
|
15 |
+
'name' => 'title',
|
16 |
+
));
|
17 |
+
|
18 |
+
$fieldset->addField('filename', 'file', array(
|
19 |
+
'label' => Mage::helper('attachpdf')->__('File'),
|
20 |
+
'required' => false,
|
21 |
+
'name' => 'filename',
|
22 |
+
));
|
23 |
+
|
24 |
+
$fieldset->addField('status', 'select', array(
|
25 |
+
'label' => Mage::helper('attachpdf')->__('Status'),
|
26 |
+
'name' => 'status',
|
27 |
+
'values' => array(
|
28 |
+
array(
|
29 |
+
'value' => 1,
|
30 |
+
'label' => Mage::helper('attachpdf')->__('Enabled'),
|
31 |
+
),
|
32 |
+
|
33 |
+
array(
|
34 |
+
'value' => 2,
|
35 |
+
'label' => Mage::helper('attachpdf')->__('Disabled'),
|
36 |
+
),
|
37 |
+
),
|
38 |
+
));
|
39 |
+
|
40 |
+
$fieldset->addField('content', 'editor', array(
|
41 |
+
'name' => 'content',
|
42 |
+
'label' => Mage::helper('attachpdf')->__('Content'),
|
43 |
+
'title' => Mage::helper('attachpdf')->__('Content'),
|
44 |
+
'style' => 'width:700px; height:500px;',
|
45 |
+
'wysiwyg' => false,
|
46 |
+
'required' => true,
|
47 |
+
));
|
48 |
+
|
49 |
+
if ( Mage::getSingleton('adminhtml/session')->getAttachpdfData() )
|
50 |
+
{
|
51 |
+
$form->setValues(Mage::getSingleton('adminhtml/session')->getAttachpdfData());
|
52 |
+
Mage::getSingleton('adminhtml/session')->setAttachpdfData(null);
|
53 |
+
} elseif ( Mage::registry('attachpdf_data') ) {
|
54 |
+
$form->setValues(Mage::registry('attachpdf_data')->getData());
|
55 |
+
}
|
56 |
+
return parent::_prepareForm();
|
57 |
+
}
|
58 |
+
}
|
app/code/local/Tatva/Attachpdf/Block/Adminhtml/Attachpdf/Edit/Tabs.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Attachpdf_Block_Adminhtml_Attachpdf_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
4 |
+
{
|
5 |
+
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
parent::__construct();
|
9 |
+
$this->setId('attachpdf_tabs');
|
10 |
+
$this->setDestElementId('edit_form');
|
11 |
+
$this->setTitle(Mage::helper('attachpdf')->__('Item Information'));
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _beforeToHtml()
|
15 |
+
{
|
16 |
+
$this->addTab('form_section', array(
|
17 |
+
'label' => Mage::helper('attachpdf')->__('Item Information'),
|
18 |
+
'title' => Mage::helper('attachpdf')->__('Item Information'),
|
19 |
+
'content' => $this->getLayout()->createBlock('attachpdf/adminhtml_attachpdf_edit_tab_form')->toHtml(),
|
20 |
+
));
|
21 |
+
|
22 |
+
return parent::_beforeToHtml();
|
23 |
+
}
|
24 |
+
}
|
app/code/local/Tatva/Attachpdf/Block/Adminhtml/Attachpdf/Grid.php
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Attachpdf_Block_Adminhtml_Attachpdf_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->setId('attachpdfGrid');
|
9 |
+
$this->setDefaultSort('attachpdf_id');
|
10 |
+
$this->setDefaultDir('ASC');
|
11 |
+
$this->setSaveParametersInSession(true);
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _prepareCollection()
|
15 |
+
{
|
16 |
+
$collection = Mage::getModel('attachpdf/attachpdf')->getCollection();
|
17 |
+
$this->setCollection($collection);
|
18 |
+
return parent::_prepareCollection();
|
19 |
+
}
|
20 |
+
|
21 |
+
protected function _prepareColumns()
|
22 |
+
{
|
23 |
+
$this->addColumn('attachpdf_id', array(
|
24 |
+
'header' => Mage::helper('attachpdf')->__('ID'),
|
25 |
+
'align' =>'right',
|
26 |
+
'width' => '50px',
|
27 |
+
'index' => 'attachpdf_id',
|
28 |
+
));
|
29 |
+
|
30 |
+
$this->addColumn('title', array(
|
31 |
+
'header' => Mage::helper('attachpdf')->__('Title'),
|
32 |
+
'align' =>'left',
|
33 |
+
'index' => 'title',
|
34 |
+
));
|
35 |
+
|
36 |
+
/*
|
37 |
+
$this->addColumn('content', array(
|
38 |
+
'header' => Mage::helper('attachpdf')->__('Item Content'),
|
39 |
+
'width' => '150px',
|
40 |
+
'index' => 'content',
|
41 |
+
));
|
42 |
+
*/
|
43 |
+
|
44 |
+
$this->addColumn('status', array(
|
45 |
+
'header' => Mage::helper('attachpdf')->__('Status'),
|
46 |
+
'align' => 'left',
|
47 |
+
'width' => '80px',
|
48 |
+
'index' => 'status',
|
49 |
+
'type' => 'options',
|
50 |
+
'options' => array(
|
51 |
+
1 => 'Enabled',
|
52 |
+
2 => 'Disabled',
|
53 |
+
),
|
54 |
+
));
|
55 |
+
|
56 |
+
$this->addColumn('action',
|
57 |
+
array(
|
58 |
+
'header' => Mage::helper('attachpdf')->__('Action'),
|
59 |
+
'width' => '100',
|
60 |
+
'type' => 'action',
|
61 |
+
'getter' => 'getId',
|
62 |
+
'actions' => array(
|
63 |
+
array(
|
64 |
+
'caption' => Mage::helper('attachpdf')->__('Edit'),
|
65 |
+
'url' => array('base'=> '*/*/edit'),
|
66 |
+
'field' => 'id'
|
67 |
+
)
|
68 |
+
),
|
69 |
+
'filter' => false,
|
70 |
+
'sortable' => false,
|
71 |
+
'index' => 'stores',
|
72 |
+
'is_system' => true,
|
73 |
+
));
|
74 |
+
|
75 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('attachpdf')->__('CSV'));
|
76 |
+
$this->addExportType('*/*/exportXml', Mage::helper('attachpdf')->__('XML'));
|
77 |
+
|
78 |
+
return parent::_prepareColumns();
|
79 |
+
}
|
80 |
+
|
81 |
+
protected function _prepareMassaction()
|
82 |
+
{
|
83 |
+
$this->setMassactionIdField('attachpdf_id');
|
84 |
+
$this->getMassactionBlock()->setFormFieldName('attachpdf');
|
85 |
+
|
86 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
87 |
+
'label' => Mage::helper('attachpdf')->__('Delete'),
|
88 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
89 |
+
'confirm' => Mage::helper('attachpdf')->__('Are you sure?')
|
90 |
+
));
|
91 |
+
|
92 |
+
$statuses = Mage::getSingleton('attachpdf/status')->getOptionArray();
|
93 |
+
|
94 |
+
array_unshift($statuses, array('label'=>'', 'value'=>''));
|
95 |
+
$this->getMassactionBlock()->addItem('status', array(
|
96 |
+
'label'=> Mage::helper('attachpdf')->__('Change status'),
|
97 |
+
'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
|
98 |
+
'additional' => array(
|
99 |
+
'visibility' => array(
|
100 |
+
'name' => 'status',
|
101 |
+
'type' => 'select',
|
102 |
+
'class' => 'required-entry',
|
103 |
+
'label' => Mage::helper('attachpdf')->__('Status'),
|
104 |
+
'values' => $statuses
|
105 |
+
)
|
106 |
+
)
|
107 |
+
));
|
108 |
+
return $this;
|
109 |
+
}
|
110 |
+
|
111 |
+
public function getRowUrl($row)
|
112 |
+
{
|
113 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
114 |
+
}
|
115 |
+
|
116 |
+
}
|
app/code/local/Tatva/Attachpdf/Block/Attachpdf.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Tatva_Attachpdf_Block_Attachpdf extends Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
public function _prepareLayout()
|
5 |
+
{
|
6 |
+
return parent::_prepareLayout();
|
7 |
+
}
|
8 |
+
|
9 |
+
public function getAttachpdf()
|
10 |
+
{
|
11 |
+
if (!$this->hasData('attachpdf')) {
|
12 |
+
$this->setData('attachpdf', Mage::registry('attachpdf'));
|
13 |
+
}
|
14 |
+
return $this->getData('attachpdf');
|
15 |
+
|
16 |
+
}
|
17 |
+
}
|
app/code/local/Tatva/Attachpdf/Helper/Data.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Attachpdf_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
app/code/local/Tatva/Attachpdf/Model/Attachpdf.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Attachpdf_Model_Attachpdf extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('attachpdf/attachpdf');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Tatva/Attachpdf/Model/Mysql4/Attachpdf.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Attachpdf_Model_Mysql4_Attachpdf extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
// Note that the attachpdf_id refers to the key field in your database table.
|
8 |
+
$this->_init('attachpdf/attachpdf', 'attachpdf_id');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Tatva/Attachpdf/Model/Mysql4/Attachpdf/Collection.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Attachpdf_Model_Mysql4_Attachpdf_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('attachpdf/attachpdf');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Tatva/Attachpdf/Model/Status.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Attachpdf_Model_Status extends Varien_Object
|
4 |
+
{
|
5 |
+
const STATUS_ENABLED = 1;
|
6 |
+
const STATUS_DISABLED = 2;
|
7 |
+
|
8 |
+
static public function getOptionArray()
|
9 |
+
{
|
10 |
+
return array(
|
11 |
+
self::STATUS_ENABLED => Mage::helper('attachpdf')->__('Enabled'),
|
12 |
+
self::STATUS_DISABLED => Mage::helper('attachpdf')->__('Disabled')
|
13 |
+
);
|
14 |
+
}
|
15 |
+
}
|
app/code/local/Tatva/Attachpdf/controllers/IndexController.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Tatva_Attachpdf_IndexController extends Mage_Core_Controller_Front_Action
|
3 |
+
{
|
4 |
+
public function indexAction()
|
5 |
+
{
|
6 |
+
|
7 |
+
/*
|
8 |
+
* Load an object by id
|
9 |
+
* Request looking like:
|
10 |
+
* http://site.com/attachpdf?id=15
|
11 |
+
* or
|
12 |
+
* http://site.com/attachpdf/id/15
|
13 |
+
*/
|
14 |
+
/*
|
15 |
+
$attachpdf_id = $this->getRequest()->getParam('id');
|
16 |
+
|
17 |
+
if($attachpdf_id != null && $attachpdf_id != '') {
|
18 |
+
$attachpdf = Mage::getModel('attachpdf/attachpdf')->load($attachpdf_id)->getData();
|
19 |
+
} else {
|
20 |
+
$attachpdf = null;
|
21 |
+
}
|
22 |
+
*/
|
23 |
+
|
24 |
+
/*
|
25 |
+
* If no param we load a the last created item
|
26 |
+
*/
|
27 |
+
/*
|
28 |
+
if($attachpdf == null) {
|
29 |
+
$resource = Mage::getSingleton('core/resource');
|
30 |
+
$read= $resource->getConnection('core_read');
|
31 |
+
$attachpdfTable = $resource->getTableName('attachpdf');
|
32 |
+
|
33 |
+
$select = $read->select()
|
34 |
+
->from($attachpdfTable,array('attachpdf_id','title','content','status'))
|
35 |
+
->where('status',1)
|
36 |
+
->order('created_time DESC') ;
|
37 |
+
|
38 |
+
$attachpdf = $read->fetchRow($select);
|
39 |
+
}
|
40 |
+
Mage::register('attachpdf', $attachpdf);
|
41 |
+
*/
|
42 |
+
|
43 |
+
|
44 |
+
$this->loadLayout();
|
45 |
+
$this->renderLayout();
|
46 |
+
}
|
47 |
+
}
|
app/code/local/Tatva/Attachpdf/etc/config.xml
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Tatva_Attachpdf>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Tatva_Attachpdf>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<attachpdf>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Tatva_Attachpdf</module>
|
14 |
+
<frontName>attachpdf</frontName>
|
15 |
+
</args>
|
16 |
+
</attachpdf>
|
17 |
+
</routers>
|
18 |
+
<layout>
|
19 |
+
<updates>
|
20 |
+
<attachpdf>
|
21 |
+
<file>attachpdf.xml</file>
|
22 |
+
</attachpdf>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
</frontend>
|
26 |
+
<global>
|
27 |
+
<blocks>
|
28 |
+
<attachpdf>
|
29 |
+
<class>Tatva_Attachpdf_Block</class>
|
30 |
+
</attachpdf>
|
31 |
+
</blocks>
|
32 |
+
</global>
|
33 |
+
</config>
|
app/code/local/Tatva/Catalogextensions/Block/Allproducts/List.php
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* To change this template, choose Tools | Templates
|
5 |
+
* and open the template in the editor.
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Description of List
|
10 |
+
*
|
11 |
+
* @author om
|
12 |
+
*/
|
13 |
+
class Tatva_Catalogextensions_Block_Allproducts_List extends Mage_Catalog_Block_Product_List {
|
14 |
+
|
15 |
+
protected function _getProductCollection()
|
16 |
+
{
|
17 |
+
parent::__construct();
|
18 |
+
|
19 |
+
$storeId = Mage::app()->getStore()->getId();
|
20 |
+
$products = Mage::getModel('catalog/product')->getCollection()
|
21 |
+
->addAttributeToSelect('*')
|
22 |
+
->setStoreId($storeId)
|
23 |
+
->addStoreFilter($storeId)
|
24 |
+
->setPageSize($this->get_prod_count())
|
25 |
+
->addAttributeToSort($this->get_order(), $this->get_order_dir())
|
26 |
+
->setCurPage($this->get_cur_page());
|
27 |
+
|
28 |
+
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
|
29 |
+
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);
|
30 |
+
Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($products);
|
31 |
+
|
32 |
+
$this->_productCollection = $products;
|
33 |
+
|
34 |
+
return $this->_productCollection;
|
35 |
+
}
|
36 |
+
|
37 |
+
function get_order()
|
38 |
+
{
|
39 |
+
//unset any saved limits
|
40 |
+
return (isset($_REQUEST['order'])) ? $_REQUEST['order'] : "entity_id";
|
41 |
+
}// get_prod_count
|
42 |
+
|
43 |
+
function get_order_dir()
|
44 |
+
{
|
45 |
+
//unset any saved limits
|
46 |
+
return (isset($_REQUEST['dir'])) ? $_REQUEST['dir'] : "asc";
|
47 |
+
}// get_prod_count
|
48 |
+
|
49 |
+
|
50 |
+
function get_prod_count()
|
51 |
+
{
|
52 |
+
//unset any saved limits
|
53 |
+
Mage::getSingleton('catalog/session')->unsLimitPage();
|
54 |
+
return (isset($_REQUEST['limit'])) ? intval($_REQUEST['limit']) : 12;
|
55 |
+
}// get_prod_count
|
56 |
+
|
57 |
+
function get_cur_page()
|
58 |
+
{
|
59 |
+
return (isset($_REQUEST['p'])) ? intval($_REQUEST['p']) : 1;
|
60 |
+
}// get_cur_page
|
61 |
+
|
62 |
+
|
63 |
+
}
|
64 |
+
|
65 |
+
?>
|
app/code/local/Tatva/Catalogextensions/Block/Bestsellers/Home/List.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* To change this template, choose Tools | Templates
|
5 |
+
* and open the template in the editor.
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Description of List
|
10 |
+
*
|
11 |
+
* @author om
|
12 |
+
*/
|
13 |
+
class Tatva_Catalogextensions_Block_Bestsellers_Home_List extends Tatva_Catalogextensions_Block_Bestsellers_List
|
14 |
+
{
|
15 |
+
|
16 |
+
protected function _getProductCollection()
|
17 |
+
{
|
18 |
+
parent::__construct();
|
19 |
+
$storeId = Mage::app()->getStore()->getId();
|
20 |
+
$products = Mage::getResourceModel('reports/product_collection')
|
21 |
+
->addOrderedQty()
|
22 |
+
->addAttributeToSelect('*')
|
23 |
+
->setStoreId($storeId)
|
24 |
+
->addStoreFilter($storeId)
|
25 |
+
->setOrder('ordered_qty', 'desc');
|
26 |
+
|
27 |
+
if(Mage::getStoreConfig('catalogextensions/config1/max_product'))
|
28 |
+
{
|
29 |
+
$products->setPageSize(Mage::getStoreConfig('catalogextensions/config1/max_product'));
|
30 |
+
}
|
31 |
+
|
32 |
+
|
33 |
+
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
|
34 |
+
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);
|
35 |
+
Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($products);
|
36 |
+
|
37 |
+
$this->_productCollection = $products;
|
38 |
+
|
39 |
+
return $this->_productCollection;
|
40 |
+
}
|
41 |
+
|
42 |
+
function get_prod_count()
|
43 |
+
{
|
44 |
+
//unset any saved limits
|
45 |
+
Mage::getSingleton('catalog/session')->unsLimitPage();
|
46 |
+
return (isset($_REQUEST['limit'])) ? intval($_REQUEST['limit']) : 9;
|
47 |
+
}// get_prod_count
|
48 |
+
|
49 |
+
function get_cur_page()
|
50 |
+
{
|
51 |
+
return (isset($_REQUEST['p'])) ? intval($_REQUEST['p']) : 1;
|
52 |
+
}// get_cur_page
|
53 |
+
|
54 |
+
function get_order()
|
55 |
+
{
|
56 |
+
return (isset($_REQUEST['order'])) ? ($_REQUEST['order']) : 'ordered_qty';
|
57 |
+
}// get_order
|
58 |
+
|
59 |
+
function get_order_dir()
|
60 |
+
{
|
61 |
+
return (isset($_REQUEST['dir'])) ? ($_REQUEST['dir']) : 'desc';
|
62 |
+
}// get_direction
|
63 |
+
|
64 |
+
public function getToolbarHtml()
|
65 |
+
{
|
66 |
+
|
67 |
+
}
|
68 |
+
}
|
app/code/local/Tatva/Catalogextensions/Block/Bestsellers/List.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* To change this template, choose Tools | Templates
|
5 |
+
* and open the template in the editor.
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Description of List
|
10 |
+
*
|
11 |
+
* @author om
|
12 |
+
*/
|
13 |
+
class Tatva_Catalogextensions_Block_Bestsellers_List extends Mage_Catalog_Block_Product_List
|
14 |
+
{
|
15 |
+
protected function _getProductCollection()
|
16 |
+
{
|
17 |
+
parent::__construct();
|
18 |
+
$storeId = Mage::app()->getStore()->getId();
|
19 |
+
$products = Mage::getResourceModel('reports/product_collection')
|
20 |
+
->addOrderedQty()
|
21 |
+
->addAttributeToSelect('*')
|
22 |
+
->setStoreId($storeId)
|
23 |
+
->addStoreFilter($storeId)
|
24 |
+
//->setOrder('ordered_qty', 'desc')
|
25 |
+
->setPageSize($this->get_prod_count())
|
26 |
+
->setOrder($this->get_order(), $this->get_order_dir())
|
27 |
+
->setCurPage($this->get_cur_page());
|
28 |
+
|
29 |
+
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
|
30 |
+
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);
|
31 |
+
Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($products);
|
32 |
+
|
33 |
+
$this->_productCollection = $products;
|
34 |
+
|
35 |
+
return $this->_productCollection;
|
36 |
+
}
|
37 |
+
|
38 |
+
function get_prod_count()
|
39 |
+
{
|
40 |
+
//unset any saved limits
|
41 |
+
Mage::getSingleton('catalog/session')->unsLimitPage();
|
42 |
+
return (isset($_REQUEST['limit'])) ? intval($_REQUEST['limit']) : 9;
|
43 |
+
}// get_prod_count
|
44 |
+
|
45 |
+
function get_cur_page()
|
46 |
+
{
|
47 |
+
return (isset($_REQUEST['p'])) ? intval($_REQUEST['p']) : 1;
|
48 |
+
}// get_cur_page
|
49 |
+
|
50 |
+
function get_order()
|
51 |
+
{
|
52 |
+
return (isset($_REQUEST['order'])) ? ($_REQUEST['order']) : 'ordered_qty';
|
53 |
+
}// get_order
|
54 |
+
|
55 |
+
function get_order_dir()
|
56 |
+
{
|
57 |
+
return (isset($_REQUEST['dir'])) ? ($_REQUEST['dir']) : 'desc';
|
58 |
+
}// get_direction
|
59 |
+
}
|
60 |
+
|
61 |
+
?>
|
app/code/local/Tatva/Catalogextensions/Block/Catalogextensions.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Tatva_Catalogextensions_Block_Catalogextensions extends Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
public function _prepareLayout()
|
5 |
+
{
|
6 |
+
return parent::_prepareLayout();
|
7 |
+
}
|
8 |
+
|
9 |
+
public function getCatalogextensions()
|
10 |
+
{
|
11 |
+
if (!$this->hasData('catalogextensions')) {
|
12 |
+
$this->setData('catalogextensions', Mage::registry('catalogextensions'));
|
13 |
+
}
|
14 |
+
return $this->getData('catalogextensions');
|
15 |
+
|
16 |
+
}
|
17 |
+
}
|
app/code/local/Tatva/Catalogextensions/Block/Featured/Home/List.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* To change this template, choose Tools | Templates
|
5 |
+
* and open the template in the editor.
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Description of List
|
10 |
+
*
|
11 |
+
* @author om
|
12 |
+
*/
|
13 |
+
class Tatva_Catalogextensions_Block_Featured_Home_List extends Tatva_Catalogextensions_Block_Featured_List
|
14 |
+
{
|
15 |
+
protected function _getProductCollection()
|
16 |
+
{
|
17 |
+
parent::__construct();
|
18 |
+
$storeId = Mage::app()->getStore()->getId();
|
19 |
+
$products = Mage::getModel('catalog/product')->getCollection()
|
20 |
+
->addAttributeToFilter(array(array('attribute' => 'featured', 'eq' => '1')))
|
21 |
+
->addAttributeToSelect('*')
|
22 |
+
->addAttributeToSelect(array('name', 'price', 'small_image'))
|
23 |
+
->setStoreId($storeId)
|
24 |
+
->addStoreFilter($storeId);
|
25 |
+
|
26 |
+
if(Mage::getStoreConfig('catalogextensions/config2/max_product'))
|
27 |
+
{
|
28 |
+
$products->setPageSize(Mage::getStoreConfig('catalogextensions/config2/max_product'));
|
29 |
+
}
|
30 |
+
|
31 |
+
|
32 |
+
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
|
33 |
+
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);
|
34 |
+
Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($products);
|
35 |
+
|
36 |
+
$this->_productCollection = $products;
|
37 |
+
|
38 |
+
return $this->_productCollection;
|
39 |
+
}
|
40 |
+
|
41 |
+
function get_prod_count()
|
42 |
+
{
|
43 |
+
//unset any saved limits
|
44 |
+
Mage::getSingleton('catalog/session')->unsLimitPage();
|
45 |
+
return (isset($_REQUEST['limit'])) ? intval($_REQUEST['limit']) : 9;
|
46 |
+
}// get_prod_count
|
47 |
+
|
48 |
+
function get_cur_page()
|
49 |
+
{
|
50 |
+
return (isset($_REQUEST['p'])) ? intval($_REQUEST['p']) : 1;
|
51 |
+
}// get_cur_page
|
52 |
+
|
53 |
+
function get_order()
|
54 |
+
{
|
55 |
+
return (isset($_REQUEST['order'])) ? ($_REQUEST['order']) : 'ordered_qty';
|
56 |
+
}// get_order
|
57 |
+
|
58 |
+
function get_order_dir()
|
59 |
+
{
|
60 |
+
return (isset($_REQUEST['dir'])) ? ($_REQUEST['dir']) : 'desc';
|
61 |
+
}// get_direction
|
62 |
+
|
63 |
+
public function getToolbarHtml()
|
64 |
+
{
|
65 |
+
|
66 |
+
}
|
67 |
+
}
|
app/code/local/Tatva/Catalogextensions/Block/Featured/List.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* To change this template, choose Tools | Templates
|
5 |
+
* and open the template in the editor.
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Description of List
|
10 |
+
*
|
11 |
+
* @author om
|
12 |
+
*/
|
13 |
+
class Tatva_Catalogextensions_Block_Featured_List extends Mage_Catalog_Block_Product_List
|
14 |
+
{
|
15 |
+
protected function _getProductCollection()
|
16 |
+
{
|
17 |
+
parent::__construct();
|
18 |
+
$storeId = Mage::app()->getStore()->getId();
|
19 |
+
$products = Mage::getModel('catalog/product')->getCollection()
|
20 |
+
->addAttributeToFilter(array(array('attribute' => 'featured', 'eq' => '1')))
|
21 |
+
->addAttributeToSelect('*')
|
22 |
+
->setStoreId($storeId)
|
23 |
+
->addStoreFilter($storeId)
|
24 |
+
->setPageSize($this->get_prod_count())
|
25 |
+
->addAttributeToSort($this->get_order(), $this->get_order_dir())
|
26 |
+
->setCurPage($this->get_cur_page());
|
27 |
+
|
28 |
+
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
|
29 |
+
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);
|
30 |
+
Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($products);
|
31 |
+
|
32 |
+
$this->_productCollection = $products;
|
33 |
+
|
34 |
+
return $this->_productCollection;
|
35 |
+
}
|
36 |
+
|
37 |
+
function get_prod_count()
|
38 |
+
{
|
39 |
+
//unset any saved limits
|
40 |
+
Mage::getSingleton('catalog/session')->unsLimitPage();
|
41 |
+
return (isset($_REQUEST['limit'])) ? intval($_REQUEST['limit']) : 9;
|
42 |
+
}// get_prod_count
|
43 |
+
|
44 |
+
function get_cur_page()
|
45 |
+
{
|
46 |
+
return (isset($_REQUEST['p'])) ? intval($_REQUEST['p']) : 1;
|
47 |
+
}// get_cur_page
|
48 |
+
|
49 |
+
function get_order()
|
50 |
+
{
|
51 |
+
return (isset($_REQUEST['order'])) ? ($_REQUEST['order']) : 'position';
|
52 |
+
}// get_order
|
53 |
+
|
54 |
+
function get_order_dir()
|
55 |
+
{
|
56 |
+
return (isset($_REQUEST['dir'])) ? ($_REQUEST['dir']) : 'desc';
|
57 |
+
}// get_direction
|
58 |
+
}
|
59 |
+
|
60 |
+
?>
|
app/code/local/Tatva/Catalogextensions/Block/Mostviewed/Home/List.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* To change this template, choose Tools | Templates
|
5 |
+
* and open the template in the editor.
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Description of List
|
10 |
+
*
|
11 |
+
* @author om
|
12 |
+
*/
|
13 |
+
class Tatva_Catalogextensions_Block_Mostviewed_Home_List extends Tatva_Catalogextensions_Block_Mostviewed_List
|
14 |
+
{
|
15 |
+
|
16 |
+
protected function _getProductCollection()
|
17 |
+
{
|
18 |
+
parent::__construct();
|
19 |
+
$storeId = Mage::app()->getStore()->getId();
|
20 |
+
$products = Mage::getResourceModel('reports/product_collection')
|
21 |
+
->addAttributeToSelect('*')
|
22 |
+
->addAttributeToSelect(array('name', 'price', 'small_image'))
|
23 |
+
->setStoreId($storeId)
|
24 |
+
->addStoreFilter($storeId)
|
25 |
+
->addViewsCount();
|
26 |
+
|
27 |
+
if(Mage::getStoreConfig('catalogextensions/config3/max_product'))
|
28 |
+
{
|
29 |
+
$products->setPageSize(Mage::getStoreConfig('catalogextensions/config3/max_product'));
|
30 |
+
}
|
31 |
+
|
32 |
+
|
33 |
+
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
|
34 |
+
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);
|
35 |
+
Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($products);
|
36 |
+
|
37 |
+
$this->_productCollection = $products;
|
38 |
+
|
39 |
+
return $this->_productCollection;
|
40 |
+
}
|
41 |
+
|
42 |
+
function get_prod_count()
|
43 |
+
{
|
44 |
+
//unset any saved limits
|
45 |
+
Mage::getSingleton('catalog/session')->unsLimitPage();
|
46 |
+
return (isset($_REQUEST['limit'])) ? intval($_REQUEST['limit']) : 9;
|
47 |
+
}// get_prod_count
|
48 |
+
|
49 |
+
function get_cur_page()
|
50 |
+
{
|
51 |
+
return (isset($_REQUEST['p'])) ? intval($_REQUEST['p']) : 1;
|
52 |
+
}// get_cur_page
|
53 |
+
|
54 |
+
function get_order()
|
55 |
+
{
|
56 |
+
return (isset($_REQUEST['order'])) ? ($_REQUEST['order']) : 'views';
|
57 |
+
}// get_order
|
58 |
+
|
59 |
+
function get_order_dir()
|
60 |
+
{
|
61 |
+
return (isset($_REQUEST['dir'])) ? ($_REQUEST['dir']) : 'desc';
|
62 |
+
}// get_direction
|
63 |
+
|
64 |
+
public function getToolbarHtml()
|
65 |
+
{
|
66 |
+
|
67 |
+
}
|
68 |
+
}
|
app/code/local/Tatva/Catalogextensions/Block/Mostviewed/List.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* To change this template, choose Tools | Templates
|
5 |
+
* and open the template in the editor.
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Description of List
|
10 |
+
*
|
11 |
+
* @author om
|
12 |
+
*/
|
13 |
+
class Tatva_Catalogextensions_Block_Mostviewed_List extends Mage_Catalog_Block_Product_List
|
14 |
+
{
|
15 |
+
protected function _getProductCollection()
|
16 |
+
{
|
17 |
+
parent::__construct();
|
18 |
+
$storeId = Mage::app()->getStore()->getId();
|
19 |
+
$products = Mage::getResourceModel('reports/product_collection')
|
20 |
+
->addAttributeToSelect('*')
|
21 |
+
->setStoreId($storeId)
|
22 |
+
->addStoreFilter($storeId)
|
23 |
+
->addViewsCount()
|
24 |
+
->setPageSize($this->get_prod_count())
|
25 |
+
->addAttributeToSort($this->get_order(), $this->get_order_dir())
|
26 |
+
->setCurPage($this->get_cur_page());
|
27 |
+
|
28 |
+
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
|
29 |
+
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);
|
30 |
+
Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($products);
|
31 |
+
|
32 |
+
$this->_productCollection = $products;
|
33 |
+
|
34 |
+
return $this->_productCollection;
|
35 |
+
}
|
36 |
+
|
37 |
+
|
38 |
+
function get_prod_count()
|
39 |
+
{
|
40 |
+
//unset any saved limits
|
41 |
+
Mage::getSingleton('catalog/session')->unsLimitPage();
|
42 |
+
return (isset($_REQUEST['limit'])) ? intval($_REQUEST['limit']) : 9;
|
43 |
+
}// get_prod_count
|
44 |
+
|
45 |
+
function get_cur_page()
|
46 |
+
{
|
47 |
+
return (isset($_REQUEST['p'])) ? intval($_REQUEST['p']) : 1;
|
48 |
+
}// get_cur_page
|
49 |
+
|
50 |
+
function get_order()
|
51 |
+
{
|
52 |
+
return (isset($_REQUEST['order'])) ? ($_REQUEST['order']) : 'views';
|
53 |
+
}// get_order
|
54 |
+
|
55 |
+
function get_order_dir()
|
56 |
+
{
|
57 |
+
return (isset($_REQUEST['dir'])) ? ($_REQUEST['dir']) : 'desc';
|
58 |
+
}// get_direction
|
59 |
+
}
|
60 |
+
|
61 |
+
?>
|
app/code/local/Tatva/Catalogextensions/Block/Newproduct/Home/List.php
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* To change this template, choose Tools | Templates
|
5 |
+
* and open the template in the editor.
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Description of List
|
10 |
+
*
|
11 |
+
* @author om
|
12 |
+
*/
|
13 |
+
class Tatva_Catalogextensions_Block_Newproduct_Home_List extends Tatva_Catalogextensions_Block_Newproduct_List
|
14 |
+
{
|
15 |
+
|
16 |
+
protected function _getProductCollection()
|
17 |
+
{
|
18 |
+
parent::__construct();
|
19 |
+
$storeId = Mage::app()->getStore()->getId();
|
20 |
+
$todayDate = Mage::app()->getLocale()->date()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
|
21 |
+
|
22 |
+
$products = Mage::getModel('catalog/product')->getCollection()
|
23 |
+
->addAttributeToSelect('*')
|
24 |
+
->addAttributeToSort("entity_id","DESC")
|
25 |
+
->addAttributeToSelect(array('name', 'price', 'small_image'))
|
26 |
+
->setVisibility(Mage::getSingleton('catalog/product_visibility')->getVisibleInSiteIds())
|
27 |
+
->setOrder($this->get_order(), $this->get_order_dir());
|
28 |
+
if(Mage::getStoreConfig('catalogextensions/config4/max_product'))
|
29 |
+
{
|
30 |
+
$products->setPageSize(Mage::getStoreConfig('catalogextensions/config4/max_product'));
|
31 |
+
}
|
32 |
+
|
33 |
+
|
34 |
+
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
|
35 |
+
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);
|
36 |
+
Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($products);
|
37 |
+
|
38 |
+
$this->_productCollection = $products;
|
39 |
+
|
40 |
+
return $this->_productCollection;
|
41 |
+
}
|
42 |
+
|
43 |
+
function get_prod_count()
|
44 |
+
{
|
45 |
+
//unset any saved limits
|
46 |
+
Mage::getSingleton('catalog/session')->unsLimitPage();
|
47 |
+
return (isset($_REQUEST['limit'])) ? intval($_REQUEST['limit']) : 9;
|
48 |
+
}// get_prod_count
|
49 |
+
|
50 |
+
function get_cur_page()
|
51 |
+
{
|
52 |
+
return (isset($_REQUEST['p'])) ? intval($_REQUEST['p']) : 1;
|
53 |
+
}// get_cur_page
|
54 |
+
|
55 |
+
function get_order()
|
56 |
+
{
|
57 |
+
return (isset($_REQUEST['order'])) ? ($_REQUEST['order']) : 'position';
|
58 |
+
}// get_order
|
59 |
+
|
60 |
+
function get_order_dir()
|
61 |
+
{
|
62 |
+
return (isset($_REQUEST['dir'])) ? ($_REQUEST['dir']) : 'desc';
|
63 |
+
}// get_direction
|
64 |
+
|
65 |
+
public function getToolbarHtml()
|
66 |
+
{
|
67 |
+
|
68 |
+
}
|
69 |
+
}
|
app/code/local/Tatva/Catalogextensions/Block/Newproduct/List.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* To change this template, choose Tools | Templates
|
5 |
+
* and open the template in the editor.
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Description of List
|
10 |
+
*
|
11 |
+
* @author om
|
12 |
+
*/
|
13 |
+
class Tatva_Catalogextensions_Block_Newproduct_List extends Mage_Catalog_Block_Product_List
|
14 |
+
{
|
15 |
+
|
16 |
+
protected function _getProductCollection()
|
17 |
+
{
|
18 |
+
parent::__construct();
|
19 |
+
|
20 |
+
$products = Mage::getModel('catalog/product')->getCollection()
|
21 |
+
->addAttributeToSort("entity_id","DESC")
|
22 |
+
->addAttributeToSelect(array('name', 'price', 'small_image'))
|
23 |
+
->setVisibility(Mage::getSingleton('catalog/product_visibility')->getVisibleInSiteIds())
|
24 |
+
->setPageSize($this->get_prod_count())
|
25 |
+
->addAttributeToSort($this->get_order(), $this->get_order_dir())
|
26 |
+
->setCurPage($this->get_cur_page());
|
27 |
+
|
28 |
+
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
|
29 |
+
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);
|
30 |
+
Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($products);
|
31 |
+
|
32 |
+
$this->_productCollection = $products;
|
33 |
+
|
34 |
+
return $this->_productCollection;
|
35 |
+
}
|
36 |
+
|
37 |
+
function get_prod_count()
|
38 |
+
{
|
39 |
+
//unset any saved limits
|
40 |
+
Mage::getSingleton('catalog/session')->unsLimitPage();
|
41 |
+
return (isset($_REQUEST['limit'])) ? intval($_REQUEST['limit']) : 9;
|
42 |
+
}// get_prod_count
|
43 |
+
|
44 |
+
function get_cur_page()
|
45 |
+
{
|
46 |
+
return (isset($_REQUEST['p'])) ? intval($_REQUEST['p']) : 1;
|
47 |
+
}// get_cur_page
|
48 |
+
|
49 |
+
function get_order()
|
50 |
+
{
|
51 |
+
return (isset($_REQUEST['order'])) ? ($_REQUEST['order']) : 'position';
|
52 |
+
}// get_order
|
53 |
+
|
54 |
+
function get_order_dir()
|
55 |
+
{
|
56 |
+
return (isset($_REQUEST['dir'])) ? ($_REQUEST['dir']) : 'desc';
|
57 |
+
}// get_direction
|
58 |
+
}
|
59 |
+
|
60 |
+
?>
|
app/code/local/Tatva/Catalogextensions/Block/Promotional/Home/List.php
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* To change this template, choose Tools | Templates
|
5 |
+
* and open the template in the editor.
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Description of List
|
10 |
+
*
|
11 |
+
* @author om
|
12 |
+
*/
|
13 |
+
class Tatva_Catalogextensions_Block_Promotional_Home_List extends Tatva_Catalogextensions_Block_Promotional_List
|
14 |
+
{
|
15 |
+
|
16 |
+
protected function _getProductCollection()
|
17 |
+
{
|
18 |
+
parent::__construct();
|
19 |
+
$storeId = Mage::app()->getStore()->getId();
|
20 |
+
$websiteId = Mage::app()->getWebsite()->getId();
|
21 |
+
$customerGroupId = 0;
|
22 |
+
$login = Mage::getSingleton( 'customer/session' )->isLoggedIn();
|
23 |
+
$attributes = Mage::getSingleton('catalog/config')->getProductAttributes();
|
24 |
+
|
25 |
+
if($login)
|
26 |
+
$customerGroupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
|
27 |
+
|
28 |
+
$products = Mage::getModel('catalog/product')->getCollection()
|
29 |
+
->setStoreId($storeId)
|
30 |
+
->addStoreFilter($storeId)
|
31 |
+
->addAttributeToSelect($attributes)
|
32 |
+
->addMinimalPrice()
|
33 |
+
->addFinalPrice()
|
34 |
+
->addTaxPercents()
|
35 |
+
->setOrder($this->get_order(), $this->get_order_dir());
|
36 |
+
|
37 |
+
if(Mage::getStoreConfig('catalogextensions/config1/max_product'))
|
38 |
+
{
|
39 |
+
$products->setPageSize(Mage::getStoreConfig('catalogextensions/config6/max_product'));
|
40 |
+
}
|
41 |
+
|
42 |
+
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
|
43 |
+
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);
|
44 |
+
|
45 |
+
$todayDate = date("Y-m-d H:i:00", Mage::getModel('core/date')->timestamp(time()));
|
46 |
+
$catalogRuleProducts = Mage::getResourceModel('catalogrule/rule_product_price_collection')
|
47 |
+
->addFieldToFilter('customer_group_id',$customerGroupId)
|
48 |
+
->addFieldToFilter('website_id',$websiteId)
|
49 |
+
->addFieldToFilter('latest_start_date', array(array('lteq'=>$todayDate),array('null'=>true)))
|
50 |
+
->addFieldToFilter('earliest_end_date', array(array('gteq'=>$todayDate),array('null'=>true)));
|
51 |
+
|
52 |
+
$catalogRuleProductID = $catalogRuleProducts->getProductIds();
|
53 |
+
|
54 |
+
$products->getSelect()->where('e.entity_id IN(?)',$catalogRuleProductID);
|
55 |
+
$this->_productCollection = $products;
|
56 |
+
|
57 |
+
return $this->_productCollection;
|
58 |
+
}
|
59 |
+
|
60 |
+
function get_prod_count()
|
61 |
+
{
|
62 |
+
//unset any saved limits
|
63 |
+
Mage::getSingleton('catalog/session')->unsLimitPage();
|
64 |
+
return (isset($_REQUEST['limit'])) ? intval($_REQUEST['limit']) : 9;
|
65 |
+
}// get_prod_count
|
66 |
+
|
67 |
+
function get_cur_page()
|
68 |
+
{
|
69 |
+
return (isset($_REQUEST['p'])) ? intval($_REQUEST['p']) : 1;
|
70 |
+
}// get_cur_page
|
71 |
+
|
72 |
+
function get_order()
|
73 |
+
{
|
74 |
+
return (isset($_REQUEST['order'])) ? ($_REQUEST['order']) : 'entity_id';
|
75 |
+
}// get_order
|
76 |
+
|
77 |
+
function get_order_dir()
|
78 |
+
{
|
79 |
+
return (isset($_REQUEST['dir'])) ? ($_REQUEST['dir']) : 'desc';
|
80 |
+
}// get_direction
|
81 |
+
|
82 |
+
public function getToolbarHtml()
|
83 |
+
{
|
84 |
+
|
85 |
+
}
|
86 |
+
}
|
app/code/local/Tatva/Catalogextensions/Block/Promotional/List.php
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* To change this template, choose Tools | Templates
|
5 |
+
* and open the template in the editor.
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Description of List
|
10 |
+
*
|
11 |
+
* @author om
|
12 |
+
*/
|
13 |
+
class Tatva_Catalogextensions_Block_Promotional_List extends Mage_Catalog_Block_Product_List
|
14 |
+
{
|
15 |
+
protected function _getProductCollection()
|
16 |
+
{
|
17 |
+
parent::__construct();
|
18 |
+
parent::__construct();
|
19 |
+
$storeId = Mage::app()->getStore()->getId();
|
20 |
+
$websiteId = Mage::app()->getWebsite()->getId();
|
21 |
+
$customerGroupId = 0;
|
22 |
+
$login = Mage::getSingleton( 'customer/session' )->isLoggedIn();
|
23 |
+
$attributes = Mage::getSingleton('catalog/config')->getProductAttributes();
|
24 |
+
|
25 |
+
if($login)
|
26 |
+
$customerGroupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
|
27 |
+
|
28 |
+
$products = Mage::getModel('catalog/product')->getCollection()
|
29 |
+
->setStoreId($storeId)
|
30 |
+
->addStoreFilter($storeId)
|
31 |
+
->addAttributeToSelect($attributes)
|
32 |
+
->addMinimalPrice()
|
33 |
+
->addFinalPrice()
|
34 |
+
->addTaxPercents()
|
35 |
+
->setPageSize($this->get_prod_count())
|
36 |
+
->setOrder($this->get_order(), $this->get_order_dir())
|
37 |
+
->setCurPage($this->get_cur_page());;
|
38 |
+
|
39 |
+
|
40 |
+
|
41 |
+
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
|
42 |
+
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);
|
43 |
+
|
44 |
+
$todayDate = date("Y-m-d H:i:00", Mage::getModel('core/date')->timestamp(time()));
|
45 |
+
$catalogRuleProducts = Mage::getResourceModel('catalogrule/rule_product_price_collection')
|
46 |
+
->addFieldToFilter('customer_group_id',$customerGroupId)
|
47 |
+
->addFieldToFilter('website_id',$websiteId)
|
48 |
+
->addFieldToFilter('latest_start_date', array(array('lteq'=>$todayDate),array('null'=>true)))
|
49 |
+
->addFieldToFilter('earliest_end_date', array(array('gteq'=>$todayDate),array('null'=>true)));
|
50 |
+
|
51 |
+
$catalogRuleProductID = $catalogRuleProducts->getProductIds();
|
52 |
+
|
53 |
+
$products->getSelect()->where('e.entity_id IN(?)',$catalogRuleProductID);
|
54 |
+
$this->_productCollection = $products;
|
55 |
+
return $this->_productCollection;
|
56 |
+
}
|
57 |
+
|
58 |
+
function get_prod_count()
|
59 |
+
{
|
60 |
+
//unset any saved limits
|
61 |
+
Mage::getSingleton('catalog/session')->unsLimitPage();
|
62 |
+
return (isset($_REQUEST['limit'])) ? intval($_REQUEST['limit']) : 9;
|
63 |
+
}// get_prod_count
|
64 |
+
|
65 |
+
function get_cur_page()
|
66 |
+
{
|
67 |
+
return (isset($_REQUEST['p'])) ? intval($_REQUEST['p']) : 1;
|
68 |
+
}// get_cur_page
|
69 |
+
|
70 |
+
function get_order()
|
71 |
+
{
|
72 |
+
return (isset($_REQUEST['order'])) ? ($_REQUEST['order']) : 'entity_id';
|
73 |
+
}// get_order
|
74 |
+
|
75 |
+
function get_order_dir()
|
76 |
+
{
|
77 |
+
return (isset($_REQUEST['dir'])) ? ($_REQUEST['dir']) : 'desc';
|
78 |
+
}// get_direction
|
79 |
+
}
|
80 |
+
|
81 |
+
?>
|
app/code/local/Tatva/Catalogextensions/Block/lastordered/Home/List.php
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* To change this template, choose Tools | Templates
|
5 |
+
* and open the template in the editor.
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Description of List
|
10 |
+
*
|
11 |
+
* @author om
|
12 |
+
*/
|
13 |
+
class Tatva_Catalogextensions_Block_Lastordered_Home_List extends Tatva_Catalogextensions_Block_Promotional_List
|
14 |
+
{
|
15 |
+
|
16 |
+
protected function _getProductCollection()
|
17 |
+
{
|
18 |
+
parent::__construct();
|
19 |
+
$storeId = Mage::app()->getStore()->getId();
|
20 |
+
$resource = Mage::getSingleton('core/resource');
|
21 |
+
$read = Mage::getSingleton('core/resource')->getConnection('core_read');
|
22 |
+
$orderItemTable = $resource->getTableName('sales/order_item');
|
23 |
+
$demotb = $read->select()->from(array('coi'=>$orderItemTable),array('product_id','item_id'))->group('product_id');
|
24 |
+
$products = Mage::getModel('catalog/product')->getCollection()
|
25 |
+
->setStoreId($storeId)
|
26 |
+
->addStoreFilter($storeId)
|
27 |
+
->addAttributeToSelect(array('name', 'price', 'small_image'));
|
28 |
+
|
29 |
+
|
30 |
+
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
|
31 |
+
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);
|
32 |
+
|
33 |
+
$products->getSelect()
|
34 |
+
->join(array('coi'=>$orderItemTable),'e.entity_id=coi.product_id',array('item_id'))
|
35 |
+
->order($this->get_order().' '.$this->get_order_dir());
|
36 |
+
|
37 |
+
|
38 |
+
if(Mage::getStoreConfig('catalogextensions/config8/max_product'))
|
39 |
+
{
|
40 |
+
$products->setPageSize(Mage::getStoreConfig('catalogextensions/config8/max_product'));
|
41 |
+
}
|
42 |
+
|
43 |
+
$this->_productCollection = $products;
|
44 |
+
|
45 |
+
return $this->_productCollection;
|
46 |
+
}
|
47 |
+
|
48 |
+
function get_prod_count()
|
49 |
+
{
|
50 |
+
//unset any saved limits
|
51 |
+
Mage::getSingleton('catalog/session')->unsLimitPage();
|
52 |
+
return (isset($_REQUEST['limit'])) ? intval($_REQUEST['limit']) : 9;
|
53 |
+
}// get_prod_count
|
54 |
+
|
55 |
+
function get_cur_page()
|
56 |
+
{
|
57 |
+
return (isset($_REQUEST['p'])) ? intval($_REQUEST['p']) : 1;
|
58 |
+
}// get_cur_page
|
59 |
+
|
60 |
+
function get_order()
|
61 |
+
{
|
62 |
+
return (isset($_REQUEST['order'])) ? ($_REQUEST['order']) : 'item_id';
|
63 |
+
}// get_order
|
64 |
+
|
65 |
+
function get_order_dir()
|
66 |
+
{
|
67 |
+
return (isset($_REQUEST['dir'])) ? ($_REQUEST['dir']) : 'desc';
|
68 |
+
}// get_direction
|
69 |
+
|
70 |
+
public function getToolbarHtml()
|
71 |
+
{
|
72 |
+
|
73 |
+
}
|
74 |
+
}
|
app/code/local/Tatva/Catalogextensions/Block/lastordered/List.php
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* To change this template, choose Tools | Templates
|
5 |
+
* and open the template in the editor.
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Description of List
|
10 |
+
*
|
11 |
+
* @author om
|
12 |
+
*/
|
13 |
+
class Tatva_Catalogextensions_Block_Lastordered_List extends Mage_Catalog_Block_Product_List
|
14 |
+
{
|
15 |
+
protected function _getProductCollection()
|
16 |
+
{
|
17 |
+
parent::__construct();
|
18 |
+
$storeId = Mage::app()->getStore()->getId();
|
19 |
+
$resource = Mage::getSingleton('core/resource');
|
20 |
+
$read = Mage::getSingleton('core/resource')->getConnection('core_read');
|
21 |
+
|
22 |
+
$orderItemTable = $resource->getTableName('sales/order_item');
|
23 |
+
$demotb = $read->select()->from(array('coi'=>$orderItemTable),array('product_id','item_id'))->group('product_id');
|
24 |
+
$products = Mage::getModel('catalog/product')->getCollection()
|
25 |
+
->setStoreId($storeId)
|
26 |
+
->addStoreFilter($storeId)
|
27 |
+
->addAttributeToSelect(array('name', 'price', 'small_image'));
|
28 |
+
|
29 |
+
|
30 |
+
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
|
31 |
+
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);
|
32 |
+
|
33 |
+
$products->getSelect()
|
34 |
+
->join(array('coid'=>$demotb),'e.entity_id=coid.product_id',array('item_id'))
|
35 |
+
->order($this->get_order().' '.$this->get_order_dir());
|
36 |
+
|
37 |
+
|
38 |
+
$products->setPageSize($this->get_prod_count())->setCurPage($this->get_cur_page());
|
39 |
+
|
40 |
+
$this->_productCollection = $products;
|
41 |
+
|
42 |
+
return $this->_productCollection;
|
43 |
+
}
|
44 |
+
|
45 |
+
function get_prod_count()
|
46 |
+
{
|
47 |
+
//unset any saved limits
|
48 |
+
Mage::getSingleton('catalog/session')->unsLimitPage();
|
49 |
+
return (isset($_REQUEST['limit'])) ? intval($_REQUEST['limit']) : 9;
|
50 |
+
|
51 |
+
}// get_prod_count
|
52 |
+
|
53 |
+
function get_cur_page()
|
54 |
+
{
|
55 |
+
return (isset($_REQUEST['p'])) ? intval($_REQUEST['p']) : 1;
|
56 |
+
}// get_cur_page
|
57 |
+
|
58 |
+
function get_order()
|
59 |
+
{
|
60 |
+
return (isset($_REQUEST['order'])) ? ($_REQUEST['order']) : 'item_id';
|
61 |
+
}// get_order
|
62 |
+
|
63 |
+
function get_order_dir()
|
64 |
+
{
|
65 |
+
return (isset($_REQUEST['dir'])) ? ($_REQUEST['dir']) : 'desc';
|
66 |
+
}// get_direction
|
67 |
+
}
|
68 |
+
|
69 |
+
?>
|
app/code/local/Tatva/Catalogextensions/Helper/Data.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Catalogextensions_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
app/code/local/Tatva/Catalogextensions/Model/Catalogextensions.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Catalogextensions_Model_Catalogextensions extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('catalogextensions/catalogextensions');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Tatva/Catalogextensions/Model/Mysql4/Catalogextensions.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Catalogextensions_Model_Mysql4_Catalogextensions extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
// Note that the catalogextensions_id refers to the key field in your database table.
|
8 |
+
$this->_init('catalogextensions/catalogextensions', 'catalogextensions_id');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Tatva/Catalogextensions/Model/Mysql4/Catalogextensions/Collection.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Catalogextensions_Model_Mysql4_Catalogextensions_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('catalogextensions/catalogextensions');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Tatva/Catalogextensions/Model/Status.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Catalogextensions_Model_Status extends Varien_Object
|
4 |
+
{
|
5 |
+
const STATUS_ENABLED = 1;
|
6 |
+
const STATUS_DISABLED = 2;
|
7 |
+
|
8 |
+
static public function getOptionArray()
|
9 |
+
{
|
10 |
+
return array(
|
11 |
+
self::STATUS_ENABLED => Mage::helper('catalogextensions')->__('Enabled'),
|
12 |
+
self::STATUS_DISABLED => Mage::helper('catalogextensions')->__('Disabled')
|
13 |
+
);
|
14 |
+
}
|
15 |
+
}
|
app/code/local/Tatva/Catalogextensions/controllers/IndexController.php
ADDED
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Tatva_Catalogextensions_IndexController extends Mage_Core_Controller_Front_Action
|
3 |
+
{
|
4 |
+
public function indexAction()
|
5 |
+
{
|
6 |
+
|
7 |
+
/*
|
8 |
+
* Load an object by id
|
9 |
+
* Request looking like:
|
10 |
+
* http://site.com/catalogextensions?id=15
|
11 |
+
* or
|
12 |
+
* http://site.com/catalogextensions/id/15
|
13 |
+
*/
|
14 |
+
/*
|
15 |
+
$catalogextensions_id = $this->getRequest()->getParam('id');
|
16 |
+
|
17 |
+
if($catalogextensions_id != null && $catalogextensions_id != '') {
|
18 |
+
$catalogextensions = Mage::getModel('catalogextensions/catalogextensions')->load($catalogextensions_id)->getData();
|
19 |
+
} else {
|
20 |
+
$catalogextensions = null;
|
21 |
+
}
|
22 |
+
*/
|
23 |
+
|
24 |
+
/*
|
25 |
+
* If no param we load a the last created item
|
26 |
+
*/
|
27 |
+
/*
|
28 |
+
if($catalogextensions == null) {
|
29 |
+
$resource = Mage::getSingleton('core/resource');
|
30 |
+
$read= $resource->getConnection('core_read');
|
31 |
+
$catalogextensionsTable = $resource->getTableName('catalogextensions');
|
32 |
+
|
33 |
+
$select = $read->select()
|
34 |
+
->from($catalogextensionsTable,array('catalogextensions_id','title','content','status'))
|
35 |
+
->where('status',1)
|
36 |
+
->order('created_time DESC') ;
|
37 |
+
|
38 |
+
$catalogextensions = $read->fetchRow($select);
|
39 |
+
}
|
40 |
+
Mage::register('catalogextensions', $catalogextensions);
|
41 |
+
*/
|
42 |
+
|
43 |
+
|
44 |
+
$this->loadLayout();
|
45 |
+
$this->renderLayout();
|
46 |
+
}
|
47 |
+
public function bestsellersAction()
|
48 |
+
{
|
49 |
+
|
50 |
+
$url = Mage::getUrl('no-route');
|
51 |
+
|
52 |
+
$enable = Mage::getStoreConfig('catalogextensions/config1/active');
|
53 |
+
if($enable != 1)
|
54 |
+
{
|
55 |
+
Mage::app()->getFrontController()->getResponse()->setRedirect($url);
|
56 |
+
}
|
57 |
+
else
|
58 |
+
{
|
59 |
+
$this->loadLayout();
|
60 |
+
$this->getLayout()->getBlock('head')->setTitle('Besesellers');
|
61 |
+
$this->renderLayout();
|
62 |
+
}
|
63 |
+
}
|
64 |
+
public function featuredAction()
|
65 |
+
{
|
66 |
+
|
67 |
+
$url = Mage::getUrl('no-route');
|
68 |
+
|
69 |
+
$enable = Mage::getStoreConfig('catalogextensions/config2/active');
|
70 |
+
if($enable != 1)
|
71 |
+
{
|
72 |
+
Mage::app()->getFrontController()->getResponse()->setRedirect($url);
|
73 |
+
}
|
74 |
+
|
75 |
+
$this->loadLayout();
|
76 |
+
$this->getLayout()->getBlock('head')->setTitle('Featured Products');
|
77 |
+
$this->renderLayout();
|
78 |
+
}
|
79 |
+
public function mostviewedAction()
|
80 |
+
{
|
81 |
+
|
82 |
+
$url = Mage::getUrl('no-route');
|
83 |
+
|
84 |
+
$enable = Mage::getStoreConfig('catalogextensions/config3/active');
|
85 |
+
if($enable != 1)
|
86 |
+
{
|
87 |
+
Mage::app()->getFrontController()->getResponse()->setRedirect($url);
|
88 |
+
}
|
89 |
+
|
90 |
+
$this->loadLayout();
|
91 |
+
$this->getLayout()->getBlock('head')->setTitle('Mostviewed products');
|
92 |
+
$this->renderLayout();
|
93 |
+
}
|
94 |
+
public function newproductAction()
|
95 |
+
{
|
96 |
+
|
97 |
+
$url = Mage::getUrl('no-route');
|
98 |
+
|
99 |
+
$enable = Mage::getStoreConfig('catalogextensions/config4/active');
|
100 |
+
if($enable != 1)
|
101 |
+
{
|
102 |
+
Mage::app()->getFrontController()->getResponse()->setRedirect($url);
|
103 |
+
}
|
104 |
+
|
105 |
+
$this->loadLayout();
|
106 |
+
$this->getLayout()->getBlock('head')->setTitle('New products');
|
107 |
+
$this->renderLayout();
|
108 |
+
}
|
109 |
+
|
110 |
+
public function allproductAction()
|
111 |
+
{
|
112 |
+
|
113 |
+
$url = Mage::getUrl('no-route');
|
114 |
+
|
115 |
+
$enable = Mage::getStoreConfig('catalogextensions/config5/active');
|
116 |
+
if($enable != 1)
|
117 |
+
{
|
118 |
+
Mage::app()->getFrontController()->getResponse()->setRedirect($url);
|
119 |
+
}
|
120 |
+
|
121 |
+
$this->loadLayout();
|
122 |
+
$this->getLayout()->getBlock('head')->setTitle('All products');
|
123 |
+
$this->renderLayout();
|
124 |
+
}
|
125 |
+
|
126 |
+
public function promotionalAction()
|
127 |
+
{
|
128 |
+
|
129 |
+
$url = Mage::getUrl('no-route');
|
130 |
+
|
131 |
+
$enable = Mage::getStoreConfig('catalogextensions/config6/active');
|
132 |
+
if($enable != 1)
|
133 |
+
{
|
134 |
+
Mage::app()->getFrontController()->getResponse()->setRedirect($url);
|
135 |
+
}
|
136 |
+
|
137 |
+
$this->loadLayout();
|
138 |
+
$this->getLayout()->getBlock('head')->setTitle('Promotional Products');
|
139 |
+
$this->renderLayout();
|
140 |
+
}
|
141 |
+
|
142 |
+
public function recentlyorderedAction()
|
143 |
+
{
|
144 |
+
|
145 |
+
$url = Mage::getUrl('no-route');
|
146 |
+
|
147 |
+
$enable = Mage::getStoreConfig('catalogextensions/config8/active');
|
148 |
+
if($enable != 1)
|
149 |
+
{
|
150 |
+
Mage::app()->getFrontController()->getResponse()->setRedirect($url);
|
151 |
+
}
|
152 |
+
|
153 |
+
$this->loadLayout();
|
154 |
+
$this->getLayout()->getBlock('head')->setTitle('Recently Ordered Products');
|
155 |
+
$this->renderLayout();
|
156 |
+
}
|
157 |
+
|
158 |
+
}
|
app/code/local/Tatva/Catalogextensions/etc/adminhtml.xml
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<adminhtml>
|
3 |
+
<acl>
|
4 |
+
<resources>
|
5 |
+
<all>
|
6 |
+
<title>Allow Everything</title>
|
7 |
+
</all>
|
8 |
+
<admin>
|
9 |
+
<children>
|
10 |
+
<system>
|
11 |
+
<children>
|
12 |
+
<config>
|
13 |
+
<children>
|
14 |
+
<catalogextensions translate="title" module="catalogextensions">
|
15 |
+
<title>Catalogextensions Configuration</title>
|
16 |
+
</catalogextensions>
|
17 |
+
</children>
|
18 |
+
</config>
|
19 |
+
</children>
|
20 |
+
</system>
|
21 |
+
<Tatva_Catalogextensions>
|
22 |
+
<title>Catalogextensions Module</title>
|
23 |
+
<sort_order>10</sort_order>
|
24 |
+
</Tatva_Catalogextensions>
|
25 |
+
</children>
|
26 |
+
</admin>
|
27 |
+
</resources>
|
28 |
+
</acl>
|
29 |
+
</adminhtml>
|
app/code/local/Tatva/Catalogextensions/etc/config.xml
ADDED
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Tatva_Catalogextensions>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Tatva_Catalogextensions>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<catalogextensions>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Tatva_Catalogextensions</module>
|
14 |
+
<frontName>catalogextensions</frontName>
|
15 |
+
</args>
|
16 |
+
</catalogextensions>
|
17 |
+
</routers>
|
18 |
+
<layout>
|
19 |
+
<updates>
|
20 |
+
<catalogextensions>
|
21 |
+
<file>catalogextensions/catalogextensions.xml</file>
|
22 |
+
</catalogextensions>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
</frontend>
|
26 |
+
<admin>
|
27 |
+
<routers>
|
28 |
+
<catalogextensions>
|
29 |
+
<use>admin</use>
|
30 |
+
<args>
|
31 |
+
<module>Tatva_Catalogextensions</module>
|
32 |
+
<frontName>catalogextensions</frontName>
|
33 |
+
</args>
|
34 |
+
</catalogextensions>
|
35 |
+
</routers>
|
36 |
+
</admin>
|
37 |
+
<adminhtml>
|
38 |
+
<acl>
|
39 |
+
<resources>
|
40 |
+
<all>
|
41 |
+
<title>Allow Everything</title>
|
42 |
+
</all>
|
43 |
+
<admin>
|
44 |
+
<children>
|
45 |
+
<system>
|
46 |
+
<children>
|
47 |
+
<config>
|
48 |
+
<children>
|
49 |
+
<catalogextensions translate="title" module="catalogextensions">
|
50 |
+
<title>Catalogextensions Configuration</title>
|
51 |
+
</catalogextensions>
|
52 |
+
</children>
|
53 |
+
</config>
|
54 |
+
</children>
|
55 |
+
</system>
|
56 |
+
<Tatva_Catalogextensions>
|
57 |
+
<title>Catalogextensions Module</title>
|
58 |
+
<sort_order>10</sort_order>
|
59 |
+
</Tatva_Catalogextensions>
|
60 |
+
</children>
|
61 |
+
</admin>
|
62 |
+
</resources>
|
63 |
+
</acl>
|
64 |
+
<layout>
|
65 |
+
<updates>
|
66 |
+
<catalogextensions>
|
67 |
+
<file>catalogextensions.xml</file>
|
68 |
+
</catalogextensions>
|
69 |
+
</updates>
|
70 |
+
</layout>
|
71 |
+
</adminhtml>
|
72 |
+
<global>
|
73 |
+
<models>
|
74 |
+
<catalogextensions>
|
75 |
+
<class>Tatva_Catalogextensions_Model</class>
|
76 |
+
<resourceModel>catalogextensions_mysql4</resourceModel>
|
77 |
+
</catalogextensions>
|
78 |
+
<catalogextensions_mysql4>
|
79 |
+
<class>Tatva_Catalogextensions_Model_Mysql4</class>
|
80 |
+
<entities>
|
81 |
+
<catalogextensions>
|
82 |
+
<table>catalogextensions</table>
|
83 |
+
</catalogextensions>
|
84 |
+
</entities>
|
85 |
+
</catalogextensions_mysql4>
|
86 |
+
</models>
|
87 |
+
<resources>
|
88 |
+
<catalogextensions_setup>
|
89 |
+
<setup>
|
90 |
+
<module>Tatva_Catalogextensions</module>
|
91 |
+
</setup>
|
92 |
+
<connection>
|
93 |
+
<use>core_setup</use>
|
94 |
+
</connection>
|
95 |
+
</catalogextensions_setup>
|
96 |
+
<catalogextensions_write>
|
97 |
+
<connection>
|
98 |
+
<use>core_write</use>
|
99 |
+
</connection>
|
100 |
+
</catalogextensions_write>
|
101 |
+
<catalogextensions_read>
|
102 |
+
<connection>
|
103 |
+
<use>core_read</use>
|
104 |
+
</connection>
|
105 |
+
</catalogextensions_read>
|
106 |
+
</resources>
|
107 |
+
<blocks>
|
108 |
+
<catalogextensions>
|
109 |
+
<class>Tatva_Catalogextensions_Block</class>
|
110 |
+
</catalogextensions>
|
111 |
+
</blocks>
|
112 |
+
<helpers>
|
113 |
+
<catalogextensions>
|
114 |
+
<class>Tatva_Catalogextensions_Helper</class>
|
115 |
+
</catalogextensions>
|
116 |
+
</helpers>
|
117 |
+
</global>
|
118 |
+
<default>
|
119 |
+
<catalogextensions>
|
120 |
+
<config1>
|
121 |
+
<active>0</active>
|
122 |
+
<max_product>3</max_product>
|
123 |
+
<title>Bestseller Products</title>
|
124 |
+
</config1>
|
125 |
+
<config2>
|
126 |
+
<active>0</active>
|
127 |
+
<max_product>3</max_product>
|
128 |
+
<title>Fetured Products</title>
|
129 |
+
</config2>
|
130 |
+
<config3>
|
131 |
+
<active>0</active>
|
132 |
+
<max_product>3</max_product>
|
133 |
+
<title>Most Viewed Products</title>
|
134 |
+
</config3>
|
135 |
+
<config4>
|
136 |
+
<active>0</active>
|
137 |
+
<max_product>3</max_product>
|
138 |
+
<title>New Products</title>
|
139 |
+
<type>Recently Added</type>
|
140 |
+
</config4>
|
141 |
+
<config5>
|
142 |
+
<active>0</active>
|
143 |
+
<title>All Products</title>
|
144 |
+
</config5>
|
145 |
+
<config6>
|
146 |
+
<active>0</active>
|
147 |
+
<max_product>3</max_product>
|
148 |
+
<title>Promotional Products</title>
|
149 |
+
</config6>
|
150 |
+
<config7>
|
151 |
+
<active>0</active>
|
152 |
+
<max_product>3</max_product>
|
153 |
+
<title>Recently Ordered Products</title>
|
154 |
+
</config7>
|
155 |
+
</catalogextensions>
|
156 |
+
</default>
|
157 |
+
</config>
|
app/code/local/Tatva/Catalogextensions/etc/system.xml
ADDED
@@ -0,0 +1,266 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<catalogextensions translate="label" module="catalogextensions">
|
5 |
+
<label>Catalog Supporting Extensions</label>
|
6 |
+
<sort_order>101</sort_order>
|
7 |
+
</catalogextensions>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<catalogextensions translate="label" module="catalogextensions">
|
11 |
+
<class>separator-top</class>
|
12 |
+
<label>Catalog Extensions Configuration</label>
|
13 |
+
<tab>catalogextensions</tab>
|
14 |
+
<frontend_type>text</frontend_type>
|
15 |
+
<sort_order>10</sort_order>
|
16 |
+
<show_in_default>1</show_in_default>
|
17 |
+
<show_in_website>1</show_in_website>
|
18 |
+
<show_in_store>1</show_in_store>
|
19 |
+
<groups>
|
20 |
+
<config1 translate="label" module="catalogextensions">
|
21 |
+
<label>Topsellers Configuration</label>
|
22 |
+
<frontend_type>text</frontend_type>
|
23 |
+
<sort_order>10</sort_order>
|
24 |
+
<show_in_default>1</show_in_default>
|
25 |
+
<show_in_website>1</show_in_website>
|
26 |
+
<show_in_store>1</show_in_store>
|
27 |
+
<fields>
|
28 |
+
<active translate="label">
|
29 |
+
<label>Enabled</label>
|
30 |
+
<frontend_type>select</frontend_type>
|
31 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
32 |
+
<sort_order>1</sort_order>
|
33 |
+
<show_in_default>1</show_in_default>
|
34 |
+
<show_in_website>1</show_in_website>
|
35 |
+
<show_in_store>1</show_in_store>
|
36 |
+
</active>
|
37 |
+
<max_product translate="label" module="catalogextensions">
|
38 |
+
<label>Maximum No Of Products To Dispay On Home</label>
|
39 |
+
<frontend_type>text</frontend_type>
|
40 |
+
<validate>validate-greater-than-zero</validate>
|
41 |
+
<sort_order>10</sort_order>
|
42 |
+
<show_in_default>1</show_in_default>
|
43 |
+
<show_in_website>1</show_in_website>
|
44 |
+
<show_in_store>1</show_in_store>
|
45 |
+
</max_product>
|
46 |
+
<title translate="label" module="catalogextensions">
|
47 |
+
<label>Title</label>
|
48 |
+
<frontend_type>text</frontend_type>
|
49 |
+
<sort_order>30</sort_order>
|
50 |
+
<show_in_default>1</show_in_default>
|
51 |
+
<show_in_website>1</show_in_website>
|
52 |
+
<show_in_store>1</show_in_store>
|
53 |
+
</title>
|
54 |
+
</fields>
|
55 |
+
</config1>
|
56 |
+
<config2 translate="label" module="catalogextensions">
|
57 |
+
<label>Feature Product Configuration</label>
|
58 |
+
<frontend_type>text</frontend_type>
|
59 |
+
<sort_order>20</sort_order>
|
60 |
+
<show_in_default>1</show_in_default>
|
61 |
+
<show_in_website>1</show_in_website>
|
62 |
+
<show_in_store>1</show_in_store>
|
63 |
+
<fields>
|
64 |
+
<active translate="label">
|
65 |
+
<label>Enabled</label>
|
66 |
+
<frontend_type>select</frontend_type>
|
67 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
68 |
+
<sort_order>1</sort_order>
|
69 |
+
<show_in_default>1</show_in_default>
|
70 |
+
<show_in_website>1</show_in_website>
|
71 |
+
<show_in_store>1</show_in_store>
|
72 |
+
</active>
|
73 |
+
<max_product translate="label" module="catalogextensions">
|
74 |
+
<label>Maximum No Of Products To Dispay On Home</label>
|
75 |
+
<frontend_type>text</frontend_type>
|
76 |
+
<validate>validate-greater-than-zero</validate>
|
77 |
+
<sort_order>10</sort_order>
|
78 |
+
<show_in_default>1</show_in_default>
|
79 |
+
<show_in_website>1</show_in_website>
|
80 |
+
<show_in_store>1</show_in_store>
|
81 |
+
</max_product>
|
82 |
+
<title translate="label" module="catalogextensions">
|
83 |
+
<label>Title</label>
|
84 |
+
<frontend_type>text</frontend_type>
|
85 |
+
<sort_order>30</sort_order>
|
86 |
+
<show_in_default>1</show_in_default>
|
87 |
+
<show_in_website>1</show_in_website>
|
88 |
+
<show_in_store>1</show_in_store>
|
89 |
+
</title>
|
90 |
+
</fields>
|
91 |
+
</config2>
|
92 |
+
<config3 translate="label" module="catalogextensions">
|
93 |
+
<label>Most Viewed Product Configuration</label>
|
94 |
+
<frontend_type>text</frontend_type>
|
95 |
+
<sort_order>30</sort_order>
|
96 |
+
<show_in_default>1</show_in_default>
|
97 |
+
<show_in_website>1</show_in_website>
|
98 |
+
<show_in_store>1</show_in_store>
|
99 |
+
<fields>
|
100 |
+
<active translate="label">
|
101 |
+
<label>Enabled</label>
|
102 |
+
<frontend_type>select</frontend_type>
|
103 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
104 |
+
<sort_order>1</sort_order>
|
105 |
+
<show_in_default>1</show_in_default>
|
106 |
+
<show_in_website>1</show_in_website>
|
107 |
+
<show_in_store>1</show_in_store>
|
108 |
+
</active>
|
109 |
+
<max_product translate="label" module="catalogextensions">
|
110 |
+
<label>Maximum No Of Products To Dispay On Home</label>
|
111 |
+
<frontend_type>text</frontend_type>
|
112 |
+
<validate>validate-greater-than-zero</validate>
|
113 |
+
<sort_order>10</sort_order>
|
114 |
+
<show_in_default>1</show_in_default>
|
115 |
+
<show_in_website>1</show_in_website>
|
116 |
+
<show_in_store>1</show_in_store>
|
117 |
+
</max_product>
|
118 |
+
<title translate="label" module="catalogextensions">
|
119 |
+
<label>Title</label>
|
120 |
+
<frontend_type>text</frontend_type>
|
121 |
+
<sort_order>30</sort_order>
|
122 |
+
<show_in_default>1</show_in_default>
|
123 |
+
<show_in_website>1</show_in_website>
|
124 |
+
<show_in_store>1</show_in_store>
|
125 |
+
</title>
|
126 |
+
</fields>
|
127 |
+
</config3>
|
128 |
+
<config4 translate="label" module="catalogextensions">
|
129 |
+
<label>New Product Configuration</label>
|
130 |
+
<frontend_type>text</frontend_type>
|
131 |
+
<sort_order>40</sort_order>
|
132 |
+
<show_in_default>1</show_in_default>
|
133 |
+
<show_in_website>1</show_in_website>
|
134 |
+
<show_in_store>1</show_in_store>
|
135 |
+
<fields>
|
136 |
+
<active translate="label">
|
137 |
+
<label>Enabled</label>
|
138 |
+
<frontend_type>select</frontend_type>
|
139 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
140 |
+
<sort_order>1</sort_order>
|
141 |
+
<show_in_default>1</show_in_default>
|
142 |
+
<show_in_website>1</show_in_website>
|
143 |
+
<show_in_store>1</show_in_store>
|
144 |
+
</active>
|
145 |
+
<max_product translate="label" module="catalogextensions">
|
146 |
+
<label>Maximum No Of Products To Dispay On Home</label>
|
147 |
+
<frontend_type>text</frontend_type>
|
148 |
+
<validate>validate-greater-than-zero</validate>
|
149 |
+
<sort_order>10</sort_order>
|
150 |
+
<show_in_default>1</show_in_default>
|
151 |
+
<show_in_website>1</show_in_website>
|
152 |
+
<show_in_store>1</show_in_store>
|
153 |
+
</max_product>
|
154 |
+
<title translate="label" module="catalogextensions">
|
155 |
+
<label>Title</label>
|
156 |
+
<frontend_type>text</frontend_type>
|
157 |
+
<sort_order>30</sort_order>
|
158 |
+
<show_in_default>1</show_in_default>
|
159 |
+
<show_in_website>1</show_in_website>
|
160 |
+
<show_in_store>1</show_in_store>
|
161 |
+
</title>
|
162 |
+
</fields>
|
163 |
+
</config4>
|
164 |
+
<config5 translate="label" module="catalogextensions">
|
165 |
+
<label>All Product Configuration</label>
|
166 |
+
<frontend_type>text</frontend_type>
|
167 |
+
<sort_order>50</sort_order>
|
168 |
+
<show_in_default>1</show_in_default>
|
169 |
+
<show_in_website>1</show_in_website>
|
170 |
+
<show_in_store>1</show_in_store>
|
171 |
+
<fields>
|
172 |
+
<active translate="label">
|
173 |
+
<label>Enabled</label>
|
174 |
+
<frontend_type>select</frontend_type>
|
175 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
176 |
+
<sort_order>1</sort_order>
|
177 |
+
<show_in_default>1</show_in_default>
|
178 |
+
<show_in_website>1</show_in_website>
|
179 |
+
<show_in_store>1</show_in_store>
|
180 |
+
</active>
|
181 |
+
<title translate="label" module="catalogextensions">
|
182 |
+
<label>Title</label>
|
183 |
+
<frontend_type>text</frontend_type>
|
184 |
+
<sort_order>40</sort_order>
|
185 |
+
<show_in_default>1</show_in_default>
|
186 |
+
<show_in_website>1</show_in_website>
|
187 |
+
<show_in_store>1</show_in_store>
|
188 |
+
</title>
|
189 |
+
</fields>
|
190 |
+
</config5>
|
191 |
+
<config6 translate="label" module="catalogextensions">
|
192 |
+
<label>Promotional Product Configuration</label>
|
193 |
+
<frontend_type>text</frontend_type>
|
194 |
+
<sort_order>60</sort_order>
|
195 |
+
<show_in_default>1</show_in_default>
|
196 |
+
<show_in_website>1</show_in_website>
|
197 |
+
<show_in_store>1</show_in_store>
|
198 |
+
<fields>
|
199 |
+
<active translate="label">
|
200 |
+
<label>Enabled</label>
|
201 |
+
<frontend_type>select</frontend_type>
|
202 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
203 |
+
<sort_order>1</sort_order>
|
204 |
+
<show_in_default>1</show_in_default>
|
205 |
+
<show_in_website>1</show_in_website>
|
206 |
+
<show_in_store>1</show_in_store>
|
207 |
+
</active>
|
208 |
+
<max_product translate="label" module="catalogextensions">
|
209 |
+
<label>Maximum No Of Products To Dispay On Home</label>
|
210 |
+
<frontend_type>text</frontend_type>
|
211 |
+
<validate>validate-greater-than-zero</validate>
|
212 |
+
<sort_order>10</sort_order>
|
213 |
+
<show_in_default>1</show_in_default>
|
214 |
+
<show_in_website>1</show_in_website>
|
215 |
+
<show_in_store>1</show_in_store>
|
216 |
+
</max_product>
|
217 |
+
<title translate="label" module="catalogextensions">
|
218 |
+
<label>Title</label>
|
219 |
+
<frontend_type>text</frontend_type>
|
220 |
+
<sort_order>40</sort_order>
|
221 |
+
<show_in_default>1</show_in_default>
|
222 |
+
<show_in_website>1</show_in_website>
|
223 |
+
<show_in_store>1</show_in_store>
|
224 |
+
</title>
|
225 |
+
</fields>
|
226 |
+
</config6>
|
227 |
+
<config7 translate="label" module="catalogextensions">
|
228 |
+
<label>Recently Ordered Product Configuration</label>
|
229 |
+
<frontend_type>text</frontend_type>
|
230 |
+
<sort_order>70</sort_order>
|
231 |
+
<show_in_default>1</show_in_default>
|
232 |
+
<show_in_website>1</show_in_website>
|
233 |
+
<show_in_store>1</show_in_store>
|
234 |
+
<fields>
|
235 |
+
<active translate="label">
|
236 |
+
<label>Enabled</label>
|
237 |
+
<frontend_type>select</frontend_type>
|
238 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
239 |
+
<sort_order>1</sort_order>
|
240 |
+
<show_in_default>1</show_in_default>
|
241 |
+
<show_in_website>1</show_in_website>
|
242 |
+
<show_in_store>1</show_in_store>
|
243 |
+
</active>
|
244 |
+
<max_product translate="label" module="catalogextensions">
|
245 |
+
<label>Maximum No Of Products To Dispay On Home</label>
|
246 |
+
<frontend_type>text</frontend_type>
|
247 |
+
<validate>validate-greater-than-zero</validate>
|
248 |
+
<sort_order>10</sort_order>
|
249 |
+
<show_in_default>1</show_in_default>
|
250 |
+
<show_in_website>1</show_in_website>
|
251 |
+
<show_in_store>1</show_in_store>
|
252 |
+
</max_product>
|
253 |
+
<title translate="label" module="catalogextensions">
|
254 |
+
<label>Title</label>
|
255 |
+
<frontend_type>text</frontend_type>
|
256 |
+
<sort_order>40</sort_order>
|
257 |
+
<show_in_default>1</show_in_default>
|
258 |
+
<show_in_website>1</show_in_website>
|
259 |
+
<show_in_store>1</show_in_store>
|
260 |
+
</title>
|
261 |
+
</fields>
|
262 |
+
</config7>
|
263 |
+
</groups>
|
264 |
+
</catalogextensions>
|
265 |
+
</sections>
|
266 |
+
</config>
|
app/code/local/Tatva/Catalogextensions/sql/catalogextensions_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
|
8 |
+
$setup->addAttribute('catalog_product', 'featured', array(
|
9 |
+
'type' => 'int',
|
10 |
+
'backend_type' => 'int',
|
11 |
+
'backend' => '',
|
12 |
+
'frontend' => '',
|
13 |
+
'label' => 'Is Featured',
|
14 |
+
'input' => 'boolean',
|
15 |
+
'frontend_class' => '',
|
16 |
+
'source' => 'eav/entity_attribute_source_boolean',
|
17 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
|
18 |
+
'visible' => false,
|
19 |
+
'required' => false,
|
20 |
+
'user_defined' => true,
|
21 |
+
'default' => '',
|
22 |
+
'searchable' => false,
|
23 |
+
'filterable' => false,
|
24 |
+
'comparable' => false,
|
25 |
+
'visible_on_front' => false,
|
26 |
+
'unique' => false,
|
27 |
+
'apply_to' => '',
|
28 |
+
'is_configurable' => false
|
29 |
+
));
|
30 |
+
|
31 |
+
$setup->addAttributeToSet('catalog_product', 'Default', 'General', 'featured');
|
32 |
+
|
33 |
+
$installer->endSetup();
|
app/code/local/Tatva/Customtab/Block/Adminhtml/Customtab.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Tatva_Customtab_Block_Adminhtml_Customtab extends Mage_Adminhtml_Block_Widget_Grid_Container
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
$this->_controller = 'adminhtml_customtab';
|
7 |
+
$this->_blockGroup = 'customtab';
|
8 |
+
$this->_headerText = Mage::helper('customtab')->__('Item Manager');
|
9 |
+
$this->_addButtonLabel = Mage::helper('customtab')->__('Add Item');
|
10 |
+
parent::__construct();
|
11 |
+
}
|
12 |
+
}
|
app/code/local/Tatva/Customtab/Block/Adminhtml/Customtab/Edit.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Customtab_Block_Adminhtml_Customtab_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 = 'customtab';
|
11 |
+
$this->_controller = 'adminhtml_customtab';
|
12 |
+
|
13 |
+
$this->_updateButton('save', 'label', Mage::helper('customtab')->__('Save Item'));
|
14 |
+
$this->_updateButton('delete', 'label', Mage::helper('customtab')->__('Delete Item'));
|
15 |
+
|
16 |
+
$this->_addButton('saveandcontinue', array(
|
17 |
+
'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
|
18 |
+
'onclick' => 'saveAndContinueEdit()',
|
19 |
+
'class' => 'save',
|
20 |
+
), -100);
|
21 |
+
|
22 |
+
$this->_formScripts[] = "
|
23 |
+
function toggleEditor() {
|
24 |
+
if (tinyMCE.getInstanceById('customtab_content') == null) {
|
25 |
+
tinyMCE.execCommand('mceAddControl', false, 'customtab_content');
|
26 |
+
} else {
|
27 |
+
tinyMCE.execCommand('mceRemoveControl', false, 'customtab_content');
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
function saveAndContinueEdit(){
|
32 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
33 |
+
}
|
34 |
+
";
|
35 |
+
}
|
36 |
+
|
37 |
+
public function getHeaderText()
|
38 |
+
{
|
39 |
+
if( Mage::registry('customtab_data') && Mage::registry('customtab_data')->getId() ) {
|
40 |
+
return Mage::helper('customtab')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('customtab_data')->getTitle()));
|
41 |
+
} else {
|
42 |
+
return Mage::helper('customtab')->__('Add Item');
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
app/code/local/Tatva/Customtab/Block/Adminhtml/Customtab/Edit/Form.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Customtab_Block_Adminhtml_Customtab_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
4 |
+
{
|
5 |
+
protected function _prepareForm()
|
6 |
+
{
|
7 |
+
$form = new Varien_Data_Form(array(
|
8 |
+
'id' => 'edit_form',
|
9 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
10 |
+
'method' => 'post',
|
11 |
+
'enctype' => 'multipart/form-data'
|
12 |
+
)
|
13 |
+
);
|
14 |
+
|
15 |
+
$form->setUseContainer(true);
|
16 |
+
$this->setForm($form);
|
17 |
+
return parent::_prepareForm();
|
18 |
+
}
|
19 |
+
}
|
app/code/local/Tatva/Customtab/Block/Adminhtml/Customtab/Edit/Tab/Form.php
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Customtab_Block_Adminhtml_Customtab_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('customtab_form', array('legend'=>Mage::helper('customtab')->__('Item information')));
|
10 |
+
|
11 |
+
$fieldset->addField('title', 'text', array(
|
12 |
+
'label' => Mage::helper('customtab')->__('Title'),
|
13 |
+
'class' => 'required-entry',
|
14 |
+
'required' => true,
|
15 |
+
'name' => 'title',
|
16 |
+
));
|
17 |
+
|
18 |
+
$fieldset->addField('filename', 'file', array(
|
19 |
+
'label' => Mage::helper('customtab')->__('File'),
|
20 |
+
'required' => false,
|
21 |
+
'name' => 'filename',
|
22 |
+
));
|
23 |
+
|
24 |
+
$fieldset->addField('status', 'select', array(
|
25 |
+
'label' => Mage::helper('customtab')->__('Status'),
|
26 |
+
'name' => 'status',
|
27 |
+
'values' => array(
|
28 |
+
array(
|
29 |
+
'value' => 1,
|
30 |
+
'label' => Mage::helper('customtab')->__('Enabled'),
|
31 |
+
),
|
32 |
+
|
33 |
+
array(
|
34 |
+
'value' => 2,
|
35 |
+
'label' => Mage::helper('customtab')->__('Disabled'),
|
36 |
+
),
|
37 |
+
),
|
38 |
+
));
|
39 |
+
|
40 |
+
$fieldset->addField('content', 'editor', array(
|
41 |
+
'name' => 'content',
|
42 |
+
'label' => Mage::helper('customtab')->__('Content'),
|
43 |
+
'title' => Mage::helper('customtab')->__('Content'),
|
44 |
+
'style' => 'width:700px; height:500px;',
|
45 |
+
'wysiwyg' => false,
|
46 |
+
'required' => true,
|
47 |
+
));
|
48 |
+
|
49 |
+
if ( Mage::getSingleton('adminhtml/session')->getCustomtabData() )
|
50 |
+
{
|
51 |
+
$form->setValues(Mage::getSingleton('adminhtml/session')->getCustomtabData());
|
52 |
+
Mage::getSingleton('adminhtml/session')->setCustomtabData(null);
|
53 |
+
} elseif ( Mage::registry('customtab_data') ) {
|
54 |
+
$form->setValues(Mage::registry('customtab_data')->getData());
|
55 |
+
}
|
56 |
+
return parent::_prepareForm();
|
57 |
+
}
|
58 |
+
}
|
app/code/local/Tatva/Customtab/Block/Adminhtml/Customtab/Edit/Tabs.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Customtab_Block_Adminhtml_Customtab_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
4 |
+
{
|
5 |
+
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
parent::__construct();
|
9 |
+
$this->setId('customtab_tabs');
|
10 |
+
$this->setDestElementId('edit_form');
|
11 |
+
$this->setTitle(Mage::helper('customtab')->__('Item Information'));
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _beforeToHtml()
|
15 |
+
{
|
16 |
+
$this->addTab('form_section', array(
|
17 |
+
'label' => Mage::helper('customtab')->__('Item Information'),
|
18 |
+
'title' => Mage::helper('customtab')->__('Item Information'),
|
19 |
+
'content' => $this->getLayout()->createBlock('customtab/adminhtml_customtab_edit_tab_form')->toHtml(),
|
20 |
+
));
|
21 |
+
|
22 |
+
return parent::_beforeToHtml();
|
23 |
+
}
|
24 |
+
}
|
app/code/local/Tatva/Customtab/Block/Adminhtml/Customtab/Grid.php
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Customtab_Block_Adminhtml_Customtab_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->setId('customtabGrid');
|
9 |
+
$this->setDefaultSort('customtab_id');
|
10 |
+
$this->setDefaultDir('ASC');
|
11 |
+
$this->setSaveParametersInSession(true);
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _prepareCollection()
|
15 |
+
{
|
16 |
+
$collection = Mage::getModel('customtab/customtab')->getCollection();
|
17 |
+
$this->setCollection($collection);
|
18 |
+
return parent::_prepareCollection();
|
19 |
+
}
|
20 |
+
|
21 |
+
protected function _prepareColumns()
|
22 |
+
{
|
23 |
+
$this->addColumn('customtab_id', array(
|
24 |
+
'header' => Mage::helper('customtab')->__('ID'),
|
25 |
+
'align' =>'right',
|
26 |
+
'width' => '50px',
|
27 |
+
'index' => 'customtab_id',
|
28 |
+
));
|
29 |
+
|
30 |
+
$this->addColumn('title', array(
|
31 |
+
'header' => Mage::helper('customtab')->__('Title'),
|
32 |
+
'align' =>'left',
|
33 |
+
'index' => 'title',
|
34 |
+
));
|
35 |
+
|
36 |
+
/*
|
37 |
+
$this->addColumn('content', array(
|
38 |
+
'header' => Mage::helper('customtab')->__('Item Content'),
|
39 |
+
'width' => '150px',
|
40 |
+
'index' => 'content',
|
41 |
+
));
|
42 |
+
*/
|
43 |
+
|
44 |
+
$this->addColumn('status', array(
|
45 |
+
'header' => Mage::helper('customtab')->__('Status'),
|
46 |
+
'align' => 'left',
|
47 |
+
'width' => '80px',
|
48 |
+
'index' => 'status',
|
49 |
+
'type' => 'options',
|
50 |
+
'options' => array(
|
51 |
+
1 => 'Enabled',
|
52 |
+
2 => 'Disabled',
|
53 |
+
),
|
54 |
+
));
|
55 |
+
|
56 |
+
$this->addColumn('action',
|
57 |
+
array(
|
58 |
+
'header' => Mage::helper('customtab')->__('Action'),
|
59 |
+
'width' => '100',
|
60 |
+
'type' => 'action',
|
61 |
+
'getter' => 'getId',
|
62 |
+
'actions' => array(
|
63 |
+
array(
|
64 |
+
'caption' => Mage::helper('customtab')->__('Edit'),
|
65 |
+
'url' => array('base'=> '*/*/edit'),
|
66 |
+
'field' => 'id'
|
67 |
+
)
|
68 |
+
),
|
69 |
+
'filter' => false,
|
70 |
+
'sortable' => false,
|
71 |
+
'index' => 'stores',
|
72 |
+
'is_system' => true,
|
73 |
+
));
|
74 |
+
|
75 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('customtab')->__('CSV'));
|
76 |
+
$this->addExportType('*/*/exportXml', Mage::helper('customtab')->__('XML'));
|
77 |
+
|
78 |
+
return parent::_prepareColumns();
|
79 |
+
}
|
80 |
+
|
81 |
+
protected function _prepareMassaction()
|
82 |
+
{
|
83 |
+
$this->setMassactionIdField('customtab_id');
|
84 |
+
$this->getMassactionBlock()->setFormFieldName('customtab');
|
85 |
+
|
86 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
87 |
+
'label' => Mage::helper('customtab')->__('Delete'),
|
88 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
89 |
+
'confirm' => Mage::helper('customtab')->__('Are you sure?')
|
90 |
+
));
|
91 |
+
|
92 |
+
$statuses = Mage::getSingleton('customtab/status')->getOptionArray();
|
93 |
+
|
94 |
+
array_unshift($statuses, array('label'=>'', 'value'=>''));
|
95 |
+
$this->getMassactionBlock()->addItem('status', array(
|
96 |
+
'label'=> Mage::helper('customtab')->__('Change status'),
|
97 |
+
'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
|
98 |
+
'additional' => array(
|
99 |
+
'visibility' => array(
|
100 |
+
'name' => 'status',
|
101 |
+
'type' => 'select',
|
102 |
+
'class' => 'required-entry',
|
103 |
+
'label' => Mage::helper('customtab')->__('Status'),
|
104 |
+
'values' => $statuses
|
105 |
+
)
|
106 |
+
)
|
107 |
+
));
|
108 |
+
return $this;
|
109 |
+
}
|
110 |
+
|
111 |
+
public function getRowUrl($row)
|
112 |
+
{
|
113 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
114 |
+
}
|
115 |
+
|
116 |
+
}
|
app/code/local/Tatva/Customtab/Block/Customtab.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Tatva_Customtab_Block_Customtab extends Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
public function _prepareLayout()
|
5 |
+
{
|
6 |
+
return parent::_prepareLayout();
|
7 |
+
}
|
8 |
+
|
9 |
+
public function getCustomtab()
|
10 |
+
{
|
11 |
+
if (!$this->hasData('customtab')) {
|
12 |
+
$this->setData('customtab', Mage::registry('customtab'));
|
13 |
+
}
|
14 |
+
return $this->getData('customtab');
|
15 |
+
|
16 |
+
}
|
17 |
+
}
|
app/code/local/Tatva/Customtab/Helper/Data.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Customtab_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
app/code/local/Tatva/Customtab/Model/Customtab.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Customtab_Model_Customtab extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('customtab/customtab');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Tatva/Customtab/Model/Mysql4/Customtab.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Customtab_Model_Mysql4_Customtab extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
// Note that the customtab_id refers to the key field in your database table.
|
8 |
+
$this->_init('customtab/customtab', 'customtab_id');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Tatva/Customtab/Model/Mysql4/Customtab/Collection.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Customtab_Model_Mysql4_Customtab_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('customtab/customtab');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Tatva/Customtab/Model/Status.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Customtab_Model_Status extends Varien_Object
|
4 |
+
{
|
5 |
+
const STATUS_ENABLED = 1;
|
6 |
+
const STATUS_DISABLED = 2;
|
7 |
+
|
8 |
+
static public function getOptionArray()
|
9 |
+
{
|
10 |
+
return array(
|
11 |
+
self::STATUS_ENABLED => Mage::helper('customtab')->__('Enabled'),
|
12 |
+
self::STATUS_DISABLED => Mage::helper('customtab')->__('Disabled')
|
13 |
+
);
|
14 |
+
}
|
15 |
+
}
|
app/code/local/Tatva/Customtab/controllers/Adminhtml/CustomtabController.php
ADDED
@@ -0,0 +1,214 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Customtab_Adminhtml_CustomtabController extends Mage_Adminhtml_Controller_action
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _initAction() {
|
7 |
+
$this->loadLayout()
|
8 |
+
->_setActiveMenu('customtab/items')
|
9 |
+
->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
10 |
+
|
11 |
+
return $this;
|
12 |
+
}
|
13 |
+
|
14 |
+
public function indexAction() {
|
15 |
+
$this->_initAction()
|
16 |
+
->renderLayout();
|
17 |
+
}
|
18 |
+
|
19 |
+
public function editAction() {
|
20 |
+
$id = $this->getRequest()->getParam('id');
|
21 |
+
$model = Mage::getModel('customtab/customtab')->load($id);
|
22 |
+
|
23 |
+
if ($model->getId() || $id == 0) {
|
24 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
25 |
+
if (!empty($data)) {
|
26 |
+
$model->setData($data);
|
27 |
+
}
|
28 |
+
|
29 |
+
Mage::register('customtab_data', $model);
|
30 |
+
|
31 |
+
$this->loadLayout();
|
32 |
+
$this->_setActiveMenu('customtab/items');
|
33 |
+
|
34 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
35 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
|
36 |
+
|
37 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
38 |
+
|
39 |
+
$this->_addContent($this->getLayout()->createBlock('customtab/adminhtml_customtab_edit'))
|
40 |
+
->_addLeft($this->getLayout()->createBlock('customtab/adminhtml_customtab_edit_tabs'));
|
41 |
+
|
42 |
+
$this->renderLayout();
|
43 |
+
} else {
|
44 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('customtab')->__('Item does not exist'));
|
45 |
+
$this->_redirect('*/*/');
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
public function newAction() {
|
50 |
+
$this->_forward('edit');
|
51 |
+
}
|
52 |
+
|
53 |
+
public function saveAction() {
|
54 |
+
if ($data = $this->getRequest()->getPost()) {
|
55 |
+
|
56 |
+
if(isset($_FILES['filename']['name']) && $_FILES['filename']['name'] != '') {
|
57 |
+
try {
|
58 |
+
/* Starting upload */
|
59 |
+
$uploader = new Varien_File_Uploader('filename');
|
60 |
+
|
61 |
+
// Any extention would work
|
62 |
+
$uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
|
63 |
+
$uploader->setAllowRenameFiles(false);
|
64 |
+
|
65 |
+
// Set the file upload mode
|
66 |
+
// false -> get the file directly in the specified folder
|
67 |
+
// true -> get the file in the product like folders
|
68 |
+
// (file.jpg will go in something like /media/f/i/file.jpg)
|
69 |
+
$uploader->setFilesDispersion(false);
|
70 |
+
|
71 |
+
// We set media as the upload dir
|
72 |
+
$path = Mage::getBaseDir('media') . DS ;
|
73 |
+
$uploader->save($path, $_FILES['filename']['name'] );
|
74 |
+
|
75 |
+
} catch (Exception $e) {
|
76 |
+
|
77 |
+
}
|
78 |
+
|
79 |
+
//this way the name is saved in DB
|
80 |
+
$data['filename'] = $_FILES['filename']['name'];
|
81 |
+
}
|
82 |
+
|
83 |
+
|
84 |
+
$model = Mage::getModel('customtab/customtab');
|
85 |
+
$model->setData($data)
|
86 |
+
->setId($this->getRequest()->getParam('id'));
|
87 |
+
|
88 |
+
try {
|
89 |
+
if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
|
90 |
+
$model->setCreatedTime(now())
|
91 |
+
->setUpdateTime(now());
|
92 |
+
} else {
|
93 |
+
$model->setUpdateTime(now());
|
94 |
+
}
|
95 |
+
|
96 |
+
$model->save();
|
97 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('customtab')->__('Item was successfully saved'));
|
98 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
99 |
+
|
100 |
+
if ($this->getRequest()->getParam('back')) {
|
101 |
+
$this->_redirect('*/*/edit', array('id' => $model->getId()));
|
102 |
+
return;
|
103 |
+
}
|
104 |
+
$this->_redirect('*/*/');
|
105 |
+
return;
|
106 |
+
} catch (Exception $e) {
|
107 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
108 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
109 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
110 |
+
return;
|
111 |
+
}
|
112 |
+
}
|
113 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('customtab')->__('Unable to find item to save'));
|
114 |
+
$this->_redirect('*/*/');
|
115 |
+
}
|
116 |
+
|
117 |
+
public function deleteAction() {
|
118 |
+
if( $this->getRequest()->getParam('id') > 0 ) {
|
119 |
+
try {
|
120 |
+
$model = Mage::getModel('customtab/customtab');
|
121 |
+
|
122 |
+
$model->setId($this->getRequest()->getParam('id'))
|
123 |
+
->delete();
|
124 |
+
|
125 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
|
126 |
+
$this->_redirect('*/*/');
|
127 |
+
} catch (Exception $e) {
|
128 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
129 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
130 |
+
}
|
131 |
+
}
|
132 |
+
$this->_redirect('*/*/');
|
133 |
+
}
|
134 |
+
|
135 |
+
public function massDeleteAction() {
|
136 |
+
$customtabIds = $this->getRequest()->getParam('customtab');
|
137 |
+
if(!is_array($customtabIds)) {
|
138 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
|
139 |
+
} else {
|
140 |
+
try {
|
141 |
+
foreach ($customtabIds as $customtabId) {
|
142 |
+
$customtab = Mage::getModel('customtab/customtab')->load($customtabId);
|
143 |
+
$customtab->delete();
|
144 |
+
}
|
145 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
146 |
+
Mage::helper('adminhtml')->__(
|
147 |
+
'Total of %d record(s) were successfully deleted', count($customtabIds)
|
148 |
+
)
|
149 |
+
);
|
150 |
+
} catch (Exception $e) {
|
151 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
152 |
+
}
|
153 |
+
}
|
154 |
+
$this->_redirect('*/*/index');
|
155 |
+
}
|
156 |
+
|
157 |
+
public function massStatusAction()
|
158 |
+
{
|
159 |
+
$customtabIds = $this->getRequest()->getParam('customtab');
|
160 |
+
if(!is_array($customtabIds)) {
|
161 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
|
162 |
+
} else {
|
163 |
+
try {
|
164 |
+
foreach ($customtabIds as $customtabId) {
|
165 |
+
$customtab = Mage::getSingleton('customtab/customtab')
|
166 |
+
->load($customtabId)
|
167 |
+
->setStatus($this->getRequest()->getParam('status'))
|
168 |
+
->setIsMassupdate(true)
|
169 |
+
->save();
|
170 |
+
}
|
171 |
+
$this->_getSession()->addSuccess(
|
172 |
+
$this->__('Total of %d record(s) were successfully updated', count($customtabIds))
|
173 |
+
);
|
174 |
+
} catch (Exception $e) {
|
175 |
+
$this->_getSession()->addError($e->getMessage());
|
176 |
+
}
|
177 |
+
}
|
178 |
+
$this->_redirect('*/*/index');
|
179 |
+
}
|
180 |
+
|
181 |
+
public function exportCsvAction()
|
182 |
+
{
|
183 |
+
$fileName = 'customtab.csv';
|
184 |
+
$content = $this->getLayout()->createBlock('customtab/adminhtml_customtab_grid')
|
185 |
+
->getCsv();
|
186 |
+
|
187 |
+
$this->_sendUploadResponse($fileName, $content);
|
188 |
+
}
|
189 |
+
|
190 |
+
public function exportXmlAction()
|
191 |
+
{
|
192 |
+
$fileName = 'customtab.xml';
|
193 |
+
$content = $this->getLayout()->createBlock('customtab/adminhtml_customtab_grid')
|
194 |
+
->getXml();
|
195 |
+
|
196 |
+
$this->_sendUploadResponse($fileName, $content);
|
197 |
+
}
|
198 |
+
|
199 |
+
protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
|
200 |
+
{
|
201 |
+
$response = $this->getResponse();
|
202 |
+
$response->setHeader('HTTP/1.1 200 OK','');
|
203 |
+
$response->setHeader('Pragma', 'public', true);
|
204 |
+
$response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
|
205 |
+
$response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
|
206 |
+
$response->setHeader('Last-Modified', date('r'));
|
207 |
+
$response->setHeader('Accept-Ranges', 'bytes');
|
208 |
+
$response->setHeader('Content-Length', strlen($content));
|
209 |
+
$response->setHeader('Content-type', $contentType);
|
210 |
+
$response->setBody($content);
|
211 |
+
$response->sendResponse();
|
212 |
+
die;
|
213 |
+
}
|
214 |
+
}
|
app/code/local/Tatva/Customtab/controllers/IndexController.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Tatva_Customtab_IndexController extends Mage_Core_Controller_Front_Action
|
3 |
+
{
|
4 |
+
public function indexAction()
|
5 |
+
{
|
6 |
+
|
7 |
+
$this->loadLayout();
|
8 |
+
$block = $this->getLayout()->createBlock(
|
9 |
+
'Mage_Core_Block_Template',
|
10 |
+
'customtab.customtab',
|
11 |
+
array(
|
12 |
+
'template' => 'customtab/customtab.phtml'
|
13 |
+
)
|
14 |
+
);
|
15 |
+
$this->getLayout()->getBlock('content')->append($block);
|
16 |
+
//$this->getLayout()->getBlock('right')->insert($block, 'catalog.compare.sidebar', true);
|
17 |
+
$this->_initLayoutMessages('core/session');
|
18 |
+
$this->renderLayout();
|
19 |
+
|
20 |
+
|
21 |
+
|
22 |
+
|
23 |
+
}
|
24 |
+
|
25 |
+
public function postAction()
|
26 |
+
{
|
27 |
+
|
28 |
+
$postData = $this->getRequest()->getPost();
|
29 |
+
//print_r($postData);exit;
|
30 |
+
$model = Mage::getModel('customtab/customtab');
|
31 |
+
//print_r($model);exit;
|
32 |
+
$model->setCustomtabId($this->getRequest()->getParam('customtab_id'))
|
33 |
+
->setName($postData['name'])
|
34 |
+
->setEmailId($postData['email_id'])
|
35 |
+
->setContactno($postData['contactno'])
|
36 |
+
->save();
|
37 |
+
Mage::getSingleton('customer/session')->addSuccess(Mage::helper('adminhtml')->__('Rule was successfully saved'));
|
38 |
+
|
39 |
+
// $this->_redirect('*/*/index');'
|
40 |
+
$this->_redirect('*/*/');
|
41 |
+
}
|
42 |
+
}
|
app/code/local/Tatva/Customtab/etc/adminhtml.xml
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
|
4 |
+
|
5 |
+
|
6 |
+
<adminhtml>
|
7 |
+
<menu>
|
8 |
+
<customtab module="customtab">
|
9 |
+
<title>Customtab</title>
|
10 |
+
<sort_order>71</sort_order>
|
11 |
+
<children>
|
12 |
+
<items module="customtab">
|
13 |
+
<title>Manage Items</title>
|
14 |
+
<sort_order>0</sort_order>
|
15 |
+
<action>customtab/adminhtml_customtab</action>
|
16 |
+
</items>
|
17 |
+
</children>
|
18 |
+
</customtab>
|
19 |
+
</menu>
|
20 |
+
<acl>
|
21 |
+
<resources>
|
22 |
+
<all>
|
23 |
+
<title>Allow Everything</title>
|
24 |
+
</all>
|
25 |
+
<admin>
|
26 |
+
<children>
|
27 |
+
<Tatva_Customtab>
|
28 |
+
<title>Customtab Module</title>
|
29 |
+
<sort_order>10</sort_order>
|
30 |
+
</Tatva_Customtab>
|
31 |
+
</children>
|
32 |
+
</admin>
|
33 |
+
</resources>
|
34 |
+
</acl>
|
35 |
+
<layout>
|
36 |
+
<updates>
|
37 |
+
<customtab>
|
38 |
+
<file>customtab.xml</file>
|
39 |
+
</customtab>
|
40 |
+
</updates>
|
41 |
+
</layout>
|
42 |
+
</adminhtml>
|
43 |
+
|
app/code/local/Tatva/Customtab/etc/config.xml
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Tatva_Customtab>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Tatva_Customtab>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<customtab>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Tatva_Customtab</module>
|
14 |
+
<frontName>customtab</frontName>
|
15 |
+
</args>
|
16 |
+
</customtab>
|
17 |
+
</routers>
|
18 |
+
<layout>
|
19 |
+
<updates>
|
20 |
+
<customtab>
|
21 |
+
<file>customtab.xml</file>
|
22 |
+
</customtab>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
</frontend>
|
26 |
+
<admin>
|
27 |
+
<routers>
|
28 |
+
<customtab>
|
29 |
+
<use>admin</use>
|
30 |
+
<args>
|
31 |
+
<module>Tatva_Customtab</module>
|
32 |
+
<frontName>customtab</frontName>
|
33 |
+
</args>
|
34 |
+
</customtab>
|
35 |
+
</routers>
|
36 |
+
</admin>
|
37 |
+
<adminhtml>
|
38 |
+
<menu>
|
39 |
+
<customtab module="customtab">
|
40 |
+
<title>Customtab</title>
|
41 |
+
<sort_order>71</sort_order>
|
42 |
+
<children>
|
43 |
+
<items module="customtab">
|
44 |
+
<title>Manage Items</title>
|
45 |
+
<sort_order>0</sort_order>
|
46 |
+
<action>customtab/adminhtml_customtab</action>
|
47 |
+
</items>
|
48 |
+
</children>
|
49 |
+
</customtab>
|
50 |
+
</menu>
|
51 |
+
<acl>
|
52 |
+
<resources>
|
53 |
+
<all>
|
54 |
+
<title>Allow Everything</title>
|
55 |
+
</all>
|
56 |
+
<admin>
|
57 |
+
<children>
|
58 |
+
<Tatva_Customtab>
|
59 |
+
<title>Customtab Module</title>
|
60 |
+
<sort_order>10</sort_order>
|
61 |
+
</Tatva_Customtab>
|
62 |
+
</children>
|
63 |
+
</admin>
|
64 |
+
</resources>
|
65 |
+
</acl>
|
66 |
+
<layout>
|
67 |
+
<updates>
|
68 |
+
<customtab>
|
69 |
+
<file>customtab.xml</file>
|
70 |
+
</customtab>
|
71 |
+
</updates>
|
72 |
+
</layout>
|
73 |
+
</adminhtml>
|
74 |
+
<global>
|
75 |
+
<models>
|
76 |
+
<customtab>
|
77 |
+
<class>Tatva_Customtab_Model</class>
|
78 |
+
<resourceModel>customtab_mysql4</resourceModel>
|
79 |
+
</customtab>
|
80 |
+
<customtab_mysql4>
|
81 |
+
<class>Tatva_Customtab_Model_Mysql4</class>
|
82 |
+
<entities>
|
83 |
+
<customtab>
|
84 |
+
<table>customtab</table>
|
85 |
+
</customtab>
|
86 |
+
</entities>
|
87 |
+
</customtab_mysql4>
|
88 |
+
</models>
|
89 |
+
<resources>
|
90 |
+
<customtab_setup>
|
91 |
+
<setup>
|
92 |
+
<module>Tatva_Customtab</module>
|
93 |
+
</setup>
|
94 |
+
<connection>
|
95 |
+
<use>core_setup</use>
|
96 |
+
</connection>
|
97 |
+
</customtab_setup>
|
98 |
+
<customtab_write>
|
99 |
+
<connection>
|
100 |
+
<use>core_write</use>
|
101 |
+
</connection>
|
102 |
+
</customtab_write>
|
103 |
+
<customtab_read>
|
104 |
+
<connection>
|
105 |
+
<use>core_read</use>
|
106 |
+
</connection>
|
107 |
+
</customtab_read>
|
108 |
+
</resources>
|
109 |
+
<blocks>
|
110 |
+
<customtab>
|
111 |
+
<class>Tatva_Customtab_Block</class>
|
112 |
+
</customtab>
|
113 |
+
</blocks>
|
114 |
+
<helpers>
|
115 |
+
<customtab>
|
116 |
+
<class>Tatva_Customtab_Helper</class>
|
117 |
+
</customtab>
|
118 |
+
</helpers>
|
119 |
+
</global>
|
120 |
+
</config>
|
app/code/local/Tatva/Customtab/sql/customtab_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
|
9 |
+
-- DROP TABLE IF EXISTS {$this->getTable('customtab')};
|
10 |
+
CREATE TABLE {$this->getTable('customtab')} (
|
11 |
+
`customtab_id` int(11) unsigned NOT NULL auto_increment,
|
12 |
+
`name` varchar(255) NOT NULL default '',
|
13 |
+
`email_id` varchar(255) NOT NULL default '',
|
14 |
+
`contactno`varchar(255) NOT NULL default '',
|
15 |
+
|
16 |
+
`created_time` datetime NULL,
|
17 |
+
`update_time` datetime NULL,
|
18 |
+
PRIMARY KEY (`customtab_id`)
|
19 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
20 |
+
|
21 |
+
");
|
22 |
+
|
23 |
+
$installer->endSetup();
|
app/code/local/Tatva/Downloadablereport/Block/Adminhtml/Downloadablereport.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Tatva_Downloadablereport_Block_Adminhtml_Downloadablereport extends Mage_Adminhtml_Block_Widget_Grid_Container
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
$this->_controller = 'adminhtml_downloadablereport';
|
7 |
+
$this->_blockGroup = 'downloadablereport';
|
8 |
+
$this->_headerText = Mage::helper('downloadablereport')->__('Item Manager');
|
9 |
+
$this->_addButtonLabel = Mage::helper('downloadablereport')->__('Add Item');
|
10 |
+
parent::__construct();
|
11 |
+
}
|
12 |
+
}
|
app/code/local/Tatva/Downloadablereport/Block/Adminhtml/Downloadablereport/Edit.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Downloadablereport_Block_Adminhtml_Downloadablereport_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 = 'downloadablereport';
|
11 |
+
$this->_controller = 'adminhtml_downloadablereport';
|
12 |
+
|
13 |
+
$this->_updateButton('save', 'label', Mage::helper('downloadablereport')->__('Save Item'));
|
14 |
+
$this->_updateButton('delete', 'label', Mage::helper('downloadablereport')->__('Delete Item'));
|
15 |
+
|
16 |
+
$this->_addButton('saveandcontinue', array(
|
17 |
+
'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
|
18 |
+
'onclick' => 'saveAndContinueEdit()',
|
19 |
+
'class' => 'save',
|
20 |
+
), -100);
|
21 |
+
|
22 |
+
$this->_formScripts[] = "
|
23 |
+
function toggleEditor() {
|
24 |
+
if (tinyMCE.getInstanceById('downloadablereport_content') == null) {
|
25 |
+
tinyMCE.execCommand('mceAddControl', false, 'downloadablereport_content');
|
26 |
+
} else {
|
27 |
+
tinyMCE.execCommand('mceRemoveControl', false, 'downloadablereport_content');
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
function saveAndContinueEdit(){
|
32 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
33 |
+
}
|
34 |
+
";
|
35 |
+
}
|
36 |
+
|
37 |
+
public function getHeaderText()
|
38 |
+
{
|
39 |
+
if( Mage::registry('downloadablereport_data') && Mage::registry('downloadablereport_data')->getId() ) {
|
40 |
+
return Mage::helper('downloadablereport')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('downloadablereport_data')->getTitle()));
|
41 |
+
} else {
|
42 |
+
return Mage::helper('downloadablereport')->__('Add Item');
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
app/code/local/Tatva/Downloadablereport/Block/Adminhtml/Downloadablereport/Edit/Form.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Downloadablereport_Block_Adminhtml_Downloadablereport_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
4 |
+
{
|
5 |
+
protected function _prepareForm()
|
6 |
+
{
|
7 |
+
$form = new Varien_Data_Form(array(
|
8 |
+
'id' => 'edit_form',
|
9 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
10 |
+
'method' => 'post',
|
11 |
+
'enctype' => 'multipart/form-data'
|
12 |
+
)
|
13 |
+
);
|
14 |
+
|
15 |
+
$form->setUseContainer(true);
|
16 |
+
$this->setForm($form);
|
17 |
+
return parent::_prepareForm();
|
18 |
+
}
|
19 |
+
}
|
app/code/local/Tatva/Downloadablereport/Block/Adminhtml/Downloadablereport/Edit/Tab/Form.php
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Downloadablereport_Block_Adminhtml_Downloadablereport_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('downloadablereport_form', array('legend'=>Mage::helper('downloadablereport')->__('Item information')));
|
10 |
+
|
11 |
+
$fieldset->addField('title', 'text', array(
|
12 |
+
'label' => Mage::helper('downloadablereport')->__('Title'),
|
13 |
+
'class' => 'required-entry',
|
14 |
+
'required' => true,
|
15 |
+
'name' => 'title',
|
16 |
+
));
|
17 |
+
|
18 |
+
$fieldset->addField('filename', 'file', array(
|
19 |
+
'label' => Mage::helper('downloadablereport')->__('File'),
|
20 |
+
'required' => false,
|
21 |
+
'name' => 'filename',
|
22 |
+
));
|
23 |
+
|
24 |
+
$fieldset->addField('status', 'select', array(
|
25 |
+
'label' => Mage::helper('downloadablereport')->__('Status'),
|
26 |
+
'name' => 'status',
|
27 |
+
'values' => array(
|
28 |
+
array(
|
29 |
+
'value' => 1,
|
30 |
+
'label' => Mage::helper('downloadablereport')->__('Enabled'),
|
31 |
+
),
|
32 |
+
|
33 |
+
array(
|
34 |
+
'value' => 2,
|
35 |
+
'label' => Mage::helper('downloadablereport')->__('Disabled'),
|
36 |
+
),
|
37 |
+
),
|
38 |
+
));
|
39 |
+
|
40 |
+
$fieldset->addField('content', 'editor', array(
|
41 |
+
'name' => 'content',
|
42 |
+
'label' => Mage::helper('downloadablereport')->__('Content'),
|
43 |
+
'title' => Mage::helper('downloadablereport')->__('Content'),
|
44 |
+
'style' => 'width:700px; height:500px;',
|
45 |
+
'wysiwyg' => false,
|
46 |
+
'required' => true,
|
47 |
+
));
|
48 |
+
|
49 |
+
if ( Mage::getSingleton('adminhtml/session')->getDownloadablereportData() )
|
50 |
+
{
|
51 |
+
$form->setValues(Mage::getSingleton('adminhtml/session')->getDownloadablereportData());
|
52 |
+
Mage::getSingleton('adminhtml/session')->setDownloadablereportData(null);
|
53 |
+
} elseif ( Mage::registry('downloadablereport_data') ) {
|
54 |
+
$form->setValues(Mage::registry('downloadablereport_data')->getData());
|
55 |
+
}
|
56 |
+
return parent::_prepareForm();
|
57 |
+
}
|
58 |
+
}
|
app/code/local/Tatva/Downloadablereport/Block/Adminhtml/Downloadablereport/Edit/Tabs.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Downloadablereport_Block_Adminhtml_Downloadablereport_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
4 |
+
{
|
5 |
+
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
parent::__construct();
|
9 |
+
$this->setId('downloadablereport_tabs');
|
10 |
+
$this->setDestElementId('edit_form');
|
11 |
+
$this->setTitle(Mage::helper('downloadablereport')->__('Item Information'));
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _beforeToHtml()
|
15 |
+
{
|
16 |
+
$this->addTab('form_section', array(
|
17 |
+
'label' => Mage::helper('downloadablereport')->__('Item Information'),
|
18 |
+
'title' => Mage::helper('downloadablereport')->__('Item Information'),
|
19 |
+
'content' => $this->getLayout()->createBlock('downloadablereport/adminhtml_downloadablereport_edit_tab_form')->toHtml(),
|
20 |
+
));
|
21 |
+
|
22 |
+
return parent::_beforeToHtml();
|
23 |
+
}
|
24 |
+
}
|
app/code/local/Tatva/Downloadablereport/Block/Adminhtml/Downloadablereport/Grid.php
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Downloadablereport_Block_Adminhtml_Downloadablereport_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->setId('downloadablereportGrid');
|
9 |
+
$this->setDefaultSort('downloadablereport_id');
|
10 |
+
$this->setDefaultDir('ASC');
|
11 |
+
$this->setSaveParametersInSession(true);
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _prepareCollection()
|
15 |
+
{
|
16 |
+
$collection = Mage::getModel('downloadablereport/downloadablereport')->getCollection();
|
17 |
+
$this->setCollection($collection);
|
18 |
+
return parent::_prepareCollection();
|
19 |
+
}
|
20 |
+
|
21 |
+
protected function _prepareColumns()
|
22 |
+
{
|
23 |
+
$this->addColumn('downloadablereport_id', array(
|
24 |
+
'header' => Mage::helper('downloadablereport')->__('ID'),
|
25 |
+
'align' =>'right',
|
26 |
+
'width' => '50px',
|
27 |
+
'index' => 'downloadablereport_id',
|
28 |
+
));
|
29 |
+
|
30 |
+
$this->addColumn('title', array(
|
31 |
+
'header' => Mage::helper('downloadablereport')->__('Title'),
|
32 |
+
'align' =>'left',
|
33 |
+
'index' => 'title',
|
34 |
+
));
|
35 |
+
|
36 |
+
/*
|
37 |
+
$this->addColumn('content', array(
|
38 |
+
'header' => Mage::helper('downloadablereport')->__('Item Content'),
|
39 |
+
'width' => '150px',
|
40 |
+
'index' => 'content',
|
41 |
+
));
|
42 |
+
*/
|
43 |
+
|
44 |
+
$this->addColumn('status', array(
|
45 |
+
'header' => Mage::helper('downloadablereport')->__('Status'),
|
46 |
+
'align' => 'left',
|
47 |
+
'width' => '80px',
|
48 |
+
'index' => 'status',
|
49 |
+
'type' => 'options',
|
50 |
+
'options' => array(
|
51 |
+
1 => 'Enabled',
|
52 |
+
2 => 'Disabled',
|
53 |
+
),
|
54 |
+
));
|
55 |
+
|
56 |
+
$this->addColumn('action',
|
57 |
+
array(
|
58 |
+
'header' => Mage::helper('downloadablereport')->__('Action'),
|
59 |
+
'width' => '100',
|
60 |
+
'type' => 'action',
|
61 |
+
'getter' => 'getId',
|
62 |
+
'actions' => array(
|
63 |
+
array(
|
64 |
+
'caption' => Mage::helper('downloadablereport')->__('Edit'),
|
65 |
+
'url' => array('base'=> '*/*/edit'),
|
66 |
+
'field' => 'id'
|
67 |
+
)
|
68 |
+
),
|
69 |
+
'filter' => false,
|
70 |
+
'sortable' => false,
|
71 |
+
'index' => 'stores',
|
72 |
+
'is_system' => true,
|
73 |
+
));
|
74 |
+
|
75 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('downloadablereport')->__('CSV'));
|
76 |
+
$this->addExportType('*/*/exportXml', Mage::helper('downloadablereport')->__('XML'));
|
77 |
+
|
78 |
+
return parent::_prepareColumns();
|
79 |
+
}
|
80 |
+
|
81 |
+
protected function _prepareMassaction()
|
82 |
+
{
|
83 |
+
$this->setMassactionIdField('downloadablereport_id');
|
84 |
+
$this->getMassactionBlock()->setFormFieldName('downloadablereport');
|
85 |
+
|
86 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
87 |
+
'label' => Mage::helper('downloadablereport')->__('Delete'),
|
88 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
89 |
+
'confirm' => Mage::helper('downloadablereport')->__('Are you sure?')
|
90 |
+
));
|
91 |
+
|
92 |
+
$statuses = Mage::getSingleton('downloadablereport/status')->getOptionArray();
|
93 |
+
|
94 |
+
array_unshift($statuses, array('label'=>'', 'value'=>''));
|
95 |
+
$this->getMassactionBlock()->addItem('status', array(
|
96 |
+
'label'=> Mage::helper('downloadablereport')->__('Change status'),
|
97 |
+
'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
|
98 |
+
'additional' => array(
|
99 |
+
'visibility' => array(
|
100 |
+
'name' => 'status',
|
101 |
+
'type' => 'select',
|
102 |
+
'class' => 'required-entry',
|
103 |
+
'label' => Mage::helper('downloadablereport')->__('Status'),
|
104 |
+
'values' => $statuses
|
105 |
+
)
|
106 |
+
)
|
107 |
+
));
|
108 |
+
return $this;
|
109 |
+
}
|
110 |
+
|
111 |
+
public function getRowUrl($row)
|
112 |
+
{
|
113 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
114 |
+
}
|
115 |
+
|
116 |
+
}
|
app/code/local/Tatva/Downloadablereport/Block/Downloadablereport.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Tatva_Downloadablereport_Block_Downloadablereport extends Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
public function _prepareLayout()
|
5 |
+
{
|
6 |
+
return parent::_prepareLayout();
|
7 |
+
}
|
8 |
+
|
9 |
+
public function getDownloadablereport()
|
10 |
+
{
|
11 |
+
if (!$this->hasData('downloadablereport')) {
|
12 |
+
$this->setData('downloadablereport', Mage::registry('downloadablereport'));
|
13 |
+
}
|
14 |
+
return $this->getData('downloadablereport');
|
15 |
+
|
16 |
+
}
|
17 |
+
}
|
app/code/local/Tatva/Downloadablereport/Helper/Data.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Downloadablereport_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
app/code/local/Tatva/Downloadablereport/Model/Downloadablereport.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Downloadablereport_Model_Downloadablereport extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('downloadablereport/downloadablereport');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Tatva/Downloadablereport/Model/Mysql4/Downloadablereport.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Downloadablereport_Model_Mysql4_Downloadablereport extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
// Note that the downloadablereport_id refers to the key field in your database table.
|
8 |
+
$this->_init('downloadablereport/downloadablereport', 'downloadablereport_id');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Tatva/Downloadablereport/Model/Mysql4/Downloadablereport/Collection.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Downloadablereport_Model_Mysql4_Downloadablereport_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('downloadablereport/downloadablereport');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Tatva/Downloadablereport/Model/Status.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Downloadablereport_Model_Status extends Varien_Object
|
4 |
+
{
|
5 |
+
const STATUS_ENABLED = 1;
|
6 |
+
const STATUS_DISABLED = 2;
|
7 |
+
|
8 |
+
static public function getOptionArray()
|
9 |
+
{
|
10 |
+
return array(
|
11 |
+
self::STATUS_ENABLED => Mage::helper('downloadablereport')->__('Enabled'),
|
12 |
+
self::STATUS_DISABLED => Mage::helper('downloadablereport')->__('Disabled')
|
13 |
+
);
|
14 |
+
}
|
15 |
+
}
|
app/code/local/Tatva/Downloadablereport/controllers/Adminhtml/DownloadablereportController.php
ADDED
@@ -0,0 +1,214 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Downloadablereport_Adminhtml_DownloadablereportController extends Mage_Adminhtml_Controller_action
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _initAction() {
|
7 |
+
$this->loadLayout()
|
8 |
+
->_setActiveMenu('downloadablereport/items')
|
9 |
+
->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
10 |
+
|
11 |
+
return $this;
|
12 |
+
}
|
13 |
+
|
14 |
+
public function indexAction() {
|
15 |
+
$this->_initAction()
|
16 |
+
->renderLayout();
|
17 |
+
}
|
18 |
+
|
19 |
+
public function editAction() {
|
20 |
+
$id = $this->getRequest()->getParam('id');
|
21 |
+
$model = Mage::getModel('downloadablereport/downloadablereport')->load($id);
|
22 |
+
|
23 |
+
if ($model->getId() || $id == 0) {
|
24 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
25 |
+
if (!empty($data)) {
|
26 |
+
$model->setData($data);
|
27 |
+
}
|
28 |
+
|
29 |
+
Mage::register('downloadablereport_data', $model);
|
30 |
+
|
31 |
+
$this->loadLayout();
|
32 |
+
$this->_setActiveMenu('downloadablereport/items');
|
33 |
+
|
34 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
35 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
|
36 |
+
|
37 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
38 |
+
|
39 |
+
$this->_addContent($this->getLayout()->createBlock('downloadablereport/adminhtml_downloadablereport_edit'))
|
40 |
+
->_addLeft($this->getLayout()->createBlock('downloadablereport/adminhtml_downloadablereport_edit_tabs'));
|
41 |
+
|
42 |
+
$this->renderLayout();
|
43 |
+
} else {
|
44 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('downloadablereport')->__('Item does not exist'));
|
45 |
+
$this->_redirect('*/*/');
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
public function newAction() {
|
50 |
+
$this->_forward('edit');
|
51 |
+
}
|
52 |
+
|
53 |
+
public function saveAction() {
|
54 |
+
if ($data = $this->getRequest()->getPost()) {
|
55 |
+
|
56 |
+
if(isset($_FILES['filename']['name']) && $_FILES['filename']['name'] != '') {
|
57 |
+
try {
|
58 |
+
/* Starting upload */
|
59 |
+
$uploader = new Varien_File_Uploader('filename');
|
60 |
+
|
61 |
+
// Any extention would work
|
62 |
+
$uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
|
63 |
+
$uploader->setAllowRenameFiles(false);
|
64 |
+
|
65 |
+
// Set the file upload mode
|
66 |
+
// false -> get the file directly in the specified folder
|
67 |
+
// true -> get the file in the product like folders
|
68 |
+
// (file.jpg will go in something like /media/f/i/file.jpg)
|
69 |
+
$uploader->setFilesDispersion(false);
|
70 |
+
|
71 |
+
// We set media as the upload dir
|
72 |
+
$path = Mage::getBaseDir('media') . DS ;
|
73 |
+
$uploader->save($path, $_FILES['filename']['name'] );
|
74 |
+
|
75 |
+
} catch (Exception $e) {
|
76 |
+
|
77 |
+
}
|
78 |
+
|
79 |
+
//this way the name is saved in DB
|
80 |
+
$data['filename'] = $_FILES['filename']['name'];
|
81 |
+
}
|
82 |
+
|
83 |
+
|
84 |
+
$model = Mage::getModel('downloadablereport/downloadablereport');
|
85 |
+
$model->setData($data)
|
86 |
+
->setId($this->getRequest()->getParam('id'));
|
87 |
+
|
88 |
+
try {
|
89 |
+
if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
|
90 |
+
$model->setCreatedTime(now())
|
91 |
+
->setUpdateTime(now());
|
92 |
+
} else {
|
93 |
+
$model->setUpdateTime(now());
|
94 |
+
}
|
95 |
+
|
96 |
+
$model->save();
|
97 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('downloadablereport')->__('Item was successfully saved'));
|
98 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
99 |
+
|
100 |
+
if ($this->getRequest()->getParam('back')) {
|
101 |
+
$this->_redirect('*/*/edit', array('id' => $model->getId()));
|
102 |
+
return;
|
103 |
+
}
|
104 |
+
$this->_redirect('*/*/');
|
105 |
+
return;
|
106 |
+
} catch (Exception $e) {
|
107 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
108 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
109 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
110 |
+
return;
|
111 |
+
}
|
112 |
+
}
|
113 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('downloadablereport')->__('Unable to find item to save'));
|
114 |
+
$this->_redirect('*/*/');
|
115 |
+
}
|
116 |
+
|
117 |
+
public function deleteAction() {
|
118 |
+
if( $this->getRequest()->getParam('id') > 0 ) {
|
119 |
+
try {
|
120 |
+
$model = Mage::getModel('downloadablereport/downloadablereport');
|
121 |
+
|
122 |
+
$model->setId($this->getRequest()->getParam('id'))
|
123 |
+
->delete();
|
124 |
+
|
125 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
|
126 |
+
$this->_redirect('*/*/');
|
127 |
+
} catch (Exception $e) {
|
128 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
129 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
130 |
+
}
|
131 |
+
}
|
132 |
+
$this->_redirect('*/*/');
|
133 |
+
}
|
134 |
+
|
135 |
+
public function massDeleteAction() {
|
136 |
+
$downloadablereportIds = $this->getRequest()->getParam('downloadablereport');
|
137 |
+
if(!is_array($downloadablereportIds)) {
|
138 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
|
139 |
+
} else {
|
140 |
+
try {
|
141 |
+
foreach ($downloadablereportIds as $downloadablereportId) {
|
142 |
+
$downloadablereport = Mage::getModel('downloadablereport/downloadablereport')->load($downloadablereportId);
|
143 |
+
$downloadablereport->delete();
|
144 |
+
}
|
145 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
146 |
+
Mage::helper('adminhtml')->__(
|
147 |
+
'Total of %d record(s) were successfully deleted', count($downloadablereportIds)
|
148 |
+
)
|
149 |
+
);
|
150 |
+
} catch (Exception $e) {
|
151 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
152 |
+
}
|
153 |
+
}
|
154 |
+
$this->_redirect('*/*/index');
|
155 |
+
}
|
156 |
+
|
157 |
+
public function massStatusAction()
|
158 |
+
{
|
159 |
+
$downloadablereportIds = $this->getRequest()->getParam('downloadablereport');
|
160 |
+
if(!is_array($downloadablereportIds)) {
|
161 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
|
162 |
+
} else {
|
163 |
+
try {
|
164 |
+
foreach ($downloadablereportIds as $downloadablereportId) {
|
165 |
+
$downloadablereport = Mage::getSingleton('downloadablereport/downloadablereport')
|
166 |
+
->load($downloadablereportId)
|
167 |
+
->setStatus($this->getRequest()->getParam('status'))
|
168 |
+
->setIsMassupdate(true)
|
169 |
+
->save();
|
170 |
+
}
|
171 |
+
$this->_getSession()->addSuccess(
|
172 |
+
$this->__('Total of %d record(s) were successfully updated', count($downloadablereportIds))
|
173 |
+
);
|
174 |
+
} catch (Exception $e) {
|
175 |
+
$this->_getSession()->addError($e->getMessage());
|
176 |
+
}
|
177 |
+
}
|
178 |
+
$this->_redirect('*/*/index');
|
179 |
+
}
|
180 |
+
|
181 |
+
public function exportCsvAction()
|
182 |
+
{
|
183 |
+
$fileName = 'downloadablereport.csv';
|
184 |
+
$content = $this->getLayout()->createBlock('downloadablereport/adminhtml_downloadablereport_grid')
|
185 |
+
->getCsv();
|
186 |
+
|
187 |
+
$this->_sendUploadResponse($fileName, $content);
|
188 |
+
}
|
189 |
+
|
190 |
+
public function exportXmlAction()
|
191 |
+
{
|
192 |
+
$fileName = 'downloadablereport.xml';
|
193 |
+
$content = $this->getLayout()->createBlock('downloadablereport/adminhtml_downloadablereport_grid')
|
194 |
+
->getXml();
|
195 |
+
|
196 |
+
$this->_sendUploadResponse($fileName, $content);
|
197 |
+
}
|
198 |
+
|
199 |
+
protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
|
200 |
+
{
|
201 |
+
$response = $this->getResponse();
|
202 |
+
$response->setHeader('HTTP/1.1 200 OK','');
|
203 |
+
$response->setHeader('Pragma', 'public', true);
|
204 |
+
$response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
|
205 |
+
$response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
|
206 |
+
$response->setHeader('Last-Modified', date('r'));
|
207 |
+
$response->setHeader('Accept-Ranges', 'bytes');
|
208 |
+
$response->setHeader('Content-Length', strlen($content));
|
209 |
+
$response->setHeader('Content-type', $contentType);
|
210 |
+
$response->setBody($content);
|
211 |
+
$response->sendResponse();
|
212 |
+
die;
|
213 |
+
}
|
214 |
+
}
|
app/code/local/Tatva/Downloadablereport/controllers/IndexController.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Tatva_Downloadablereport_IndexController extends Mage_Core_Controller_Front_Action
|
3 |
+
{
|
4 |
+
public function indexAction()
|
5 |
+
{
|
6 |
+
|
7 |
+
/*
|
8 |
+
* Load an object by id
|
9 |
+
* Request looking like:
|
10 |
+
* http://site.com/downloadablereport?id=15
|
11 |
+
* or
|
12 |
+
* http://site.com/downloadablereport/id/15
|
13 |
+
*/
|
14 |
+
/*
|
15 |
+
$downloadablereport_id = $this->getRequest()->getParam('id');
|
16 |
+
|
17 |
+
if($downloadablereport_id != null && $downloadablereport_id != '') {
|
18 |
+
$downloadablereport = Mage::getModel('downloadablereport/downloadablereport')->load($downloadablereport_id)->getData();
|
19 |
+
} else {
|
20 |
+
$downloadablereport = null;
|
21 |
+
}
|
22 |
+
*/
|
23 |
+
|
24 |
+
/*
|
25 |
+
* If no param we load a the last created item
|
26 |
+
*/
|
27 |
+
/*
|
28 |
+
if($downloadablereport == null) {
|
29 |
+
$resource = Mage::getSingleton('core/resource');
|
30 |
+
$read= $resource->getConnection('core_read');
|
31 |
+
$downloadablereportTable = $resource->getTableName('downloadablereport');
|
32 |
+
|
33 |
+
$select = $read->select()
|
34 |
+
->from($downloadablereportTable,array('downloadablereport_id','title','content','status'))
|
35 |
+
->where('status',1)
|
36 |
+
->order('created_time DESC') ;
|
37 |
+
|
38 |
+
$downloadablereport = $read->fetchRow($select);
|
39 |
+
}
|
40 |
+
Mage::register('downloadablereport', $downloadablereport);
|
41 |
+
*/
|
42 |
+
|
43 |
+
|
44 |
+
$this->loadLayout();
|
45 |
+
$this->renderLayout();
|
46 |
+
}
|
47 |
+
}
|
app/code/local/Tatva/Downloadablereport/etc/config.xml
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Tatva_Downloadablereport>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Tatva_Downloadablereport>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<downloadablereport>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Tatva_Downloadablereport</module>
|
14 |
+
<frontName>downloadablereport</frontName>
|
15 |
+
</args>
|
16 |
+
</downloadablereport>
|
17 |
+
</routers>
|
18 |
+
<layout>
|
19 |
+
<updates>
|
20 |
+
<downloadablereport>
|
21 |
+
<file>downloadablereport.xml</file>
|
22 |
+
</downloadablereport>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
</frontend>
|
26 |
+
<admin>
|
27 |
+
<routers>
|
28 |
+
<downloadablereport>
|
29 |
+
<use>admin</use>
|
30 |
+
<args>
|
31 |
+
<module>Tatva_Downloadablereport</module>
|
32 |
+
<frontName>downloadablereport</frontName>
|
33 |
+
</args>
|
34 |
+
</downloadablereport>
|
35 |
+
</routers>
|
36 |
+
</admin>
|
37 |
+
<adminhtml>
|
38 |
+
<menu>
|
39 |
+
<downloadablereport module="downloadablereport">
|
40 |
+
<title>Downloadablereport</title>
|
41 |
+
<sort_order>71</sort_order>
|
42 |
+
<children>
|
43 |
+
<items module="downloadablereport">
|
44 |
+
<title>Manage Items</title>
|
45 |
+
<sort_order>0</sort_order>
|
46 |
+
<action>downloadablereport/adminhtml_downloadablereport</action>
|
47 |
+
</items>
|
48 |
+
</children>
|
49 |
+
</downloadablereport>
|
50 |
+
</menu>
|
51 |
+
<acl>
|
52 |
+
<resources>
|
53 |
+
<all>
|
54 |
+
<title>Allow Everything</title>
|
55 |
+
</all>
|
56 |
+
<admin>
|
57 |
+
<children>
|
58 |
+
<Tatva_Downloadablereport>
|
59 |
+
<title>Downloadablereport Module</title>
|
60 |
+
<sort_order>10</sort_order>
|
61 |
+
</Tatva_Downloadablereport>
|
62 |
+
</children>
|
63 |
+
</admin>
|
64 |
+
</resources>
|
65 |
+
</acl>
|
66 |
+
<layout>
|
67 |
+
<updates>
|
68 |
+
<downloadablereport>
|
69 |
+
<file>downloadablereport.xml</file>
|
70 |
+
</downloadablereport>
|
71 |
+
</updates>
|
72 |
+
</layout>
|
73 |
+
</adminhtml>
|
74 |
+
<global>
|
75 |
+
<models>
|
76 |
+
<downloadablereport>
|
77 |
+
<class>Tatva_Downloadablereport_Model</class>
|
78 |
+
<resourceModel>downloadablereport_mysql4</resourceModel>
|
79 |
+
</downloadablereport>
|
80 |
+
<downloadablereport_mysql4>
|
81 |
+
<class>Tatva_Downloadablereport_Model_Mysql4</class>
|
82 |
+
<entities>
|
83 |
+
<downloadablereport>
|
84 |
+
<table>downloadablereport</table>
|
85 |
+
</downloadablereport>
|
86 |
+
</entities>
|
87 |
+
</downloadablereport_mysql4>
|
88 |
+
</models>
|
89 |
+
<resources>
|
90 |
+
<downloadablereport_setup>
|
91 |
+
<setup>
|
92 |
+
<module>Tatva_Downloadablereport</module>
|
93 |
+
</setup>
|
94 |
+
<connection>
|
95 |
+
<use>core_setup</use>
|
96 |
+
</connection>
|
97 |
+
</downloadablereport_setup>
|
98 |
+
<downloadablereport_write>
|
99 |
+
<connection>
|
100 |
+
<use>core_write</use>
|
101 |
+
</connection>
|
102 |
+
</downloadablereport_write>
|
103 |
+
<downloadablereport_read>
|
104 |
+
<connection>
|
105 |
+
<use>core_read</use>
|
106 |
+
</connection>
|
107 |
+
</downloadablereport_read>
|
108 |
+
</resources>
|
109 |
+
<blocks>
|
110 |
+
<downloadablereport>
|
111 |
+
<class>Tatva_Downloadablereport_Block</class>
|
112 |
+
</downloadablereport>
|
113 |
+
</blocks>
|
114 |
+
<helpers>
|
115 |
+
<downloadablereport>
|
116 |
+
<class>Tatva_Downloadablereport_Helper</class>
|
117 |
+
</downloadablereport>
|
118 |
+
</helpers>
|
119 |
+
</global>
|
120 |
+
</config>
|
app/code/local/Tatva/Downloadablereport/sql/downloadablereport_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
|
9 |
+
-- DROP TABLE IF EXISTS {$this->getTable('downloadablereport')};
|
10 |
+
CREATE TABLE {$this->getTable('downloadablereport')} (
|
11 |
+
`downloadablereport_id` int(11) unsigned NOT NULL auto_increment,
|
12 |
+
`title` varchar(255) NOT NULL default '',
|
13 |
+
`filename` varchar(255) NOT NULL default '',
|
14 |
+
`content` text NOT NULL default '',
|
15 |
+
`status` smallint(6) NOT NULL default '0',
|
16 |
+
`created_time` datetime NULL,
|
17 |
+
`update_time` datetime NULL,
|
18 |
+
PRIMARY KEY (`downloadablereport_id`)
|
19 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
20 |
+
|
21 |
+
");
|
22 |
+
|
23 |
+
$installer->endSetup();
|
app/code/local/Tatva/Editorder/Block/Adminhtml/Editorder.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Tatva_Editorder_Block_Adminhtml_Editorder extends Mage_Adminhtml_Block_Widget_Grid_Container
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
$this->_controller = 'adminhtml_editorder';
|
7 |
+
$this->_blockGroup = 'editorder';
|
8 |
+
$this->_headerText = Mage::helper('editorder')->__('Item Manager');
|
9 |
+
$this->_addButtonLabel = Mage::helper('editorder')->__('Add Item');
|
10 |
+
parent::__construct();
|
11 |
+
}
|
12 |
+
}
|
app/code/local/Tatva/Editorder/Block/Adminhtml/Editorder/Edit.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Editorder_Block_Adminhtml_Editorder_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 = 'editorder';
|
11 |
+
$this->_controller = 'adminhtml_editorder';
|
12 |
+
|
13 |
+
$this->_updateButton('save', 'label', Mage::helper('editorder')->__('Save Item'));
|
14 |
+
$this->_updateButton('delete', 'label', Mage::helper('editorder')->__('Delete Item'));
|
15 |
+
|
16 |
+
$this->_addButton('saveandcontinue', array(
|
17 |
+
'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
|
18 |
+
'onclick' => 'saveAndContinueEdit()',
|
19 |
+
'class' => 'save',
|
20 |
+
), -100);
|
21 |
+
|
22 |
+
$this->_formScripts[] = "
|
23 |
+
function toggleEditor() {
|
24 |
+
if (tinyMCE.getInstanceById('editorder_content') == null) {
|
25 |
+
tinyMCE.execCommand('mceAddControl', false, 'editorder_content');
|
26 |
+
} else {
|
27 |
+
tinyMCE.execCommand('mceRemoveControl', false, 'editorder_content');
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
function saveAndContinueEdit(){
|
32 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
33 |
+
}
|
34 |
+
";
|
35 |
+
}
|
36 |
+
|
37 |
+
public function getHeaderText()
|
38 |
+
{
|
39 |
+
if( Mage::registry('editorder_data') && Mage::registry('editorder_data')->getId() ) {
|
40 |
+
return Mage::helper('editorder')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('editorder_data')->getTitle()));
|
41 |
+
} else {
|
42 |
+
return Mage::helper('editorder')->__('Add Item');
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
app/code/local/Tatva/Editorder/Block/Adminhtml/Editorder/Edit/Form.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Editorder_Block_Adminhtml_Editorder_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
4 |
+
{
|
5 |
+
protected function _prepareForm()
|
6 |
+
{
|
7 |
+
$form = new Varien_Data_Form(array(
|
8 |
+
'id' => 'edit_form',
|
9 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
10 |
+
'method' => 'post',
|
11 |
+
'enctype' => 'multipart/form-data'
|
12 |
+
)
|
13 |
+
);
|
14 |
+
|
15 |
+
$form->setUseContainer(true);
|
16 |
+
$this->setForm($form);
|
17 |
+
return parent::_prepareForm();
|
18 |
+
}
|
19 |
+
}
|
app/code/local/Tatva/Editorder/Block/Adminhtml/Editorder/Edit/Tab/Form.php
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Editorder_Block_Adminhtml_Editorder_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('editorder_form', array('legend'=>Mage::helper('editorder')->__('Item information')));
|
10 |
+
|
11 |
+
$fieldset->addField('title', 'text', array(
|
12 |
+
'label' => Mage::helper('editorder')->__('Title'),
|
13 |
+
'class' => 'required-entry',
|
14 |
+
'required' => true,
|
15 |
+
'name' => 'title',
|
16 |
+
));
|
17 |
+
|
18 |
+
$fieldset->addField('filename', 'file', array(
|
19 |
+
'label' => Mage::helper('editorder')->__('File'),
|
20 |
+
'required' => false,
|
21 |
+
'name' => 'filename',
|
22 |
+
));
|
23 |
+
|
24 |
+
$fieldset->addField('status', 'select', array(
|
25 |
+
'label' => Mage::helper('editorder')->__('Status'),
|
26 |
+
'name' => 'status',
|
27 |
+
'values' => array(
|
28 |
+
array(
|
29 |
+
'value' => 1,
|
30 |
+
'label' => Mage::helper('editorder')->__('Enabled'),
|
31 |
+
),
|
32 |
+
|
33 |
+
array(
|
34 |
+
'value' => 2,
|
35 |
+
'label' => Mage::helper('editorder')->__('Disabled'),
|
36 |
+
),
|
37 |
+
),
|
38 |
+
));
|
39 |
+
|
40 |
+
$fieldset->addField('content', 'editor', array(
|
41 |
+
'name' => 'content',
|
42 |
+
'label' => Mage::helper('editorder')->__('Content'),
|
43 |
+
'title' => Mage::helper('editorder')->__('Content'),
|
44 |
+
'style' => 'width:700px; height:500px;',
|
45 |
+
'wysiwyg' => false,
|
46 |
+
'required' => true,
|
47 |
+
));
|
48 |
+
|
49 |
+
if ( Mage::getSingleton('adminhtml/session')->getEditorderData() )
|
50 |
+
{
|
51 |
+
$form->setValues(Mage::getSingleton('adminhtml/session')->getEditorderData());
|
52 |
+
Mage::getSingleton('adminhtml/session')->setEditorderData(null);
|
53 |
+
} elseif ( Mage::registry('editorder_data') ) {
|
54 |
+
$form->setValues(Mage::registry('editorder_data')->getData());
|
55 |
+
}
|
56 |
+
return parent::_prepareForm();
|
57 |
+
}
|
58 |
+
}
|
app/code/local/Tatva/Editorder/Block/Adminhtml/Editorder/Edit/Tabs.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Editorder_Block_Adminhtml_Editorder_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
4 |
+
{
|
5 |
+
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
parent::__construct();
|
9 |
+
$this->setId('editorder_tabs');
|
10 |
+
$this->setDestElementId('edit_form');
|
11 |
+
$this->setTitle(Mage::helper('editorder')->__('Item Information'));
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _beforeToHtml()
|
15 |
+
{
|
16 |
+
$this->addTab('form_section', array(
|
17 |
+
'label' => Mage::helper('editorder')->__('Item Information'),
|
18 |
+
'title' => Mage::helper('editorder')->__('Item Information'),
|
19 |
+
'content' => $this->getLayout()->createBlock('editorder/adminhtml_editorder_edit_tab_form')->toHtml(),
|
20 |
+
));
|
21 |
+
|
22 |
+
return parent::_beforeToHtml();
|
23 |
+
}
|
24 |
+
}
|
app/code/local/Tatva/Editorder/Block/Adminhtml/Editorder/Grid.php
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Editorder_Block_Adminhtml_Editorder_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->setId('editorderGrid');
|
9 |
+
$this->setDefaultSort('editorder_id');
|
10 |
+
$this->setDefaultDir('ASC');
|
11 |
+
$this->setSaveParametersInSession(true);
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _prepareCollection()
|
15 |
+
{
|
16 |
+
$collection = Mage::getModel('editorder/editorder')->getCollection();
|
17 |
+
$this->setCollection($collection);
|
18 |
+
return parent::_prepareCollection();
|
19 |
+
}
|
20 |
+
|
21 |
+
protected function _prepareColumns()
|
22 |
+
{
|
23 |
+
$this->addColumn('editorder_id', array(
|
24 |
+
'header' => Mage::helper('editorder')->__('ID'),
|
25 |
+
'align' =>'right',
|
26 |
+
'width' => '50px',
|
27 |
+
'index' => 'editorder_id',
|
28 |
+
));
|
29 |
+
|
30 |
+
$this->addColumn('title', array(
|
31 |
+
'header' => Mage::helper('editorder')->__('Title'),
|
32 |
+
'align' =>'left',
|
33 |
+
'index' => 'title',
|
34 |
+
));
|
35 |
+
|
36 |
+
/*
|
37 |
+
$this->addColumn('content', array(
|
38 |
+
'header' => Mage::helper('editorder')->__('Item Content'),
|
39 |
+
'width' => '150px',
|
40 |
+
'index' => 'content',
|
41 |
+
));
|
42 |
+
*/
|
43 |
+
|
44 |
+
$this->addColumn('status', array(
|
45 |
+
'header' => Mage::helper('editorder')->__('Status'),
|
46 |
+
'align' => 'left',
|
47 |
+
'width' => '80px',
|
48 |
+
'index' => 'status',
|
49 |
+
'type' => 'options',
|
50 |
+
'options' => array(
|
51 |
+
1 => 'Enabled',
|
52 |
+
2 => 'Disabled',
|
53 |
+
),
|
54 |
+
));
|
55 |
+
|
56 |
+
$this->addColumn('action',
|
57 |
+
array(
|
58 |
+
'header' => Mage::helper('editorder')->__('Action'),
|
59 |
+
'width' => '100',
|
60 |
+
'type' => 'action',
|
61 |
+
'getter' => 'getId',
|
62 |
+
'actions' => array(
|
63 |
+
array(
|
64 |
+
'caption' => Mage::helper('editorder')->__('Edit'),
|
65 |
+
'url' => array('base'=> '*/*/edit'),
|
66 |
+
'field' => 'id'
|
67 |
+
)
|
68 |
+
),
|
69 |
+
'filter' => false,
|
70 |
+
'sortable' => false,
|
71 |
+
'index' => 'stores',
|
72 |
+
'is_system' => true,
|
73 |
+
));
|
74 |
+
|
75 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('editorder')->__('CSV'));
|
76 |
+
$this->addExportType('*/*/exportXml', Mage::helper('editorder')->__('XML'));
|
77 |
+
|
78 |
+
return parent::_prepareColumns();
|
79 |
+
}
|
80 |
+
|
81 |
+
protected function _prepareMassaction()
|
82 |
+
{
|
83 |
+
$this->setMassactionIdField('editorder_id');
|
84 |
+
$this->getMassactionBlock()->setFormFieldName('editorder');
|
85 |
+
|
86 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
87 |
+
'label' => Mage::helper('editorder')->__('Delete'),
|
88 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
89 |
+
'confirm' => Mage::helper('editorder')->__('Are you sure?')
|
90 |
+
));
|
91 |
+
|
92 |
+
$statuses = Mage::getSingleton('editorder/status')->getOptionArray();
|
93 |
+
|
94 |
+
array_unshift($statuses, array('label'=>'', 'value'=>''));
|
95 |
+
$this->getMassactionBlock()->addItem('status', array(
|
96 |
+
'label'=> Mage::helper('editorder')->__('Change status'),
|
97 |
+
'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
|
98 |
+
'additional' => array(
|
99 |
+
'visibility' => array(
|
100 |
+
'name' => 'status',
|
101 |
+
'type' => 'select',
|
102 |
+
'class' => 'required-entry',
|
103 |
+
'label' => Mage::helper('editorder')->__('Status'),
|
104 |
+
'values' => $statuses
|
105 |
+
)
|
106 |
+
)
|
107 |
+
));
|
108 |
+
return $this;
|
109 |
+
}
|
110 |
+
|
111 |
+
public function getRowUrl($row)
|
112 |
+
{
|
113 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
114 |
+
}
|
115 |
+
|
116 |
+
}
|
app/code/local/Tatva/Editorder/Block/Editorder.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Tatva_Editorder_Block_Editorder extends Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
public function _prepareLayout()
|
5 |
+
{
|
6 |
+
return parent::_prepareLayout();
|
7 |
+
}
|
8 |
+
|
9 |
+
public function getEditorder()
|
10 |
+
{
|
11 |
+
if (!$this->hasData('editorder')) {
|
12 |
+
$this->setData('editorder', Mage::registry('editorder'));
|
13 |
+
}
|
14 |
+
return $this->getData('editorder');
|
15 |
+
|
16 |
+
}
|
17 |
+
}
|
app/code/local/Tatva/Editorder/Helper/Data.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Editorder_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
app/code/local/Tatva/Editorder/Model/Editorder.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Editorder_Model_Editorder extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('editorder/editorder');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Tatva/Editorder/Model/Mysql4/Editorder.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Editorder_Model_Mysql4_Editorder extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
// Note that the editorder_id refers to the key field in your database table.
|
8 |
+
$this->_init('editorder/editorder', 'editorder_id');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Tatva/Editorder/Model/Mysql4/Editorder/Collection.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Editorder_Model_Mysql4_Editorder_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('editorder/editorder');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Tatva/Editorder/Model/Status.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Editorder_Model_Status extends Varien_Object
|
4 |
+
{
|
5 |
+
const STATUS_ENABLED = 1;
|
6 |
+
const STATUS_DISABLED = 2;
|
7 |
+
|
8 |
+
static public function getOptionArray()
|
9 |
+
{
|
10 |
+
return array(
|
11 |
+
self::STATUS_ENABLED => Mage::helper('editorder')->__('Enabled'),
|
12 |
+
self::STATUS_DISABLED => Mage::helper('editorder')->__('Disabled')
|
13 |
+
);
|
14 |
+
}
|
15 |
+
}
|
app/code/local/Tatva/Editorder/controllers/Adminhtml/EditorderController.php
ADDED
@@ -0,0 +1,214 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Editorder_Adminhtml_EditorderController extends Mage_Adminhtml_Controller_action
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _initAction() {
|
7 |
+
$this->loadLayout()
|
8 |
+
->_setActiveMenu('editorder/items')
|
9 |
+
->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
10 |
+
|
11 |
+
return $this;
|
12 |
+
}
|
13 |
+
|
14 |
+
public function indexAction() {
|
15 |
+
$this->_initAction()
|
16 |
+
->renderLayout();
|
17 |
+
}
|
18 |
+
|
19 |
+
public function editAction() {
|
20 |
+
$id = $this->getRequest()->getParam('id');
|
21 |
+
$model = Mage::getModel('editorder/editorder')->load($id);
|
22 |
+
|
23 |
+
if ($model->getId() || $id == 0) {
|
24 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
25 |
+
if (!empty($data)) {
|
26 |
+
$model->setData($data);
|
27 |
+
}
|
28 |
+
|
29 |
+
Mage::register('editorder_data', $model);
|
30 |
+
|
31 |
+
$this->loadLayout();
|
32 |
+
$this->_setActiveMenu('editorder/items');
|
33 |
+
|
34 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
35 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
|
36 |
+
|
37 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
38 |
+
|
39 |
+
$this->_addContent($this->getLayout()->createBlock('editorder/adminhtml_editorder_edit'))
|
40 |
+
->_addLeft($this->getLayout()->createBlock('editorder/adminhtml_editorder_edit_tabs'));
|
41 |
+
|
42 |
+
$this->renderLayout();
|
43 |
+
} else {
|
44 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('editorder')->__('Item does not exist'));
|
45 |
+
$this->_redirect('*/*/');
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
public function newAction() {
|
50 |
+
$this->_forward('edit');
|
51 |
+
}
|
52 |
+
|
53 |
+
public function saveAction() {
|
54 |
+
if ($data = $this->getRequest()->getPost()) {
|
55 |
+
|
56 |
+
if(isset($_FILES['filename']['name']) && $_FILES['filename']['name'] != '') {
|
57 |
+
try {
|
58 |
+
/* Starting upload */
|
59 |
+
$uploader = new Varien_File_Uploader('filename');
|
60 |
+
|
61 |
+
// Any extention would work
|
62 |
+
$uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
|
63 |
+
$uploader->setAllowRenameFiles(false);
|
64 |
+
|
65 |
+
// Set the file upload mode
|
66 |
+
// false -> get the file directly in the specified folder
|
67 |
+
// true -> get the file in the product like folders
|
68 |
+
// (file.jpg will go in something like /media/f/i/file.jpg)
|
69 |
+
$uploader->setFilesDispersion(false);
|
70 |
+
|
71 |
+
// We set media as the upload dir
|
72 |
+
$path = Mage::getBaseDir('media') . DS ;
|
73 |
+
$uploader->save($path, $_FILES['filename']['name'] );
|
74 |
+
|
75 |
+
} catch (Exception $e) {
|
76 |
+
|
77 |
+
}
|
78 |
+
|
79 |
+
//this way the name is saved in DB
|
80 |
+
$data['filename'] = $_FILES['filename']['name'];
|
81 |
+
}
|
82 |
+
|
83 |
+
|
84 |
+
$model = Mage::getModel('editorder/editorder');
|
85 |
+
$model->setData($data)
|
86 |
+
->setId($this->getRequest()->getParam('id'));
|
87 |
+
|
88 |
+
try {
|
89 |
+
if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
|
90 |
+
$model->setCreatedTime(now())
|
91 |
+
->setUpdateTime(now());
|
92 |
+
} else {
|
93 |
+
$model->setUpdateTime(now());
|
94 |
+
}
|
95 |
+
|
96 |
+
$model->save();
|
97 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('editorder')->__('Item was successfully saved'));
|
98 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
99 |
+
|
100 |
+
if ($this->getRequest()->getParam('back')) {
|
101 |
+
$this->_redirect('*/*/edit', array('id' => $model->getId()));
|
102 |
+
return;
|
103 |
+
}
|
104 |
+
$this->_redirect('*/*/');
|
105 |
+
return;
|
106 |
+
} catch (Exception $e) {
|
107 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
108 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
109 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
110 |
+
return;
|
111 |
+
}
|
112 |
+
}
|
113 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('editorder')->__('Unable to find item to save'));
|
114 |
+
$this->_redirect('*/*/');
|
115 |
+
}
|
116 |
+
|
117 |
+
public function deleteAction() {
|
118 |
+
if( $this->getRequest()->getParam('id') > 0 ) {
|
119 |
+
try {
|
120 |
+
$model = Mage::getModel('editorder/editorder');
|
121 |
+
|
122 |
+
$model->setId($this->getRequest()->getParam('id'))
|
123 |
+
->delete();
|
124 |
+
|
125 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
|
126 |
+
$this->_redirect('*/*/');
|
127 |
+
} catch (Exception $e) {
|
128 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
129 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
130 |
+
}
|
131 |
+
}
|
132 |
+
$this->_redirect('*/*/');
|
133 |
+
}
|
134 |
+
|
135 |
+
public function massDeleteAction() {
|
136 |
+
$editorderIds = $this->getRequest()->getParam('editorder');
|
137 |
+
if(!is_array($editorderIds)) {
|
138 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
|
139 |
+
} else {
|
140 |
+
try {
|
141 |
+
foreach ($editorderIds as $editorderId) {
|
142 |
+
$editorder = Mage::getModel('editorder/editorder')->load($editorderId);
|
143 |
+
$editorder->delete();
|
144 |
+
}
|
145 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
146 |
+
Mage::helper('adminhtml')->__(
|
147 |
+
'Total of %d record(s) were successfully deleted', count($editorderIds)
|
148 |
+
)
|
149 |
+
);
|
150 |
+
} catch (Exception $e) {
|
151 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
152 |
+
}
|
153 |
+
}
|
154 |
+
$this->_redirect('*/*/index');
|
155 |
+
}
|
156 |
+
|
157 |
+
public function massStatusAction()
|
158 |
+
{
|
159 |
+
$editorderIds = $this->getRequest()->getParam('editorder');
|
160 |
+
if(!is_array($editorderIds)) {
|
161 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
|
162 |
+
} else {
|
163 |
+
try {
|
164 |
+
foreach ($editorderIds as $editorderId) {
|
165 |
+
$editorder = Mage::getSingleton('editorder/editorder')
|
166 |
+
->load($editorderId)
|
167 |
+
->setStatus($this->getRequest()->getParam('status'))
|
168 |
+
->setIsMassupdate(true)
|
169 |
+
->save();
|
170 |
+
}
|
171 |
+
$this->_getSession()->addSuccess(
|
172 |
+
$this->__('Total of %d record(s) were successfully updated', count($editorderIds))
|
173 |
+
);
|
174 |
+
} catch (Exception $e) {
|
175 |
+
$this->_getSession()->addError($e->getMessage());
|
176 |
+
}
|
177 |
+
}
|
178 |
+
$this->_redirect('*/*/index');
|
179 |
+
}
|
180 |
+
|
181 |
+
public function exportCsvAction()
|
182 |
+
{
|
183 |
+
$fileName = 'editorder.csv';
|
184 |
+
$content = $this->getLayout()->createBlock('editorder/adminhtml_editorder_grid')
|
185 |
+
->getCsv();
|
186 |
+
|
187 |
+
$this->_sendUploadResponse($fileName, $content);
|
188 |
+
}
|
189 |
+
|
190 |
+
public function exportXmlAction()
|
191 |
+
{
|
192 |
+
$fileName = 'editorder.xml';
|
193 |
+
$content = $this->getLayout()->createBlock('editorder/adminhtml_editorder_grid')
|
194 |
+
->getXml();
|
195 |
+
|
196 |
+
$this->_sendUploadResponse($fileName, $content);
|
197 |
+
}
|
198 |
+
|
199 |
+
protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
|
200 |
+
{
|
201 |
+
$response = $this->getResponse();
|
202 |
+
$response->setHeader('HTTP/1.1 200 OK','');
|
203 |
+
$response->setHeader('Pragma', 'public', true);
|
204 |
+
$response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
|
205 |
+
$response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
|
206 |
+
$response->setHeader('Last-Modified', date('r'));
|
207 |
+
$response->setHeader('Accept-Ranges', 'bytes');
|
208 |
+
$response->setHeader('Content-Length', strlen($content));
|
209 |
+
$response->setHeader('Content-type', $contentType);
|
210 |
+
$response->setBody($content);
|
211 |
+
$response->sendResponse();
|
212 |
+
die;
|
213 |
+
}
|
214 |
+
}
|
app/code/local/Tatva/Editorder/controllers/IndexController.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Tatva_Editorder_IndexController extends Mage_Core_Controller_Front_Action
|
3 |
+
{
|
4 |
+
public function indexAction()
|
5 |
+
{
|
6 |
+
|
7 |
+
/*
|
8 |
+
* Load an object by id
|
9 |
+
* Request looking like:
|
10 |
+
* http://site.com/editorder?id=15
|
11 |
+
* or
|
12 |
+
* http://site.com/editorder/id/15
|
13 |
+
*/
|
14 |
+
/*
|
15 |
+
$editorder_id = $this->getRequest()->getParam('id');
|
16 |
+
|
17 |
+
if($editorder_id != null && $editorder_id != '') {
|
18 |
+
$editorder = Mage::getModel('editorder/editorder')->load($editorder_id)->getData();
|
19 |
+
} else {
|
20 |
+
$editorder = null;
|
21 |
+
}
|
22 |
+
*/
|
23 |
+
|
24 |
+
/*
|
25 |
+
* If no param we load a the last created item
|
26 |
+
*/
|
27 |
+
/*
|
28 |
+
if($editorder == null) {
|
29 |
+
$resource = Mage::getSingleton('core/resource');
|
30 |
+
$read= $resource->getConnection('core_read');
|
31 |
+
$editorderTable = $resource->getTableName('editorder');
|
32 |
+
|
33 |
+
$select = $read->select()
|
34 |
+
->from($editorderTable,array('editorder_id','title','content','status'))
|
35 |
+
->where('status',1)
|
36 |
+
->order('created_time DESC') ;
|
37 |
+
|
38 |
+
$editorder = $read->fetchRow($select);
|
39 |
+
}
|
40 |
+
Mage::register('editorder', $editorder);
|
41 |
+
*/
|
42 |
+
|
43 |
+
|
44 |
+
$this->loadLayout();
|
45 |
+
$this->renderLayout();
|
46 |
+
}
|
47 |
+
}
|
app/code/local/Tatva/Editorder/etc/config.xml
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Tatva_Editorder>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Tatva_Editorder>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<editorder>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Tatva_Editorder</module>
|
14 |
+
<frontName>editorder</frontName>
|
15 |
+
</args>
|
16 |
+
</editorder>
|
17 |
+
</routers>
|
18 |
+
<layout>
|
19 |
+
<updates>
|
20 |
+
<editorder>
|
21 |
+
<file>editorder.xml</file>
|
22 |
+
</editorder>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
</frontend>
|
26 |
+
<admin>
|
27 |
+
<routers>
|
28 |
+
<editorder>
|
29 |
+
<use>admin</use>
|
30 |
+
<args>
|
31 |
+
<module>Tatva_Editorder</module>
|
32 |
+
<frontName>editorder</frontName>
|
33 |
+
</args>
|
34 |
+
</editorder>
|
35 |
+
</routers>
|
36 |
+
</admin>
|
37 |
+
<adminhtml>
|
38 |
+
<menu>
|
39 |
+
<editorder module="editorder">
|
40 |
+
<title>Editorder</title>
|
41 |
+
<sort_order>71</sort_order>
|
42 |
+
<children>
|
43 |
+
<items module="editorder">
|
44 |
+
<title>Manage Items</title>
|
45 |
+
<sort_order>0</sort_order>
|
46 |
+
<action>editorder/adminhtml_editorder</action>
|
47 |
+
</items>
|
48 |
+
</children>
|
49 |
+
</editorder>
|
50 |
+
</menu>
|
51 |
+
<acl>
|
52 |
+
<resources>
|
53 |
+
<all>
|
54 |
+
<title>Allow Everything</title>
|
55 |
+
</all>
|
56 |
+
<admin>
|
57 |
+
<children>
|
58 |
+
<Tatva_Editorder>
|
59 |
+
<title>Editorder Module</title>
|
60 |
+
<sort_order>10</sort_order>
|
61 |
+
</Tatva_Editorder>
|
62 |
+
</children>
|
63 |
+
</admin>
|
64 |
+
</resources>
|
65 |
+
</acl>
|
66 |
+
<layout>
|
67 |
+
<updates>
|
68 |
+
<editorder>
|
69 |
+
<file>editorder.xml</file>
|
70 |
+
</editorder>
|
71 |
+
</updates>
|
72 |
+
</layout>
|
73 |
+
</adminhtml>
|
74 |
+
<global>
|
75 |
+
<models>
|
76 |
+
<editorder>
|
77 |
+
<class>Tatva_Editorder_Model</class>
|
78 |
+
<resourceModel>editorder_mysql4</resourceModel>
|
79 |
+
</editorder>
|
80 |
+
<editorder_mysql4>
|
81 |
+
<class>Tatva_Editorder_Model_Mysql4</class>
|
82 |
+
<entities>
|
83 |
+
<editorder>
|
84 |
+
<table>editorder</table>
|
85 |
+
</editorder>
|
86 |
+
</entities>
|
87 |
+
</editorder_mysql4>
|
88 |
+
</models>
|
89 |
+
<resources>
|
90 |
+
<editorder_setup>
|
91 |
+
<setup>
|
92 |
+
<module>Tatva_Editorder</module>
|
93 |
+
</setup>
|
94 |
+
<connection>
|
95 |
+
<use>core_setup</use>
|
96 |
+
</connection>
|
97 |
+
</editorder_setup>
|
98 |
+
<editorder_write>
|
99 |
+
<connection>
|
100 |
+
<use>core_write</use>
|
101 |
+
</connection>
|
102 |
+
</editorder_write>
|
103 |
+
<editorder_read>
|
104 |
+
<connection>
|
105 |
+
<use>core_read</use>
|
106 |
+
</connection>
|
107 |
+
</editorder_read>
|
108 |
+
</resources>
|
109 |
+
<blocks>
|
110 |
+
<editorder>
|
111 |
+
<class>Tatva_Editorder_Block</class>
|
112 |
+
</editorder>
|
113 |
+
</blocks>
|
114 |
+
<helpers>
|
115 |
+
<editorder>
|
116 |
+
<class>Tatva_Editorder_Helper</class>
|
117 |
+
</editorder>
|
118 |
+
</helpers>
|
119 |
+
</global>
|
120 |
+
</config>
|
app/code/local/Tatva/Editorder/sql/editorder_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
|
9 |
+
-- DROP TABLE IF EXISTS {$this->getTable('editorder')};
|
10 |
+
CREATE TABLE {$this->getTable('editorder')} (
|
11 |
+
`editorder_id` int(11) unsigned NOT NULL auto_increment,
|
12 |
+
`title` varchar(255) NOT NULL default '',
|
13 |
+
`filename` varchar(255) NOT NULL default '',
|
14 |
+
`content` text NOT NULL default '',
|
15 |
+
`status` smallint(6) NOT NULL default '0',
|
16 |
+
`created_time` datetime NULL,
|
17 |
+
`update_time` datetime NULL,
|
18 |
+
PRIMARY KEY (`editorder_id`)
|
19 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
20 |
+
|
21 |
+
");
|
22 |
+
|
23 |
+
$installer->endSetup();
|
app/code/local/Tatva/Gallery/Block/Adminhtml/Gallery.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Tatva_Gallery_Block_Adminhtml_Gallery extends Mage_Adminhtml_Block_Widget_Grid_Container
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
$this->_controller = 'adminhtml_gallery';
|
7 |
+
$this->_blockGroup = 'gallery';
|
8 |
+
$this->_headerText = Mage::helper('gallery')->__('Item Manager');
|
9 |
+
$this->_addButtonLabel = Mage::helper('gallery')->__('Add Item');
|
10 |
+
parent::__construct();
|
11 |
+
}
|
12 |
+
}
|
app/code/local/Tatva/Gallery/Block/Adminhtml/Gallery/Edit.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Gallery_Block_Adminhtml_Gallery_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 = 'gallery';
|
11 |
+
$this->_controller = 'adminhtml_gallery';
|
12 |
+
|
13 |
+
$this->_updateButton('save', 'label', Mage::helper('gallery')->__('Save Item'));
|
14 |
+
$this->_updateButton('delete', 'label', Mage::helper('gallery')->__('Delete Item'));
|
15 |
+
|
16 |
+
$this->_addButton('saveandcontinue', array(
|
17 |
+
'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
|
18 |
+
'onclick' => 'saveAndContinueEdit()',
|
19 |
+
'class' => 'save',
|
20 |
+
), -100);
|
21 |
+
|
22 |
+
$this->_formScripts[] = "
|
23 |
+
function toggleEditor() {
|
24 |
+
if (tinyMCE.getInstanceById('gallery_content') == null) {
|
25 |
+
tinyMCE.execCommand('mceAddControl', false, 'gallery_content');
|
26 |
+
} else {
|
27 |
+
tinyMCE.execCommand('mceRemoveControl', false, 'gallery_content');
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
function saveAndContinueEdit(){
|
32 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
33 |
+
}
|
34 |
+
";
|
35 |
+
}
|
36 |
+
|
37 |
+
public function getHeaderText()
|
38 |
+
{
|
39 |
+
if( Mage::registry('gallery_data') && Mage::registry('gallery_data')->getId() ) {
|
40 |
+
return Mage::helper('gallery')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('gallery_data')->getTitle()));
|
41 |
+
} else {
|
42 |
+
return Mage::helper('gallery')->__('Add Item');
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
app/code/local/Tatva/Gallery/Block/Adminhtml/Gallery/Edit/Form.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Gallery_Block_Adminhtml_Gallery_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
4 |
+
{
|
5 |
+
protected function _prepareForm()
|
6 |
+
{
|
7 |
+
$form = new Varien_Data_Form(array(
|
8 |
+
'id' => 'edit_form',
|
9 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
10 |
+
'method' => 'post',
|
11 |
+
'enctype' => 'multipart/form-data'
|
12 |
+
)
|
13 |
+
);
|
14 |
+
|
15 |
+
$form->setUseContainer(true);
|
16 |
+
$this->setForm($form);
|
17 |
+
return parent::_prepareForm();
|
18 |
+
}
|
19 |
+
}
|
app/code/local/Tatva/Gallery/Block/Adminhtml/Gallery/Edit/Tab/Form.php
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Gallery_Block_Adminhtml_Gallery_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('gallery_form', array('legend'=>Mage::helper('gallery')->__('Item information')));
|
10 |
+
|
11 |
+
$fieldset->addField('title', 'text', array(
|
12 |
+
'label' => Mage::helper('gallery')->__('Title'),
|
13 |
+
'class' => 'required-entry',
|
14 |
+
'required' => true,
|
15 |
+
'name' => 'title',
|
16 |
+
));
|
17 |
+
|
18 |
+
$fieldset->addField('filename', 'file', array(
|
19 |
+
'label' => Mage::helper('gallery')->__('File'),
|
20 |
+
'required' => false,
|
21 |
+
'name' => 'filename',
|
22 |
+
));
|
23 |
+
|
24 |
+
$fieldset->addField('status', 'select', array(
|
25 |
+
'label' => Mage::helper('gallery')->__('Status'),
|
26 |
+
'name' => 'status',
|
27 |
+
'values' => array(
|
28 |
+
array(
|
29 |
+
'value' => 1,
|
30 |
+
'label' => Mage::helper('gallery')->__('Enabled'),
|
31 |
+
),
|
32 |
+
|
33 |
+
array(
|
34 |
+
'value' => 2,
|
35 |
+
'label' => Mage::helper('gallery')->__('Disabled'),
|
36 |
+
),
|
37 |
+
),
|
38 |
+
));
|
39 |
+
|
40 |
+
$fieldset->addField('content', 'editor', array(
|
41 |
+
'name' => 'content',
|
42 |
+
'label' => Mage::helper('gallery')->__('Content'),
|
43 |
+
'title' => Mage::helper('gallery')->__('Content'),
|
44 |
+
'style' => 'width:700px; height:500px;',
|
45 |
+
'wysiwyg' => false,
|
46 |
+
'required' => true,
|
47 |
+
));
|
48 |
+
|
49 |
+
if ( Mage::getSingleton('adminhtml/session')->getGalleryData() )
|
50 |
+
{
|
51 |
+
$form->setValues(Mage::getSingleton('adminhtml/session')->getGalleryData());
|
52 |
+
Mage::getSingleton('adminhtml/session')->setGalleryData(null);
|
53 |
+
} elseif ( Mage::registry('gallery_data') ) {
|
54 |
+
$form->setValues(Mage::registry('gallery_data')->getData());
|
55 |
+
}
|
56 |
+
return parent::_prepareForm();
|
57 |
+
}
|
58 |
+
}
|
app/code/local/Tatva/Gallery/Block/Adminhtml/Gallery/Edit/Tabs.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Gallery_Block_Adminhtml_Gallery_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
4 |
+
{
|
5 |
+
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
parent::__construct();
|
9 |
+
$this->setId('gallery_tabs');
|
10 |
+
$this->setDestElementId('edit_form');
|
11 |
+
$this->setTitle(Mage::helper('gallery')->__('Item Information'));
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _beforeToHtml()
|
15 |
+
{
|
16 |
+
$this->addTab('form_section', array(
|
17 |
+
'label' => Mage::helper('gallery')->__('Item Information'),
|
18 |
+
'title' => Mage::helper('gallery')->__('Item Information'),
|
19 |
+
'content' => $this->getLayout()->createBlock('gallery/adminhtml_gallery_edit_tab_form')->toHtml(),
|
20 |
+
));
|
21 |
+
|
22 |
+
return parent::_beforeToHtml();
|
23 |
+
}
|
24 |
+
}
|
app/code/local/Tatva/Gallery/Block/Adminhtml/Gallery/Grid.php
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Gallery_Block_Adminhtml_Gallery_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->setId('galleryGrid');
|
9 |
+
$this->setDefaultSort('gallery_id');
|
10 |
+
$this->setDefaultDir('ASC');
|
11 |
+
$this->setSaveParametersInSession(true);
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _prepareCollection()
|
15 |
+
{
|
16 |
+
$collection = Mage::getModel('gallery/gallery')->getCollection();
|
17 |
+
$this->setCollection($collection);
|
18 |
+
return parent::_prepareCollection();
|
19 |
+
}
|
20 |
+
|
21 |
+
protected function _prepareColumns()
|
22 |
+
{
|
23 |
+
$this->addColumn('gallery_id', array(
|
24 |
+
'header' => Mage::helper('gallery')->__('ID'),
|
25 |
+
'align' =>'right',
|
26 |
+
'width' => '50px',
|
27 |
+
'index' => 'gallery_id',
|
28 |
+
));
|
29 |
+
|
30 |
+
$this->addColumn('title', array(
|
31 |
+
'header' => Mage::helper('gallery')->__('Title'),
|
32 |
+
'align' =>'left',
|
33 |
+
'index' => 'title',
|
34 |
+
));
|
35 |
+
|
36 |
+
/*
|
37 |
+
$this->addColumn('content', array(
|
38 |
+
'header' => Mage::helper('gallery')->__('Item Content'),
|
39 |
+
'width' => '150px',
|
40 |
+
'index' => 'content',
|
41 |
+
));
|
42 |
+
*/
|
43 |
+
|
44 |
+
$this->addColumn('status', array(
|
45 |
+
'header' => Mage::helper('gallery')->__('Status'),
|
46 |
+
'align' => 'left',
|
47 |
+
'width' => '80px',
|
48 |
+
'index' => 'status',
|
49 |
+
'type' => 'options',
|
50 |
+
'options' => array(
|
51 |
+
1 => 'Enabled',
|
52 |
+
2 => 'Disabled',
|
53 |
+
),
|
54 |
+
));
|
55 |
+
|
56 |
+
$this->addColumn('action',
|
57 |
+
array(
|
58 |
+
'header' => Mage::helper('gallery')->__('Action'),
|
59 |
+
'width' => '100',
|
60 |
+
'type' => 'action',
|
61 |
+
'getter' => 'getId',
|
62 |
+
'actions' => array(
|
63 |
+
array(
|
64 |
+
'caption' => Mage::helper('gallery')->__('Edit'),
|
65 |
+
'url' => array('base'=> '*/*/edit'),
|
66 |
+
'field' => 'id'
|
67 |
+
)
|
68 |
+
),
|
69 |
+
'filter' => false,
|
70 |
+
'sortable' => false,
|
71 |
+
'index' => 'stores',
|
72 |
+
'is_system' => true,
|
73 |
+
));
|
74 |
+
|
75 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('gallery')->__('CSV'));
|
76 |
+
$this->addExportType('*/*/exportXml', Mage::helper('gallery')->__('XML'));
|
77 |
+
|
78 |
+
return parent::_prepareColumns();
|
79 |
+
}
|
80 |
+
|
81 |
+
protected function _prepareMassaction()
|
82 |
+
{
|
83 |
+
$this->setMassactionIdField('gallery_id');
|
84 |
+
$this->getMassactionBlock()->setFormFieldName('gallery');
|
85 |
+
|
86 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
87 |
+
'label' => Mage::helper('gallery')->__('Delete'),
|
88 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
89 |
+
'confirm' => Mage::helper('gallery')->__('Are you sure?')
|
90 |
+
));
|
91 |
+
|
92 |
+
$statuses = Mage::getSingleton('gallery/status')->getOptionArray();
|
93 |
+
|
94 |
+
array_unshift($statuses, array('label'=>'', 'value'=>''));
|
95 |
+
$this->getMassactionBlock()->addItem('status', array(
|
96 |
+
'label'=> Mage::helper('gallery')->__('Change status'),
|
97 |
+
'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
|
98 |
+
'additional' => array(
|
99 |
+
'visibility' => array(
|
100 |
+
'name' => 'status',
|
101 |
+
'type' => 'select',
|
102 |
+
'class' => 'required-entry',
|
103 |
+
'label' => Mage::helper('gallery')->__('Status'),
|
104 |
+
'values' => $statuses
|
105 |
+
)
|
106 |
+
)
|
107 |
+
));
|
108 |
+
return $this;
|
109 |
+
}
|
110 |
+
|
111 |
+
public function getRowUrl($row)
|
112 |
+
{
|
113 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
114 |
+
}
|
115 |
+
|
116 |
+
}
|
app/code/local/Tatva/Gallery/Block/Gallery.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Tatva_Gallery_Block_Gallery extends Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
public function _prepareLayout()
|
5 |
+
{
|
6 |
+
return parent::_prepareLayout();
|
7 |
+
}
|
8 |
+
|
9 |
+
public function getGallery()
|
10 |
+
{
|
11 |
+
if (!$this->hasData('gallery')) {
|
12 |
+
$this->setData('gallery', Mage::registry('gallery'));
|
13 |
+
}
|
14 |
+
return $this->getData('gallery');
|
15 |
+
|
16 |
+
}
|
17 |
+
}
|
app/code/local/Tatva/Gallery/Helper/Data.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Gallery_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
app/code/local/Tatva/Gallery/Model/Gallery.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Gallery_Model_Gallery extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('gallery/gallery');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Tatva/Gallery/Model/Mysql4/Gallery.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Gallery_Model_Mysql4_Gallery extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
// Note that the gallery_id refers to the key field in your database table.
|
8 |
+
$this->_init('gallery/gallery', 'gallery_id');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Tatva/Gallery/Model/Mysql4/Gallery/Collection.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Gallery_Model_Mysql4_Gallery_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('gallery/gallery');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Tatva/Gallery/Model/Status.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Gallery_Model_Status extends Varien_Object
|
4 |
+
{
|
5 |
+
const STATUS_ENABLED = 1;
|
6 |
+
const STATUS_DISABLED = 2;
|
7 |
+
|
8 |
+
static public function getOptionArray()
|
9 |
+
{
|
10 |
+
return array(
|
11 |
+
self::STATUS_ENABLED => Mage::helper('gallery')->__('Enabled'),
|
12 |
+
self::STATUS_DISABLED => Mage::helper('gallery')->__('Disabled')
|
13 |
+
);
|
14 |
+
}
|
15 |
+
}
|
app/code/local/Tatva/Gallery/controllers/Adminhtml/GalleryController.php
ADDED
@@ -0,0 +1,214 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Gallery_Adminhtml_GalleryController extends Mage_Adminhtml_Controller_action
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _initAction() {
|
7 |
+
$this->loadLayout()
|
8 |
+
->_setActiveMenu('gallery/items')
|
9 |
+
->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
10 |
+
|
11 |
+
return $this;
|
12 |
+
}
|
13 |
+
|
14 |
+
public function indexAction() {
|
15 |
+
$this->_initAction()
|
16 |
+
->renderLayout();
|
17 |
+
}
|
18 |
+
|
19 |
+
public function editAction() {
|
20 |
+
$id = $this->getRequest()->getParam('id');
|
21 |
+
$model = Mage::getModel('gallery/gallery')->load($id);
|
22 |
+
|
23 |
+
if ($model->getId() || $id == 0) {
|
24 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
25 |
+
if (!empty($data)) {
|
26 |
+
$model->setData($data);
|
27 |
+
}
|
28 |
+
|
29 |
+
Mage::register('gallery_data', $model);
|
30 |
+
|
31 |
+
$this->loadLayout();
|
32 |
+
$this->_setActiveMenu('gallery/items');
|
33 |
+
|
34 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
35 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
|
36 |
+
|
37 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
38 |
+
|
39 |
+
$this->_addContent($this->getLayout()->createBlock('gallery/adminhtml_gallery_edit'))
|
40 |
+
->_addLeft($this->getLayout()->createBlock('gallery/adminhtml_gallery_edit_tabs'));
|
41 |
+
|
42 |
+
$this->renderLayout();
|
43 |
+
} else {
|
44 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('gallery')->__('Item does not exist'));
|
45 |
+
$this->_redirect('*/*/');
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
public function newAction() {
|
50 |
+
$this->_forward('edit');
|
51 |
+
}
|
52 |
+
|
53 |
+
public function saveAction() {
|
54 |
+
if ($data = $this->getRequest()->getPost()) {
|
55 |
+
|
56 |
+
if(isset($_FILES['filename']['name']) && $_FILES['filename']['name'] != '') {
|
57 |
+
try {
|
58 |
+
/* Starting upload */
|
59 |
+
$uploader = new Varien_File_Uploader('filename');
|
60 |
+
|
61 |
+
// Any extention would work
|
62 |
+
$uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
|
63 |
+
$uploader->setAllowRenameFiles(false);
|
64 |
+
|
65 |
+
// Set the file upload mode
|
66 |
+
// false -> get the file directly in the specified folder
|
67 |
+
// true -> get the file in the product like folders
|
68 |
+
// (file.jpg will go in something like /media/f/i/file.jpg)
|
69 |
+
$uploader->setFilesDispersion(false);
|
70 |
+
|
71 |
+
// We set media as the upload dir
|
72 |
+
$path = Mage::getBaseDir('media') . DS ;
|
73 |
+
$uploader->save($path, $_FILES['filename']['name'] );
|
74 |
+
|
75 |
+
} catch (Exception $e) {
|
76 |
+
|
77 |
+
}
|
78 |
+
|
79 |
+
//this way the name is saved in DB
|
80 |
+
$data['filename'] = $_FILES['filename']['name'];
|
81 |
+
}
|
82 |
+
|
83 |
+
|
84 |
+
$model = Mage::getModel('gallery/gallery');
|
85 |
+
$model->setData($data)
|
86 |
+
->setId($this->getRequest()->getParam('id'));
|
87 |
+
|
88 |
+
try {
|
89 |
+
if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
|
90 |
+
$model->setCreatedTime(now())
|
91 |
+
->setUpdateTime(now());
|
92 |
+
} else {
|
93 |
+
$model->setUpdateTime(now());
|
94 |
+
}
|
95 |
+
|
96 |
+
$model->save();
|
97 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('gallery')->__('Item was successfully saved'));
|
98 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
99 |
+
|
100 |
+
if ($this->getRequest()->getParam('back')) {
|
101 |
+
$this->_redirect('*/*/edit', array('id' => $model->getId()));
|
102 |
+
return;
|
103 |
+
}
|
104 |
+
$this->_redirect('*/*/');
|
105 |
+
return;
|
106 |
+
} catch (Exception $e) {
|
107 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
108 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
109 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
110 |
+
return;
|
111 |
+
}
|
112 |
+
}
|
113 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('gallery')->__('Unable to find item to save'));
|
114 |
+
$this->_redirect('*/*/');
|
115 |
+
}
|
116 |
+
|
117 |
+
public function deleteAction() {
|
118 |
+
if( $this->getRequest()->getParam('id') > 0 ) {
|
119 |
+
try {
|
120 |
+
$model = Mage::getModel('gallery/gallery');
|
121 |
+
|
122 |
+
$model->setId($this->getRequest()->getParam('id'))
|
123 |
+
->delete();
|
124 |
+
|
125 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
|
126 |
+
$this->_redirect('*/*/');
|
127 |
+
} catch (Exception $e) {
|
128 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
129 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
130 |
+
}
|
131 |
+
}
|
132 |
+
$this->_redirect('*/*/');
|
133 |
+
}
|
134 |
+
|
135 |
+
public function massDeleteAction() {
|
136 |
+
$galleryIds = $this->getRequest()->getParam('gallery');
|
137 |
+
if(!is_array($galleryIds)) {
|
138 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
|
139 |
+
} else {
|
140 |
+
try {
|
141 |
+
foreach ($galleryIds as $galleryId) {
|
142 |
+
$gallery = Mage::getModel('gallery/gallery')->load($galleryId);
|
143 |
+
$gallery->delete();
|
144 |
+
}
|
145 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
146 |
+
Mage::helper('adminhtml')->__(
|
147 |
+
'Total of %d record(s) were successfully deleted', count($galleryIds)
|
148 |
+
)
|
149 |
+
);
|
150 |
+
} catch (Exception $e) {
|
151 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
152 |
+
}
|
153 |
+
}
|
154 |
+
$this->_redirect('*/*/index');
|
155 |
+
}
|
156 |
+
|
157 |
+
public function massStatusAction()
|
158 |
+
{
|
159 |
+
$galleryIds = $this->getRequest()->getParam('gallery');
|
160 |
+
if(!is_array($galleryIds)) {
|
161 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
|
162 |
+
} else {
|
163 |
+
try {
|
164 |
+
foreach ($galleryIds as $galleryId) {
|
165 |
+
$gallery = Mage::getSingleton('gallery/gallery')
|
166 |
+
->load($galleryId)
|
167 |
+
->setStatus($this->getRequest()->getParam('status'))
|
168 |
+
->setIsMassupdate(true)
|
169 |
+
->save();
|
170 |
+
}
|
171 |
+
$this->_getSession()->addSuccess(
|
172 |
+
$this->__('Total of %d record(s) were successfully updated', count($galleryIds))
|
173 |
+
);
|
174 |
+
} catch (Exception $e) {
|
175 |
+
$this->_getSession()->addError($e->getMessage());
|
176 |
+
}
|
177 |
+
}
|
178 |
+
$this->_redirect('*/*/index');
|
179 |
+
}
|
180 |
+
|
181 |
+
public function exportCsvAction()
|
182 |
+
{
|
183 |
+
$fileName = 'gallery.csv';
|
184 |
+
$content = $this->getLayout()->createBlock('gallery/adminhtml_gallery_grid')
|
185 |
+
->getCsv();
|
186 |
+
|
187 |
+
$this->_sendUploadResponse($fileName, $content);
|
188 |
+
}
|
189 |
+
|
190 |
+
public function exportXmlAction()
|
191 |
+
{
|
192 |
+
$fileName = 'gallery.xml';
|
193 |
+
$content = $this->getLayout()->createBlock('gallery/adminhtml_gallery_grid')
|
194 |
+
->getXml();
|
195 |
+
|
196 |
+
$this->_sendUploadResponse($fileName, $content);
|
197 |
+
}
|
198 |
+
|
199 |
+
protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
|
200 |
+
{
|
201 |
+
$response = $this->getResponse();
|
202 |
+
$response->setHeader('HTTP/1.1 200 OK','');
|
203 |
+
$response->setHeader('Pragma', 'public', true);
|
204 |
+
$response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
|
205 |
+
$response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
|
206 |
+
$response->setHeader('Last-Modified', date('r'));
|
207 |
+
$response->setHeader('Accept-Ranges', 'bytes');
|
208 |
+
$response->setHeader('Content-Length', strlen($content));
|
209 |
+
$response->setHeader('Content-type', $contentType);
|
210 |
+
$response->setBody($content);
|
211 |
+
$response->sendResponse();
|
212 |
+
die;
|
213 |
+
}
|
214 |
+
}
|
app/code/local/Tatva/Gallery/controllers/IndexController.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Tatva_Gallery_IndexController extends Mage_Core_Controller_Front_Action
|
3 |
+
{
|
4 |
+
public function indexAction()
|
5 |
+
{
|
6 |
+
|
7 |
+
/*
|
8 |
+
* Load an object by id
|
9 |
+
* Request looking like:
|
10 |
+
* http://site.com/gallery?id=15
|
11 |
+
* or
|
12 |
+
* http://site.com/gallery/id/15
|
13 |
+
*/
|
14 |
+
/*
|
15 |
+
$gallery_id = $this->getRequest()->getParam('id');
|
16 |
+
|
17 |
+
if($gallery_id != null && $gallery_id != '') {
|
18 |
+
$gallery = Mage::getModel('gallery/gallery')->load($gallery_id)->getData();
|
19 |
+
} else {
|
20 |
+
$gallery = null;
|
21 |
+
}
|
22 |
+
*/
|
23 |
+
|
24 |
+
/*
|
25 |
+
* If no param we load a the last created item
|
26 |
+
*/
|
27 |
+
/*
|
28 |
+
if($gallery == null) {
|
29 |
+
$resource = Mage::getSingleton('core/resource');
|
30 |
+
$read= $resource->getConnection('core_read');
|
31 |
+
$galleryTable = $resource->getTableName('gallery');
|
32 |
+
|
33 |
+
$select = $read->select()
|
34 |
+
->from($galleryTable,array('gallery_id','title','content','status'))
|
35 |
+
->where('status',1)
|
36 |
+
->order('created_time DESC') ;
|
37 |
+
|
38 |
+
$gallery = $read->fetchRow($select);
|
39 |
+
}
|
40 |
+
Mage::register('gallery', $gallery);
|
41 |
+
*/
|
42 |
+
|
43 |
+
|
44 |
+
$this->loadLayout();
|
45 |
+
$this->renderLayout();
|
46 |
+
}
|
47 |
+
}
|
app/code/local/Tatva/Gallery/etc/config.xml
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Tatva_Gallery>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Tatva_Gallery>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<gallery>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Tatva_Gallery</module>
|
14 |
+
<frontName>gallery</frontName>
|
15 |
+
</args>
|
16 |
+
</gallery>
|
17 |
+
</routers>
|
18 |
+
<layout>
|
19 |
+
<updates>
|
20 |
+
<gallery>
|
21 |
+
<file>gallery.xml</file>
|
22 |
+
</gallery>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
</frontend>
|
26 |
+
<admin>
|
27 |
+
<routers>
|
28 |
+
<gallery>
|
29 |
+
<use>admin</use>
|
30 |
+
<args>
|
31 |
+
<module>Tatva_Gallery</module>
|
32 |
+
<frontName>gallery</frontName>
|
33 |
+
</args>
|
34 |
+
</gallery>
|
35 |
+
</routers>
|
36 |
+
</admin>
|
37 |
+
<adminhtml>
|
38 |
+
<menu>
|
39 |
+
<gallery module="gallery">
|
40 |
+
<title>Gallery</title>
|
41 |
+
<sort_order>71</sort_order>
|
42 |
+
<children>
|
43 |
+
<items module="gallery">
|
44 |
+
<title>Manage Items</title>
|
45 |
+
<sort_order>0</sort_order>
|
46 |
+
<action>gallery/adminhtml_gallery</action>
|
47 |
+
</items>
|
48 |
+
</children>
|
49 |
+
</gallery>
|
50 |
+
</menu>
|
51 |
+
<acl>
|
52 |
+
<resources>
|
53 |
+
<all>
|
54 |
+
<title>Allow Everything</title>
|
55 |
+
</all>
|
56 |
+
<admin>
|
57 |
+
<children>
|
58 |
+
<Tatva_Gallery>
|
59 |
+
<title>Gallery Module</title>
|
60 |
+
<sort_order>10</sort_order>
|
61 |
+
</Tatva_Gallery>
|
62 |
+
</children>
|
63 |
+
</admin>
|
64 |
+
</resources>
|
65 |
+
</acl>
|
66 |
+
<layout>
|
67 |
+
<updates>
|
68 |
+
<gallery>
|
69 |
+
<file>gallery.xml</file>
|
70 |
+
</gallery>
|
71 |
+
</updates>
|
72 |
+
</layout>
|
73 |
+
</adminhtml>
|
74 |
+
<global>
|
75 |
+
<models>
|
76 |
+
<gallery>
|
77 |
+
<class>Tatva_Gallery_Model</class>
|
78 |
+
<resourceModel>gallery_mysql4</resourceModel>
|
79 |
+
</gallery>
|
80 |
+
<gallery_mysql4>
|
81 |
+
<class>Tatva_Gallery_Model_Mysql4</class>
|
82 |
+
<entities>
|
83 |
+
<gallery>
|
84 |
+
<table>gallery</table>
|
85 |
+
</gallery>
|
86 |
+
</entities>
|
87 |
+
</gallery_mysql4>
|
88 |
+
</models>
|
89 |
+
<resources>
|
90 |
+
<gallery_setup>
|
91 |
+
<setup>
|
92 |
+
<module>Tatva_Gallery</module>
|
93 |
+
</setup>
|
94 |
+
<connection>
|
95 |
+
<use>core_setup</use>
|
96 |
+
</connection>
|
97 |
+
</gallery_setup>
|
98 |
+
<gallery_write>
|
99 |
+
<connection>
|
100 |
+
<use>core_write</use>
|
101 |
+
</connection>
|
102 |
+
</gallery_write>
|
103 |
+
<gallery_read>
|
104 |
+
<connection>
|
105 |
+
<use>core_read</use>
|
106 |
+
</connection>
|
107 |
+
</gallery_read>
|
108 |
+
</resources>
|
109 |
+
<blocks>
|
110 |
+
<gallery>
|
111 |
+
<class>Tatva_Gallery_Block</class>
|
112 |
+
</gallery>
|
113 |
+
</blocks>
|
114 |
+
<helpers>
|
115 |
+
<gallery>
|
116 |
+
<class>Tatva_Gallery_Helper</class>
|
117 |
+
</gallery>
|
118 |
+
</helpers>
|
119 |
+
</global>
|
120 |
+
</config>
|
app/code/local/Tatva/Gallery/sql/gallery_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
|
9 |
+
-- DROP TABLE IF EXISTS {$this->getTable('gallery')};
|
10 |
+
CREATE TABLE {$this->getTable('gallery')} (
|
11 |
+
`gallery_id` int(11) unsigned NOT NULL auto_increment,
|
12 |
+
`title` varchar(255) NOT NULL default '',
|
13 |
+
`filename` varchar(255) NOT NULL default '',
|
14 |
+
`content` text NOT NULL default '',
|
15 |
+
`status` smallint(6) NOT NULL default '0',
|
16 |
+
`created_time` datetime NULL,
|
17 |
+
`update_time` datetime NULL,
|
18 |
+
PRIMARY KEY (`gallery_id`)
|
19 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
20 |
+
|
21 |
+
");
|
22 |
+
|
23 |
+
$installer->endSetup();
|
app/code/local/Tatva/Orderreport/Block/Adminhtml/Orderreport.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Tatva_Orderreport_Block_Adminhtml_Orderreport extends Mage_Adminhtml_Block_Widget_Grid_Container
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
$this->_controller = 'adminhtml_orderreport';
|
7 |
+
$this->_blockGroup = 'orderreport';
|
8 |
+
$this->_headerText = Mage::helper('orderreport')->__('Item Manager');
|
9 |
+
$this->_addButtonLabel = Mage::helper('orderreport')->__('Add Item');
|
10 |
+
parent::__construct();
|
11 |
+
}
|
12 |
+
}
|
app/code/local/Tatva/Orderreport/Block/Adminhtml/Orderreport/Edit.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Orderreport_Block_Adminhtml_Orderreport_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 = 'orderreport';
|
11 |
+
$this->_controller = 'adminhtml_orderreport';
|
12 |
+
|
13 |
+
$this->_updateButton('save', 'label', Mage::helper('orderreport')->__('Save Item'));
|
14 |
+
$this->_updateButton('delete', 'label', Mage::helper('orderreport')->__('Delete Item'));
|
15 |
+
|
16 |
+
$this->_addButton('saveandcontinue', array(
|
17 |
+
'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
|
18 |
+
'onclick' => 'saveAndContinueEdit()',
|
19 |
+
'class' => 'save',
|
20 |
+
), -100);
|
21 |
+
|
22 |
+
$this->_formScripts[] = "
|
23 |
+
function toggleEditor() {
|
24 |
+
if (tinyMCE.getInstanceById('orderreport_content') == null) {
|
25 |
+
tinyMCE.execCommand('mceAddControl', false, 'orderreport_content');
|
26 |
+
} else {
|
27 |
+
tinyMCE.execCommand('mceRemoveControl', false, 'orderreport_content');
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
function saveAndContinueEdit(){
|
32 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
33 |
+
}
|
34 |
+
";
|
35 |
+
}
|
36 |
+
|
37 |
+
public function getHeaderText()
|
38 |
+
{
|
39 |
+
if( Mage::registry('orderreport_data') && Mage::registry('orderreport_data')->getId() ) {
|
40 |
+
return Mage::helper('orderreport')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('orderreport_data')->getTitle()));
|
41 |
+
} else {
|
42 |
+
return Mage::helper('orderreport')->__('Add Item');
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
app/code/local/Tatva/Orderreport/Block/Adminhtml/Orderreport/Edit/Form.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Orderreport_Block_Adminhtml_Orderreport_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
4 |
+
{
|
5 |
+
protected function _prepareForm()
|
6 |
+
{
|
7 |
+
$form = new Varien_Data_Form(array(
|
8 |
+
'id' => 'edit_form',
|
9 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
10 |
+
'method' => 'post',
|
11 |
+
'enctype' => 'multipart/form-data'
|
12 |
+
)
|
13 |
+
);
|
14 |
+
|
15 |
+
$form->setUseContainer(true);
|
16 |
+
$this->setForm($form);
|
17 |
+
return parent::_prepareForm();
|
18 |
+
}
|
19 |
+
}
|
app/code/local/Tatva/Orderreport/Block/Adminhtml/Orderreport/Edit/Tab/Form.php
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Orderreport_Block_Adminhtml_Orderreport_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('orderreport_form', array('legend'=>Mage::helper('orderreport')->__('Item information')));
|
10 |
+
|
11 |
+
$fieldset->addField('title', 'text', array(
|
12 |
+
'label' => Mage::helper('orderreport')->__('Title'),
|
13 |
+
'class' => 'required-entry',
|
14 |
+
'required' => true,
|
15 |
+
'name' => 'title',
|
16 |
+
));
|
17 |
+
|
18 |
+
$fieldset->addField('filename', 'file', array(
|
19 |
+
'label' => Mage::helper('orderreport')->__('File'),
|
20 |
+
'required' => false,
|
21 |
+
'name' => 'filename',
|
22 |
+
));
|
23 |
+
|
24 |
+
$fieldset->addField('status', 'select', array(
|
25 |
+
'label' => Mage::helper('orderreport')->__('Status'),
|
26 |
+
'name' => 'status',
|
27 |
+
'values' => array(
|
28 |
+
array(
|
29 |
+
'value' => 1,
|
30 |
+
'label' => Mage::helper('orderreport')->__('Enabled'),
|
31 |
+
),
|
32 |
+
|
33 |
+
array(
|
34 |
+
'value' => 2,
|
35 |
+
'label' => Mage::helper('orderreport')->__('Disabled'),
|
36 |
+
),
|
37 |
+
),
|
38 |
+
));
|
39 |
+
|
40 |
+
$fieldset->addField('content', 'editor', array(
|
41 |
+
'name' => 'content',
|
42 |
+
'label' => Mage::helper('orderreport')->__('Content'),
|
43 |
+
'title' => Mage::helper('orderreport')->__('Content'),
|
44 |
+
'style' => 'width:700px; height:500px;',
|
45 |
+
'wysiwyg' => false,
|
46 |
+
'required' => true,
|
47 |
+
));
|
48 |
+
|
49 |
+
if ( Mage::getSingleton('adminhtml/session')->getOrderreportData() )
|
50 |
+
{
|
51 |
+
$form->setValues(Mage::getSingleton('adminhtml/session')->getOrderreportData());
|
52 |
+
Mage::getSingleton('adminhtml/session')->setOrderreportData(null);
|
53 |
+
} elseif ( Mage::registry('orderreport_data') ) {
|
54 |
+
$form->setValues(Mage::registry('orderreport_data')->getData());
|
55 |
+
}
|
56 |
+
return parent::_prepareForm();
|
57 |
+
}
|
58 |
+
}
|
app/code/local/Tatva/Orderreport/Block/Adminhtml/Orderreport/Edit/Tabs.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Orderreport_Block_Adminhtml_Orderreport_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
4 |
+
{
|
5 |
+
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
parent::__construct();
|
9 |
+
$this->setId('orderreport_tabs');
|
10 |
+
$this->setDestElementId('edit_form');
|
11 |
+
$this->setTitle(Mage::helper('orderreport')->__('Item Information'));
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _beforeToHtml()
|
15 |
+
{
|
16 |
+
$this->addTab('form_section', array(
|
17 |
+
'label' => Mage::helper('orderreport')->__('Item Information'),
|
18 |
+
'title' => Mage::helper('orderreport')->__('Item Information'),
|
19 |
+
'content' => $this->getLayout()->createBlock('orderreport/adminhtml_orderreport_edit_tab_form')->toHtml(),
|
20 |
+
));
|
21 |
+
|
22 |
+
return parent::_beforeToHtml();
|
23 |
+
}
|
24 |
+
}
|
app/code/local/Tatva/Orderreport/Block/Adminhtml/Orderreport/Grid.php
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Orderreport_Block_Adminhtml_Orderreport_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->setId('orderreportGrid');
|
9 |
+
$this->setDefaultSort('orderreport_id');
|
10 |
+
$this->setDefaultDir('ASC');
|
11 |
+
$this->setSaveParametersInSession(true);
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _prepareCollection()
|
15 |
+
{
|
16 |
+
$collection = Mage::getModel('orderreport/orderreport')->getCollection();
|
17 |
+
$this->setCollection($collection);
|
18 |
+
return parent::_prepareCollection();
|
19 |
+
}
|
20 |
+
|
21 |
+
protected function _prepareColumns()
|
22 |
+
{
|
23 |
+
$this->addColumn('orderreport_id', array(
|
24 |
+
'header' => Mage::helper('orderreport')->__('ID'),
|
25 |
+
'align' =>'right',
|
26 |
+
'width' => '50px',
|
27 |
+
'index' => 'orderreport_id',
|
28 |
+
));
|
29 |
+
|
30 |
+
$this->addColumn('title', array(
|
31 |
+
'header' => Mage::helper('orderreport')->__('Title'),
|
32 |
+
'align' =>'left',
|
33 |
+
'index' => 'title',
|
34 |
+
));
|
35 |
+
|
36 |
+
/*
|
37 |
+
$this->addColumn('content', array(
|
38 |
+
'header' => Mage::helper('orderreport')->__('Item Content'),
|
39 |
+
'width' => '150px',
|
40 |
+
'index' => 'content',
|
41 |
+
));
|
42 |
+
*/
|
43 |
+
|
44 |
+
$this->addColumn('status', array(
|
45 |
+
'header' => Mage::helper('orderreport')->__('Status'),
|
46 |
+
'align' => 'left',
|
47 |
+
'width' => '80px',
|
48 |
+
'index' => 'status',
|
49 |
+
'type' => 'options',
|
50 |
+
'options' => array(
|
51 |
+
1 => 'Enabled',
|
52 |
+
2 => 'Disabled',
|
53 |
+
),
|
54 |
+
));
|
55 |
+
|
56 |
+
$this->addColumn('action',
|
57 |
+
array(
|
58 |
+
'header' => Mage::helper('orderreport')->__('Action'),
|
59 |
+
'width' => '100',
|
60 |
+
'type' => 'action',
|
61 |
+
'getter' => 'getId',
|
62 |
+
'actions' => array(
|
63 |
+
array(
|
64 |
+
'caption' => Mage::helper('orderreport')->__('Edit'),
|
65 |
+
'url' => array('base'=> '*/*/edit'),
|
66 |
+
'field' => 'id'
|
67 |
+
)
|
68 |
+
),
|
69 |
+
'filter' => false,
|
70 |
+
'sortable' => false,
|
71 |
+
'index' => 'stores',
|
72 |
+
'is_system' => true,
|
73 |
+
));
|
74 |
+
|
75 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('orderreport')->__('CSV'));
|
76 |
+
$this->addExportType('*/*/exportXml', Mage::helper('orderreport')->__('XML'));
|
77 |
+
|
78 |
+
return parent::_prepareColumns();
|
79 |
+
}
|
80 |
+
|
81 |
+
protected function _prepareMassaction()
|
82 |
+
{
|
83 |
+
$this->setMassactionIdField('orderreport_id');
|
84 |
+
$this->getMassactionBlock()->setFormFieldName('orderreport');
|
85 |
+
|
86 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
87 |
+
'label' => Mage::helper('orderreport')->__('Delete'),
|
88 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
89 |
+
'confirm' => Mage::helper('orderreport')->__('Are you sure?')
|
90 |
+
));
|
91 |
+
|
92 |
+
$statuses = Mage::getSingleton('orderreport/status')->getOptionArray();
|
93 |
+
|
94 |
+
array_unshift($statuses, array('label'=>'', 'value'=>''));
|
95 |
+
$this->getMassactionBlock()->addItem('status', array(
|
96 |
+
'label'=> Mage::helper('orderreport')->__('Change status'),
|
97 |
+
'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
|
98 |
+
'additional' => array(
|
99 |
+
'visibility' => array(
|
100 |
+
'name' => 'status',
|
101 |
+
'type' => 'select',
|
102 |
+
'class' => 'required-entry',
|
103 |
+
'label' => Mage::helper('orderreport')->__('Status'),
|
104 |
+
'values' => $statuses
|
105 |
+
)
|
106 |
+
)
|
107 |
+
));
|
108 |
+
return $this;
|
109 |
+
}
|
110 |
+
|
111 |
+
public function getRowUrl($row)
|
112 |
+
{
|
113 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
114 |
+
}
|
115 |
+
|
116 |
+
}
|
app/code/local/Tatva/Orderreport/Block/Orderreport.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Tatva_Orderreport_Block_Orderreport extends Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
public function _prepareLayout()
|
5 |
+
{
|
6 |
+
return parent::_prepareLayout();
|
7 |
+
}
|
8 |
+
|
9 |
+
public function getOrderreport()
|
10 |
+
{
|
11 |
+
if (!$this->hasData('orderreport')) {
|
12 |
+
$this->setData('orderreport', Mage::registry('orderreport'));
|
13 |
+
}
|
14 |
+
return $this->getData('orderreport');
|
15 |
+
|
16 |
+
}
|
17 |
+
}
|
app/code/local/Tatva/Orderreport/Helper/Data.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Orderreport_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
app/code/local/Tatva/Orderreport/Model/Mysql4/Orderreport.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Orderreport_Model_Mysql4_Orderreport extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
// Note that the orderreport_id refers to the key field in your database table.
|
8 |
+
$this->_init('orderreport/orderreport', 'orderreport_id');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Tatva/Orderreport/Model/Mysql4/Orderreport/Collection.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Orderreport_Model_Mysql4_Orderreport_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('orderreport/orderreport');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Tatva/Orderreport/Model/Orderreport.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Orderreport_Model_Orderreport extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('orderreport/orderreport');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Tatva/Orderreport/Model/Status.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Orderreport_Model_Status extends Varien_Object
|
4 |
+
{
|
5 |
+
const STATUS_ENABLED = 1;
|
6 |
+
const STATUS_DISABLED = 2;
|
7 |
+
|
8 |
+
static public function getOptionArray()
|
9 |
+
{
|
10 |
+
return array(
|
11 |
+
self::STATUS_ENABLED => Mage::helper('orderreport')->__('Enabled'),
|
12 |
+
self::STATUS_DISABLED => Mage::helper('orderreport')->__('Disabled')
|
13 |
+
);
|
14 |
+
}
|
15 |
+
}
|
app/code/local/Tatva/Orderreport/controllers/Adminhtml/OrderreportController.php
ADDED
@@ -0,0 +1,214 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Orderreport_Adminhtml_OrderreportController extends Mage_Adminhtml_Controller_action
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _initAction() {
|
7 |
+
$this->loadLayout()
|
8 |
+
->_setActiveMenu('orderreport/items')
|
9 |
+
->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
10 |
+
|
11 |
+
return $this;
|
12 |
+
}
|
13 |
+
|
14 |
+
public function indexAction() {
|
15 |
+
$this->_initAction()
|
16 |
+
->renderLayout();
|
17 |
+
}
|
18 |
+
|
19 |
+
public function editAction() {
|
20 |
+
$id = $this->getRequest()->getParam('id');
|
21 |
+
$model = Mage::getModel('orderreport/orderreport')->load($id);
|
22 |
+
|
23 |
+
if ($model->getId() || $id == 0) {
|
24 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
25 |
+
if (!empty($data)) {
|
26 |
+
$model->setData($data);
|
27 |
+
}
|
28 |
+
|
29 |
+
Mage::register('orderreport_data', $model);
|
30 |
+
|
31 |
+
$this->loadLayout();
|
32 |
+
$this->_setActiveMenu('orderreport/items');
|
33 |
+
|
34 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
35 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
|
36 |
+
|
37 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
38 |
+
|
39 |
+
$this->_addContent($this->getLayout()->createBlock('orderreport/adminhtml_orderreport_edit'))
|
40 |
+
->_addLeft($this->getLayout()->createBlock('orderreport/adminhtml_orderreport_edit_tabs'));
|
41 |
+
|
42 |
+
$this->renderLayout();
|
43 |
+
} else {
|
44 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('orderreport')->__('Item does not exist'));
|
45 |
+
$this->_redirect('*/*/');
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
public function newAction() {
|
50 |
+
$this->_forward('edit');
|
51 |
+
}
|
52 |
+
|
53 |
+
public function saveAction() {
|
54 |
+
if ($data = $this->getRequest()->getPost()) {
|
55 |
+
|
56 |
+
if(isset($_FILES['filename']['name']) && $_FILES['filename']['name'] != '') {
|
57 |
+
try {
|
58 |
+
/* Starting upload */
|
59 |
+
$uploader = new Varien_File_Uploader('filename');
|
60 |
+
|
61 |
+
// Any extention would work
|
62 |
+
$uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
|
63 |
+
$uploader->setAllowRenameFiles(false);
|
64 |
+
|
65 |
+
// Set the file upload mode
|
66 |
+
// false -> get the file directly in the specified folder
|
67 |
+
// true -> get the file in the product like folders
|
68 |
+
// (file.jpg will go in something like /media/f/i/file.jpg)
|
69 |
+
$uploader->setFilesDispersion(false);
|
70 |
+
|
71 |
+
// We set media as the upload dir
|
72 |
+
$path = Mage::getBaseDir('media') . DS ;
|
73 |
+
$uploader->save($path, $_FILES['filename']['name'] );
|
74 |
+
|
75 |
+
} catch (Exception $e) {
|
76 |
+
|
77 |
+
}
|
78 |
+
|
79 |
+
//this way the name is saved in DB
|
80 |
+
$data['filename'] = $_FILES['filename']['name'];
|
81 |
+
}
|
82 |
+
|
83 |
+
|
84 |
+
$model = Mage::getModel('orderreport/orderreport');
|
85 |
+
$model->setData($data)
|
86 |
+
->setId($this->getRequest()->getParam('id'));
|
87 |
+
|
88 |
+
try {
|
89 |
+
if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
|
90 |
+
$model->setCreatedTime(now())
|
91 |
+
->setUpdateTime(now());
|
92 |
+
} else {
|
93 |
+
$model->setUpdateTime(now());
|
94 |
+
}
|
95 |
+
|
96 |
+
$model->save();
|
97 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('orderreport')->__('Item was successfully saved'));
|
98 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
99 |
+
|
100 |
+
if ($this->getRequest()->getParam('back')) {
|
101 |
+
$this->_redirect('*/*/edit', array('id' => $model->getId()));
|
102 |
+
return;
|
103 |
+
}
|
104 |
+
$this->_redirect('*/*/');
|
105 |
+
return;
|
106 |
+
} catch (Exception $e) {
|
107 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
108 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
109 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
110 |
+
return;
|
111 |
+
}
|
112 |
+
}
|
113 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('orderreport')->__('Unable to find item to save'));
|
114 |
+
$this->_redirect('*/*/');
|
115 |
+
}
|
116 |
+
|
117 |
+
public function deleteAction() {
|
118 |
+
if( $this->getRequest()->getParam('id') > 0 ) {
|
119 |
+
try {
|
120 |
+
$model = Mage::getModel('orderreport/orderreport');
|
121 |
+
|
122 |
+
$model->setId($this->getRequest()->getParam('id'))
|
123 |
+
->delete();
|
124 |
+
|
125 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
|
126 |
+
$this->_redirect('*/*/');
|
127 |
+
} catch (Exception $e) {
|
128 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
129 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
130 |
+
}
|
131 |
+
}
|
132 |
+
$this->_redirect('*/*/');
|
133 |
+
}
|
134 |
+
|
135 |
+
public function massDeleteAction() {
|
136 |
+
$orderreportIds = $this->getRequest()->getParam('orderreport');
|
137 |
+
if(!is_array($orderreportIds)) {
|
138 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
|
139 |
+
} else {
|
140 |
+
try {
|
141 |
+
foreach ($orderreportIds as $orderreportId) {
|
142 |
+
$orderreport = Mage::getModel('orderreport/orderreport')->load($orderreportId);
|
143 |
+
$orderreport->delete();
|
144 |
+
}
|
145 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
146 |
+
Mage::helper('adminhtml')->__(
|
147 |
+
'Total of %d record(s) were successfully deleted', count($orderreportIds)
|
148 |
+
)
|
149 |
+
);
|
150 |
+
} catch (Exception $e) {
|
151 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
152 |
+
}
|
153 |
+
}
|
154 |
+
$this->_redirect('*/*/index');
|
155 |
+
}
|
156 |
+
|
157 |
+
public function massStatusAction()
|
158 |
+
{
|
159 |
+
$orderreportIds = $this->getRequest()->getParam('orderreport');
|
160 |
+
if(!is_array($orderreportIds)) {
|
161 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
|
162 |
+
} else {
|
163 |
+
try {
|
164 |
+
foreach ($orderreportIds as $orderreportId) {
|
165 |
+
$orderreport = Mage::getSingleton('orderreport/orderreport')
|
166 |
+
->load($orderreportId)
|
167 |
+
->setStatus($this->getRequest()->getParam('status'))
|
168 |
+
->setIsMassupdate(true)
|
169 |
+
->save();
|
170 |
+
}
|
171 |
+
$this->_getSession()->addSuccess(
|
172 |
+
$this->__('Total of %d record(s) were successfully updated', count($orderreportIds))
|
173 |
+
);
|
174 |
+
} catch (Exception $e) {
|
175 |
+
$this->_getSession()->addError($e->getMessage());
|
176 |
+
}
|
177 |
+
}
|
178 |
+
$this->_redirect('*/*/index');
|
179 |
+
}
|
180 |
+
|
181 |
+
public function exportCsvAction()
|
182 |
+
{
|
183 |
+
$fileName = 'orderreport.csv';
|
184 |
+
$content = $this->getLayout()->createBlock('orderreport/adminhtml_orderreport_grid')
|
185 |
+
->getCsv();
|
186 |
+
|
187 |
+
$this->_sendUploadResponse($fileName, $content);
|
188 |
+
}
|
189 |
+
|
190 |
+
public function exportXmlAction()
|
191 |
+
{
|
192 |
+
$fileName = 'orderreport.xml';
|
193 |
+
$content = $this->getLayout()->createBlock('orderreport/adminhtml_orderreport_grid')
|
194 |
+
->getXml();
|
195 |
+
|
196 |
+
$this->_sendUploadResponse($fileName, $content);
|
197 |
+
}
|
198 |
+
|
199 |
+
protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
|
200 |
+
{
|
201 |
+
$response = $this->getResponse();
|
202 |
+
$response->setHeader('HTTP/1.1 200 OK','');
|
203 |
+
$response->setHeader('Pragma', 'public', true);
|
204 |
+
$response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
|
205 |
+
$response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
|
206 |
+
$response->setHeader('Last-Modified', date('r'));
|
207 |
+
$response->setHeader('Accept-Ranges', 'bytes');
|
208 |
+
$response->setHeader('Content-Length', strlen($content));
|
209 |
+
$response->setHeader('Content-type', $contentType);
|
210 |
+
$response->setBody($content);
|
211 |
+
$response->sendResponse();
|
212 |
+
die;
|
213 |
+
}
|
214 |
+
}
|
app/code/local/Tatva/Orderreport/controllers/IndexController.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Tatva_Orderreport_IndexController extends Mage_Core_Controller_Front_Action
|
3 |
+
{
|
4 |
+
public function indexAction()
|
5 |
+
{
|
6 |
+
|
7 |
+
/*
|
8 |
+
* Load an object by id
|
9 |
+
* Request looking like:
|
10 |
+
* http://site.com/orderreport?id=15
|
11 |
+
* or
|
12 |
+
* http://site.com/orderreport/id/15
|
13 |
+
*/
|
14 |
+
/*
|
15 |
+
$orderreport_id = $this->getRequest()->getParam('id');
|
16 |
+
|
17 |
+
if($orderreport_id != null && $orderreport_id != '') {
|
18 |
+
$orderreport = Mage::getModel('orderreport/orderreport')->load($orderreport_id)->getData();
|
19 |
+
} else {
|
20 |
+
$orderreport = null;
|
21 |
+
}
|
22 |
+
*/
|
23 |
+
|
24 |
+
/*
|
25 |
+
* If no param we load a the last created item
|
26 |
+
*/
|
27 |
+
/*
|
28 |
+
if($orderreport == null) {
|
29 |
+
$resource = Mage::getSingleton('core/resource');
|
30 |
+
$read= $resource->getConnection('core_read');
|
31 |
+
$orderreportTable = $resource->getTableName('orderreport');
|
32 |
+
|
33 |
+
$select = $read->select()
|
34 |
+
->from($orderreportTable,array('orderreport_id','title','content','status'))
|
35 |
+
->where('status',1)
|
36 |
+
->order('created_time DESC') ;
|
37 |
+
|
38 |
+
$orderreport = $read->fetchRow($select);
|
39 |
+
}
|
40 |
+
Mage::register('orderreport', $orderreport);
|
41 |
+
*/
|
42 |
+
|
43 |
+
|
44 |
+
$this->loadLayout();
|
45 |
+
$this->renderLayout();
|
46 |
+
}
|
47 |
+
}
|
app/code/local/Tatva/Orderreport/etc/config.xml
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Tatva_Orderreport>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Tatva_Orderreport>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<orderreport>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Tatva_Orderreport</module>
|
14 |
+
<frontName>orderreport</frontName>
|
15 |
+
</args>
|
16 |
+
</orderreport>
|
17 |
+
</routers>
|
18 |
+
<layout>
|
19 |
+
<updates>
|
20 |
+
<orderreport>
|
21 |
+
<file>orderreport.xml</file>
|
22 |
+
</orderreport>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
</frontend>
|
26 |
+
<admin>
|
27 |
+
<routers>
|
28 |
+
<orderreport>
|
29 |
+
<use>admin</use>
|
30 |
+
<args>
|
31 |
+
<module>Tatva_Orderreport</module>
|
32 |
+
<frontName>orderreport</frontName>
|
33 |
+
</args>
|
34 |
+
</orderreport>
|
35 |
+
</routers>
|
36 |
+
</admin>
|
37 |
+
<adminhtml>
|
38 |
+
<menu>
|
39 |
+
<orderreport module="orderreport">
|
40 |
+
<title>Orderreport</title>
|
41 |
+
<sort_order>71</sort_order>
|
42 |
+
<children>
|
43 |
+
<items module="orderreport">
|
44 |
+
<title>Manage Items</title>
|
45 |
+
<sort_order>0</sort_order>
|
46 |
+
<action>orderreport/adminhtml_orderreport</action>
|
47 |
+
</items>
|
48 |
+
</children>
|
49 |
+
</orderreport>
|
50 |
+
</menu>
|
51 |
+
<acl>
|
52 |
+
<resources>
|
53 |
+
<all>
|
54 |
+
<title>Allow Everything</title>
|
55 |
+
</all>
|
56 |
+
<admin>
|
57 |
+
<children>
|
58 |
+
<Tatva_Orderreport>
|
59 |
+
<title>Orderreport Module</title>
|
60 |
+
<sort_order>10</sort_order>
|
61 |
+
</Tatva_Orderreport>
|
62 |
+
</children>
|
63 |
+
</admin>
|
64 |
+
</resources>
|
65 |
+
</acl>
|
66 |
+
<layout>
|
67 |
+
<updates>
|
68 |
+
<orderreport>
|
69 |
+
<file>orderreport.xml</file>
|
70 |
+
</orderreport>
|
71 |
+
</updates>
|
72 |
+
</layout>
|
73 |
+
</adminhtml>
|
74 |
+
<global>
|
75 |
+
<models>
|
76 |
+
<orderreport>
|
77 |
+
<class>Tatva_Orderreport_Model</class>
|
78 |
+
<resourceModel>orderreport_mysql4</resourceModel>
|
79 |
+
</orderreport>
|
80 |
+
<orderreport_mysql4>
|
81 |
+
<class>Tatva_Orderreport_Model_Mysql4</class>
|
82 |
+
<entities>
|
83 |
+
<orderreport>
|
84 |
+
<table>orderreport</table>
|
85 |
+
</orderreport>
|
86 |
+
</entities>
|
87 |
+
</orderreport_mysql4>
|
88 |
+
</models>
|
89 |
+
<resources>
|
90 |
+
<orderreport_setup>
|
91 |
+
<setup>
|
92 |
+
<module>Tatva_Orderreport</module>
|
93 |
+
</setup>
|
94 |
+
<connection>
|
95 |
+
<use>core_setup</use>
|
96 |
+
</connection>
|
97 |
+
</orderreport_setup>
|
98 |
+
<orderreport_write>
|
99 |
+
<connection>
|
100 |
+
<use>core_write</use>
|
101 |
+
</connection>
|
102 |
+
</orderreport_write>
|
103 |
+
<orderreport_read>
|
104 |
+
<connection>
|
105 |
+
<use>core_read</use>
|
106 |
+
</connection>
|
107 |
+
</orderreport_read>
|
108 |
+
</resources>
|
109 |
+
<blocks>
|
110 |
+
<orderreport>
|
111 |
+
<class>Tatva_Orderreport_Block</class>
|
112 |
+
</orderreport>
|
113 |
+
</blocks>
|
114 |
+
<helpers>
|
115 |
+
<orderreport>
|
116 |
+
<class>Tatva_Orderreport_Helper</class>
|
117 |
+
</orderreport>
|
118 |
+
</helpers>
|
119 |
+
</global>
|
120 |
+
</config>
|
app/code/local/Tatva/Orderreport/sql/orderreport_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
|
9 |
+
-- DROP TABLE IF EXISTS {$this->getTable('orderreport')};
|
10 |
+
CREATE TABLE {$this->getTable('orderreport')} (
|
11 |
+
`orderreport_id` int(11) unsigned NOT NULL auto_increment,
|
12 |
+
`title` varchar(255) NOT NULL default '',
|
13 |
+
`filename` varchar(255) NOT NULL default '',
|
14 |
+
`content` text NOT NULL default '',
|
15 |
+
`status` smallint(6) NOT NULL default '0',
|
16 |
+
`created_time` datetime NULL,
|
17 |
+
`update_time` datetime NULL,
|
18 |
+
PRIMARY KEY (`orderreport_id`)
|
19 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
20 |
+
|
21 |
+
");
|
22 |
+
|
23 |
+
$installer->endSetup();
|
app/code/local/Tatva/Press/Block/Adminhtml/Press.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Tatva_Press_Block_Adminhtml_Press extends Mage_Adminhtml_Block_Widget_Grid_Container
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
$this->_controller = 'adminhtml_press';
|
7 |
+
$this->_blockGroup = 'press';
|
8 |
+
$this->_headerText = Mage::helper('press')->__('Item Manager');
|
9 |
+
$this->_addButtonLabel = Mage::helper('press')->__('Add Item');
|
10 |
+
parent::__construct();
|
11 |
+
}
|
12 |
+
|
13 |
+
/*public function getHeaderCssClass()
|
14 |
+
{
|
15 |
+
return '';
|
16 |
+
}*/
|
17 |
+
}
|
app/code/local/Tatva/Press/Block/Adminhtml/Press/Edit.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Press_Block_Adminhtml_Press_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 = 'press';
|
11 |
+
$this->_controller = 'adminhtml_press';
|
12 |
+
|
13 |
+
$this->_updateButton('save', 'label', Mage::helper('press')->__('Save Item'));
|
14 |
+
$this->_updateButton('delete', 'label', Mage::helper('press')->__('Delete Item'));
|
15 |
+
|
16 |
+
$this->_addButton('saveandcontinue', array(
|
17 |
+
'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
|
18 |
+
'onclick' => 'saveAndContinueEdit()',
|
19 |
+
'class' => 'save',
|
20 |
+
), -100);
|
21 |
+
|
22 |
+
$this->_formScripts[] = "
|
23 |
+
function toggleEditor() {
|
24 |
+
if (tinyMCE.getInstanceById('press_content') == null) {
|
25 |
+
tinyMCE.execCommand('mceAddControl', false, 'press_content');
|
26 |
+
} else {
|
27 |
+
tinyMCE.execCommand('mceRemoveControl', false, 'press_content');
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
function saveAndContinueEdit(){
|
32 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
33 |
+
}
|
34 |
+
";
|
35 |
+
}
|
36 |
+
|
37 |
+
public function getHeaderText()
|
38 |
+
{
|
39 |
+
if( Mage::registry('press_data') && Mage::registry('press_data')->getId() ) {
|
40 |
+
return Mage::helper('press')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('press_data')->getTitle()));
|
41 |
+
} else {
|
42 |
+
return Mage::helper('press')->__('Add Item');
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
/*public function getHeaderCssClass()
|
47 |
+
{
|
48 |
+
return '';
|
49 |
+
}*/
|
50 |
+
}
|
app/code/local/Tatva/Press/Block/Adminhtml/Press/Edit/Form.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Press_Block_Adminhtml_Press_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
4 |
+
{
|
5 |
+
protected function _prepareForm()
|
6 |
+
{
|
7 |
+
$form = new Varien_Data_Form(array(
|
8 |
+
'id' => 'edit_form',
|
9 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
10 |
+
'method' => 'post',
|
11 |
+
'enctype' => 'multipart/form-data'
|
12 |
+
)
|
13 |
+
);
|
14 |
+
|
15 |
+
$form->setUseContainer(true);
|
16 |
+
$this->setForm($form);
|
17 |
+
return parent::_prepareForm();
|
18 |
+
}
|
19 |
+
}
|
app/code/local/Tatva/Press/Block/Adminhtml/Press/Edit/Tab/Form.php
ADDED
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Press_Block_Adminhtml_Press_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Load Wysiwyg on demand and Prepare layout
|
7 |
+
*/
|
8 |
+
|
9 |
+
protected function _prepareForm()
|
10 |
+
{
|
11 |
+
|
12 |
+
$form = new Varien_Data_Form();
|
13 |
+
$form->setHtmlIdPrefix('press_');
|
14 |
+
$this->setForm($form);
|
15 |
+
$fieldset = $form->addFieldset('press_form', array('legend'=>Mage::helper('press')->__('Item information')));
|
16 |
+
$press = Mage::getModel('press/press')->load( $this->getRequest()->getParam('id') );
|
17 |
+
$model = Mage::registry('press_data');
|
18 |
+
$_model = Mage::registry('press_data')->getData();
|
19 |
+
$_data = Mage::getResourceModel('press/press')->edit_form($_model['press_id']);
|
20 |
+
|
21 |
+
if ( Mage::registry('press_data') ) {
|
22 |
+
$model_data = Mage::registry('press_data')->getData();
|
23 |
+
$model_data["stores"] = $_data;
|
24 |
+
$model_data["store_id"] = $_data;
|
25 |
+
}
|
26 |
+
|
27 |
+
$after_html = '';
|
28 |
+
$afterpdf_html = '';
|
29 |
+
if( $press->getDisplaypicture() )
|
30 |
+
{
|
31 |
+
$path = Mage::getBaseUrl('media')."press/".$press->getDisplaypicture();
|
32 |
+
$after_html = '<a href="'.$path.'" target="_blank"><img height="20" width="20" alt="'.$press->getDisplaypicture().'" title="'.$press->getDisplaypicture().'" id="press" src="'.$path.'" style="vertical-align: middle;"/></a>';
|
33 |
+
}
|
34 |
+
if( $press->getPdffile() )
|
35 |
+
{
|
36 |
+
$path = Mage::getBaseUrl('media')."press/pdf/".$press->getPdffile();
|
37 |
+
$afterpdf_html = '<a target="_blank" href="'.$path.'">'.$press->getPdffile().'</a>';
|
38 |
+
}
|
39 |
+
if( $press->getDate() )
|
40 |
+
{
|
41 |
+
$date = $press->getDate();
|
42 |
+
}
|
43 |
+
|
44 |
+
$fieldset->addField('title', 'text', array(
|
45 |
+
'label' => Mage::helper('press')->__('Title'),
|
46 |
+
'class' => 'required-entry',
|
47 |
+
'required' => true,
|
48 |
+
'name' => 'title',
|
49 |
+
));
|
50 |
+
|
51 |
+
$element = $fieldset->addField('date', 'date', array(
|
52 |
+
'name' => 'date',
|
53 |
+
'title' => Mage::helper('press')->__('Press Date'),
|
54 |
+
'label' => Mage::helper('press')->__('Press Date'),
|
55 |
+
'image' => $this->getSkinUrl('images/grid-cal.gif'),
|
56 |
+
'format' => 'yyyy-MM-dd',
|
57 |
+
'class' => 'required-entry validate-date',
|
58 |
+
'required' => true,
|
59 |
+
|
60 |
+
));
|
61 |
+
|
62 |
+
|
63 |
+
$fieldset->addField('displaypicture', 'file', array(
|
64 |
+
'label' => Mage::helper('press')->__('Display Picture'),
|
65 |
+
'required' => false,
|
66 |
+
'class' => 'validate-imagefile',
|
67 |
+
'name' => 'displaypicture',
|
68 |
+
'after_element_html' => $after_html,
|
69 |
+
));
|
70 |
+
|
71 |
+
$fieldset->addField('pdffile', 'file', array(
|
72 |
+
'label' => Mage::helper('press')->__('PDF Attachment'),
|
73 |
+
'required' => false,
|
74 |
+
'class' => 'validate-pdffile',
|
75 |
+
'name' => 'pdffile',
|
76 |
+
'after_element_html' => $afterpdf_html,
|
77 |
+
));
|
78 |
+
|
79 |
+
/*$fieldset->addField('pressvideo', 'file', array(
|
80 |
+
'label' => Mage::helper('press')->__('Press Video'),
|
81 |
+
'required' => false,
|
82 |
+
//'class' => 'validate-flvfile',
|
83 |
+
'name' => 'pressvideo',
|
84 |
+
));*/
|
85 |
+
|
86 |
+
$fieldset->addField('pressvideo', 'text', array(
|
87 |
+
'label' => Mage::helper('press')->__('Press Video Link'),
|
88 |
+
'required' => false,
|
89 |
+
'class' => 'validate-url',
|
90 |
+
'name' => 'pressvideo',
|
91 |
+
));
|
92 |
+
|
93 |
+
$fieldset->addField('status', 'select', array(
|
94 |
+
'label' => Mage::helper('press')->__('Status'),
|
95 |
+
'name' => 'status',
|
96 |
+
'values' => array(
|
97 |
+
array(
|
98 |
+
'value' => 1,
|
99 |
+
'label' => Mage::helper('press')->__('Enabled'),
|
100 |
+
),
|
101 |
+
|
102 |
+
array(
|
103 |
+
'value' => 2,
|
104 |
+
'label' => Mage::helper('press')->__('Disabled'),
|
105 |
+
),
|
106 |
+
),
|
107 |
+
));
|
108 |
+
|
109 |
+
|
110 |
+
$fieldset->addField('store_id', 'multiselect', array(
|
111 |
+
'name' => 'stores[]',
|
112 |
+
'label' => Mage::helper('cms')->__('Store View'),
|
113 |
+
'title' => Mage::helper('cms')->__('Store View'),
|
114 |
+
'required' => true,
|
115 |
+
'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
|
116 |
+
));
|
117 |
+
|
118 |
+
|
119 |
+
|
120 |
+
$fieldset->addField('content', 'editor', array(
|
121 |
+
'name' => 'content',
|
122 |
+
'label' => Mage::helper('press')->__('Content'),
|
123 |
+
'title' => Mage::helper('press')->__('Content'),
|
124 |
+
'style' => 'height:25em;width:40em;',
|
125 |
+
//'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig(),
|
126 |
+
'wysiwyg' => true,
|
127 |
+
'required' => true,
|
128 |
+
));
|
129 |
+
|
130 |
+
|
131 |
+
|
132 |
+
|
133 |
+
if ( Mage::getSingleton('adminhtml/session')->getPressData() )
|
134 |
+
{
|
135 |
+
$form->setValues(Mage::getSingleton('adminhtml/session')->getPressData());
|
136 |
+
Mage::getSingleton('adminhtml/session')->setPressData(null);
|
137 |
+
} elseif ( Mage::registry('press_data') ) {
|
138 |
+
$form->setValues($model_data);
|
139 |
+
}
|
140 |
+
|
141 |
+
|
142 |
+
return parent::_prepareForm();
|
143 |
+
}
|
144 |
+
|
145 |
+
public function getCustomerGroups()
|
146 |
+
{
|
147 |
+
$table = $this->getTable('customer_group');
|
148 |
+
}
|
149 |
+
}
|
app/code/local/Tatva/Press/Block/Adminhtml/Press/Edit/Tabs.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Press_Block_Adminhtml_Press_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
4 |
+
{
|
5 |
+
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
parent::__construct();
|
9 |
+
$this->setId('press_tabs');
|
10 |
+
$this->setDestElementId('edit_form');
|
11 |
+
$this->setTitle(Mage::helper('press')->__('Item Information'));
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _prepareLayout()
|
15 |
+
{
|
16 |
+
$return = parent::_prepareLayout();
|
17 |
+
$this->addTab('form_section', array(
|
18 |
+
'label' => Mage::helper('press')->__('Item Information'),
|
19 |
+
'title' => Mage::helper('press')->__('Item Information'),
|
20 |
+
'content' => $this->getLayout()->createBlock('press/adminhtml_press_edit_tab_form')->toHtml(),
|
21 |
+
));
|
22 |
+
|
23 |
+
return $return;
|
24 |
+
}
|
25 |
+
|
26 |
+
}
|
app/code/local/Tatva/Press/Block/Adminhtml/Press/Grid.php
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Press_Block_Adminhtml_Press_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->setId('pressGrid');
|
9 |
+
$this->setDefaultSort('press_id');
|
10 |
+
$this->setDefaultDir('ASC');
|
11 |
+
$this->setSaveParametersInSession(true);
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _prepareCollection()
|
15 |
+
{
|
16 |
+
$collection = Mage::getModel('press/press')->getCollection();
|
17 |
+
$this->setCollection($collection);
|
18 |
+
return parent::_prepareCollection();
|
19 |
+
}
|
20 |
+
|
21 |
+
protected function _prepareColumns()
|
22 |
+
{
|
23 |
+
$this->addColumn('press_id', array(
|
24 |
+
'header' => Mage::helper('press')->__('ID'),
|
25 |
+
'align' =>'right',
|
26 |
+
'width' => '50px',
|
27 |
+
'index' => 'press_id',
|
28 |
+
));
|
29 |
+
|
30 |
+
$this->addColumn('title', array(
|
31 |
+
'header' => Mage::helper('press')->__('Title'),
|
32 |
+
'align' =>'left',
|
33 |
+
'index' => 'title',
|
34 |
+
));
|
35 |
+
|
36 |
+
/*
|
37 |
+
$this->addColumn('content', array(
|
38 |
+
'header' => Mage::helper('press')->__('Item Content'),
|
39 |
+
'width' => '150px',
|
40 |
+
'index' => 'content',
|
41 |
+
));
|
42 |
+
*/
|
43 |
+
|
44 |
+
$this->addColumn('status', array(
|
45 |
+
'header' => Mage::helper('press')->__('Status'),
|
46 |
+
'align' => 'left',
|
47 |
+
'width' => '80px',
|
48 |
+
'index' => 'status',
|
49 |
+
'type' => 'options',
|
50 |
+
'options' => array(
|
51 |
+
1 => 'Enabled',
|
52 |
+
2 => 'Disabled',
|
53 |
+
),
|
54 |
+
));
|
55 |
+
|
56 |
+
$this->addColumn('action',
|
57 |
+
array(
|
58 |
+
'header' => Mage::helper('press')->__('Action'),
|
59 |
+
'width' => '100',
|
60 |
+
'type' => 'action',
|
61 |
+
'getter' => 'getId',
|
62 |
+
'actions' => array(
|
63 |
+
array(
|
64 |
+
'caption' => Mage::helper('press')->__('Edit'),
|
65 |
+
'url' => array('base'=> '*/*/edit'),
|
66 |
+
'field' => 'id'
|
67 |
+
)
|
68 |
+
),
|
69 |
+
'filter' => false,
|
70 |
+
'sortable' => false,
|
71 |
+
'index' => 'stores',
|
72 |
+
'is_system' => true,
|
73 |
+
));
|
74 |
+
|
75 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('press')->__('CSV'));
|
76 |
+
$this->addExportType('*/*/exportXml', Mage::helper('press')->__('XML'));
|
77 |
+
|
78 |
+
return parent::_prepareColumns();
|
79 |
+
}
|
80 |
+
|
81 |
+
protected function _prepareMassaction()
|
82 |
+
{
|
83 |
+
$this->setMassactionIdField('press_id');
|
84 |
+
$this->getMassactionBlock()->setFormFieldName('press');
|
85 |
+
|
86 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
87 |
+
'label' => Mage::helper('press')->__('Delete'),
|
88 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
89 |
+
'confirm' => Mage::helper('press')->__('Are you sure?')
|
90 |
+
));
|
91 |
+
|
92 |
+
$statuses = Mage::getSingleton('press/status')->getOptionArray();
|
93 |
+
|
94 |
+
array_unshift($statuses, array('label'=>'', 'value'=>''));
|
95 |
+
$this->getMassactionBlock()->addItem('status', array(
|
96 |
+
'label'=> Mage::helper('press')->__('Change status'),
|
97 |
+
'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
|
98 |
+
'additional' => array(
|
99 |
+
'visibility' => array(
|
100 |
+
'name' => 'status',
|
101 |
+
'type' => 'select',
|
102 |
+
'class' => 'required-entry',
|
103 |
+
'label' => Mage::helper('press')->__('Status'),
|
104 |
+
'values' => $statuses
|
105 |
+
)
|
106 |
+
)
|
107 |
+
));
|
108 |
+
return $this;
|
109 |
+
}
|
110 |
+
|
111 |
+
public function getRowUrl($row)
|
112 |
+
{
|
113 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
114 |
+
}
|
115 |
+
|
116 |
+
}
|
app/code/local/Tatva/Press/Block/Press.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Tatva_Press_Block_Press extends Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
public function _prepareLayout()
|
5 |
+
{
|
6 |
+
return parent::_prepareLayout();
|
7 |
+
}
|
8 |
+
|
9 |
+
public function getPressCollection()
|
10 |
+
{
|
11 |
+
$store_id = Mage::app()->getStore()->getId();
|
12 |
+
$collection = Mage::getModel('press/press')->getCollection()->addFieldToFilter('status',1)->setOrder('date','DESC');
|
13 |
+
$_id = Mage::getResourceModel('press/press')->getStoreId($store_id);
|
14 |
+
$final_collection = array();
|
15 |
+
foreach($collection as $_collection)
|
16 |
+
{
|
17 |
+
if(array_key_exists($_collection['press_id'],$_id))
|
18 |
+
{
|
19 |
+
$final_collection[] = $_collection->getData();
|
20 |
+
}
|
21 |
+
}
|
22 |
+
//echo "<pre/>";print_r($final_collection);exit;
|
23 |
+
return $final_collection;
|
24 |
+
}
|
25 |
+
|
26 |
+
public function getPressView()
|
27 |
+
{
|
28 |
+
$pressItem = Mage::getModel('press/press')->getCollection()->addFieldToFilter('press_id',$this->getRequest()->getParam('id'));
|
29 |
+
return $pressItem;
|
30 |
+
}
|
31 |
+
}
|
app/code/local/Tatva/Press/Helper/Data.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Press_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
app/code/local/Tatva/Press/Model/Mysql4/Press.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Press_Model_Mysql4_Press extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
// Note that the press_id refers to the key field in your database table.
|
8 |
+
$this->_init('press/press', 'press_id');
|
9 |
+
}
|
10 |
+
|
11 |
+
public function insert($a,$b,$c='')
|
12 |
+
{
|
13 |
+
$count = count($b);
|
14 |
+
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
|
15 |
+
if($c!='')
|
16 |
+
{
|
17 |
+
$write->query("delete from press_store where press_id = ".$c);
|
18 |
+
}
|
19 |
+
for($i=0 ; $i<$count ; $i++)
|
20 |
+
{
|
21 |
+
$write->query("insert into press_store(press_id,store_id) values ($a,$b[$i])");
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
public function edit_form($id)
|
26 |
+
{
|
27 |
+
$query = "select store_id from press,press_store where press_store.press_id ='" .$id. "'";
|
28 |
+
$read = Mage::getSingleton('core/resource')->getConnection('core_read')->fetchAll($query);
|
29 |
+
$final_aray = array();
|
30 |
+
foreach($read as $_read)
|
31 |
+
{
|
32 |
+
$final_aray[] = $_read['store_id'];
|
33 |
+
}
|
34 |
+
return $final_aray;
|
35 |
+
}
|
36 |
+
|
37 |
+
public function getStoreId($id)
|
38 |
+
{
|
39 |
+
$query = "select * from press_store where press_store.store_id ='" .$id. "' or press_store.store_id=0";
|
40 |
+
$read = Mage::getSingleton('core/resource')->getConnection('core_read')->fetchAll($query);
|
41 |
+
$final_aray = array();
|
42 |
+
foreach($read as $_read)
|
43 |
+
{
|
44 |
+
$final_aray[$_read['press_id']] = $_read['store_id'];
|
45 |
+
}
|
46 |
+
return $final_aray;
|
47 |
+
}
|
48 |
+
}
|
app/code/local/Tatva/Press/Model/Mysql4/Press/Collection.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Press_Model_Mysql4_Press_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('press/press');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Tatva/Press/Model/Mysql4/Press_store.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Press_store_Model_Mysql4_Press_store extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
// Note that the press_store_id refers to the key field in your database table.
|
8 |
+
$this->_init('press_store/press_store', 'press_store_id');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Tatva/Press/Model/Mysql4/Press_store/Collection.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Press_store_Model_Mysql4_Press_store_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('press_store/press_store');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Tatva/Press/Model/Press.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Press_Model_Press extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('press/press');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Tatva/Press/Model/Press_store.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Press_store_Model_Press_store extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('press_store/press_store');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Tatva/Press/Model/Status.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Press_Model_Status extends Varien_Object
|
4 |
+
{
|
5 |
+
const STATUS_ENABLED = 1;
|
6 |
+
const STATUS_DISABLED = 2;
|
7 |
+
|
8 |
+
static public function getOptionArray()
|
9 |
+
{
|
10 |
+
return array(
|
11 |
+
self::STATUS_ENABLED => Mage::helper('press')->__('Enabled'),
|
12 |
+
self::STATUS_DISABLED => Mage::helper('press')->__('Disabled')
|
13 |
+
);
|
14 |
+
}
|
15 |
+
}
|
app/code/local/Tatva/Press/controllers/Adminhtml/PressController.php
ADDED
@@ -0,0 +1,275 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Press_Adminhtml_PressController extends Mage_Adminhtml_Controller_action
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _initAction() {
|
7 |
+
$this->loadLayout()
|
8 |
+
->_setActiveMenu('press/items')
|
9 |
+
->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
10 |
+
|
11 |
+
return $this;
|
12 |
+
}
|
13 |
+
|
14 |
+
public function indexAction() {
|
15 |
+
$this->_initAction()
|
16 |
+
->renderLayout();
|
17 |
+
}
|
18 |
+
|
19 |
+
public function editAction() {
|
20 |
+
$id = $this->getRequest()->getParam('id');
|
21 |
+
$model = Mage::getModel('press/press')->load($id);
|
22 |
+
|
23 |
+
if ($model->getId() || $id == 0) {
|
24 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
25 |
+
if (!empty($data)) {
|
26 |
+
$model->setData($data);
|
27 |
+
}
|
28 |
+
|
29 |
+
Mage::register('press_data', $model);
|
30 |
+
|
31 |
+
$this->loadLayout();
|
32 |
+
$this->_setActiveMenu('press/items');
|
33 |
+
|
34 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
35 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
|
36 |
+
|
37 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
38 |
+
|
39 |
+
$this->_addContent($this->getLayout()->createBlock('press/adminhtml_press_edit'))
|
40 |
+
->_addLeft($this->getLayout()->createBlock('press/adminhtml_press_edit_tabs'));
|
41 |
+
if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
|
42 |
+
$this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
|
43 |
+
}
|
44 |
+
$this->renderLayout();
|
45 |
+
} else {
|
46 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('press')->__('Item does not exist'));
|
47 |
+
$this->_redirect('*/*/');
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
public function newAction() {
|
52 |
+
$this->_forward('edit');
|
53 |
+
}
|
54 |
+
|
55 |
+
public function saveAction() {
|
56 |
+
if ($data = $this->getRequest()->getPost()) {
|
57 |
+
|
58 |
+
if(isset($_FILES['displaypicture']['name']) && $_FILES['displaypicture']['name'] != '') {
|
59 |
+
try {
|
60 |
+
/* Starting upload */
|
61 |
+
$uploader = new Varien_File_Uploader('displaypicture');
|
62 |
+
|
63 |
+
// Any extention would work
|
64 |
+
$uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
|
65 |
+
$uploader->setAllowRenameFiles(false);
|
66 |
+
|
67 |
+
// Set the file upload mode
|
68 |
+
// false -> get the file directly in the specified folder
|
69 |
+
// true -> get the file in the product like folders
|
70 |
+
// (file.jpg will go in something like /media/f/i/file.jpg)
|
71 |
+
$uploader->setFilesDispersion(false);
|
72 |
+
$filedet = pathinfo($_FILES['displaypicture']['name']);
|
73 |
+
|
74 |
+
// We set media/press as the upload dir
|
75 |
+
$path = Mage::getBaseDir('media') . DS .'press'.DS;
|
76 |
+
$filedet['displaypicture'] = str_replace(" ","",$filedet['filename']);
|
77 |
+
$uploader->save($path, str_replace(" ","_",$filedet['displaypicture'].time().'.'.$filedet['extension']));
|
78 |
+
// actual path of image
|
79 |
+
$imageUrl = Mage::getBaseDir('media').DS."press".DS.$filedet['displaypicture'].time().'.'.$filedet['extension'];
|
80 |
+
|
81 |
+
// path of the resized image to be saved
|
82 |
+
// here, the resized image is saved in media/resized folder
|
83 |
+
$imageResized = Mage::getBaseDir('media').DS."press".DS."thumbnail".DS.$filedet['displaypicture'].time().'.'.$filedet['extension'];
|
84 |
+
$store = Mage::app()->getStore();
|
85 |
+
$code = $store->getCode();
|
86 |
+
// resize image only if the image file exists and the resized image file doesn't exist
|
87 |
+
// the image is resized proportionally with the width/height 135px
|
88 |
+
if (!file_exists($imageResized)&&file_exists($imageUrl)) :
|
89 |
+
$imageObj = new Varien_Image($imageUrl);
|
90 |
+
$imageObj->constrainOnly(TRUE);
|
91 |
+
$imageObj->keepAspectRatio(TRUE);
|
92 |
+
$imageObj->keepFrame(FALSE);
|
93 |
+
$imageObj->resize(Mage::getStoreConfig('press/press/imagewidth',$code),Mage::getStoreConfig('press/press/imageheight',$code));
|
94 |
+
$imageObj->save($imageResized);
|
95 |
+
endif;
|
96 |
+
|
97 |
+
} catch (Exception $e) {
|
98 |
+
Mage::getSingleton('adminhtml/session')->addError('Only .jpg, .jpeg, .png, .gif file extension is allowed for Display Picture');
|
99 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data_files);
|
100 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
101 |
+
return;
|
102 |
+
}
|
103 |
+
|
104 |
+
//this way the name is saved in DB
|
105 |
+
$data['displaypicture'] = str_replace(" ","_",$filedet['displaypicture'].time().'.'.$filedet['extension']);
|
106 |
+
|
107 |
+
}
|
108 |
+
|
109 |
+
if(isset($_FILES['pdffile']['name']) && $_FILES['pdffile']['name'] != '') {
|
110 |
+
try {
|
111 |
+
/* Starting upload */
|
112 |
+
$uploader1 = new Varien_File_Uploader('pdffile');
|
113 |
+
|
114 |
+
// Any extention would work
|
115 |
+
$uploader1->setAllowedExtensions(array('pdf'));
|
116 |
+
$uploader1->setAllowRenameFiles(false);
|
117 |
+
$uploader1->setFilesDispersion(false);
|
118 |
+
$filedet1 = pathinfo($_FILES['pdffile']['name']);
|
119 |
+
$filedet1['pdffile'] = str_replace(" ","",$filedet1['filename']);
|
120 |
+
|
121 |
+
// We set media/press as the upload dir
|
122 |
+
$path = Mage::getBaseDir('media') . DS .'press'.DS.'pdf'.DS;
|
123 |
+
|
124 |
+
$uploader1->save($path, str_replace(" ","_",$filedet1['pdffile'].time().'.'.$filedet1['extension']));
|
125 |
+
|
126 |
+
} catch (Exception $e) {
|
127 |
+
Mage::getSingleton('adminhtml/session')->addError('Only .pdf file extension is allowed for Attachement');
|
128 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data_files);
|
129 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
130 |
+
return;
|
131 |
+
}
|
132 |
+
|
133 |
+
//this way the name is saved in DB
|
134 |
+
$data['pdffile'] = str_replace(" ","_",$filedet1['pdffile'].time().'.'.$filedet1['extension']);
|
135 |
+
|
136 |
+
}
|
137 |
+
|
138 |
+
$model = Mage::getModel('press/press');
|
139 |
+
$model1 = Mage::getModel('press/press_store');
|
140 |
+
|
141 |
+
|
142 |
+
$data['store_id'] = $value;
|
143 |
+
$model->setData($data)->setId($this->getRequest()->getParam('id'));
|
144 |
+
|
145 |
+
$model->setData($data)
|
146 |
+
->setId($this->getRequest()->getParam('id'));
|
147 |
+
|
148 |
+
try {
|
149 |
+
|
150 |
+
$model->save();
|
151 |
+
$_press_id = $model['press_id'];
|
152 |
+
$_store = $model['stores'];
|
153 |
+
if(!$this->getRequest()->getParam('id'))
|
154 |
+
Mage::getResourceModel('press/press')->insert($_press_id,$_store);
|
155 |
+
else
|
156 |
+
Mage::getResourceModel('press/press')->insert($_press_id,$_store,$this->getRequest()->getParam('id'));
|
157 |
+
|
158 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('press')->__('Item was successfully saved'));
|
159 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
160 |
+
|
161 |
+
if ($this->getRequest()->getParam('back')) {
|
162 |
+
$this->_redirect('*/*/edit', array('id' => $model->getId()));
|
163 |
+
return;
|
164 |
+
}
|
165 |
+
$this->_redirect('*/*/');
|
166 |
+
return;
|
167 |
+
} catch (Exception $e) {
|
168 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
169 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
170 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
171 |
+
return;
|
172 |
+
}
|
173 |
+
}
|
174 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('press')->__('Unable to find item to save'));
|
175 |
+
$this->_redirect('*/*/');
|
176 |
+
}
|
177 |
+
|
178 |
+
public function deleteAction() {
|
179 |
+
if( $this->getRequest()->getParam('id') > 0 ) {
|
180 |
+
try {
|
181 |
+
$model = Mage::getModel('press/press');
|
182 |
+
|
183 |
+
$model->setId($this->getRequest()->getParam('id'))
|
184 |
+
->delete();
|
185 |
+
|
186 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
|
187 |
+
$this->_redirect('*/*/');
|
188 |
+
} catch (Exception $e) {
|
189 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
190 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
191 |
+
}
|
192 |
+
}
|
193 |
+
$this->_redirect('*/*/');
|
194 |
+
}
|
195 |
+
|
196 |
+
public function massDeleteAction() {
|
197 |
+
$pressIds = $this->getRequest()->getParam('press');
|
198 |
+
if(!is_array($pressIds)) {
|
199 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
|
200 |
+
} else {
|
201 |
+
try {
|
202 |
+
foreach ($pressIds as $pressId) {
|
203 |
+
$press = Mage::getModel('press/press')->load($pressId);
|
204 |
+
$press->delete();
|
205 |
+
}
|
206 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
207 |
+
Mage::helper('adminhtml')->__(
|
208 |
+
'Total of %d record(s) were successfully deleted', count($pressIds)
|
209 |
+
)
|
210 |
+
);
|
211 |
+
} catch (Exception $e) {
|
212 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
213 |
+
}
|
214 |
+
}
|
215 |
+
$this->_redirect('*/*/index');
|
216 |
+
}
|
217 |
+
|
218 |
+
public function massStatusAction()
|
219 |
+
{
|
220 |
+
$pressIds = $this->getRequest()->getParam('press');
|
221 |
+
if(!is_array($pressIds)) {
|
222 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
|
223 |
+
} else {
|
224 |
+
try {
|
225 |
+
foreach ($pressIds as $pressId) {
|
226 |
+
$press = Mage::getSingleton('press/press')
|
227 |
+
->load($pressId)
|
228 |
+
->setStatus($this->getRequest()->getParam('status'))
|
229 |
+
->setIsMassupdate(true)
|
230 |
+
->save();
|
231 |
+
}
|
232 |
+
$this->_getSession()->addSuccess(
|
233 |
+
$this->__('Total of %d record(s) were successfully updated', count($pressIds))
|
234 |
+
);
|
235 |
+
} catch (Exception $e) {
|
236 |
+
$this->_getSession()->addError($e->getMessage());
|
237 |
+
}
|
238 |
+
}
|
239 |
+
$this->_redirect('*/*/index');
|
240 |
+
}
|
241 |
+
|
242 |
+
public function exportCsvAction()
|
243 |
+
{
|
244 |
+
$fileName = 'press.csv';
|
245 |
+
$content = $this->getLayout()->createBlock('press/adminhtml_press_grid')
|
246 |
+
->getCsv();
|
247 |
+
|
248 |
+
$this->_sendUploadResponse($fileName, $content);
|
249 |
+
}
|
250 |
+
|
251 |
+
public function exportXmlAction()
|
252 |
+
{
|
253 |
+
$fileName = 'press.xml';
|
254 |
+
$content = $this->getLayout()->createBlock('press/adminhtml_press_grid')
|
255 |
+
->getXml();
|
256 |
+
|
257 |
+
$this->_sendUploadResponse($fileName, $content);
|
258 |
+
}
|
259 |
+
|
260 |
+
protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
|
261 |
+
{
|
262 |
+
$response = $this->getResponse();
|
263 |
+
$response->setHeader('HTTP/1.1 200 OK','');
|
264 |
+
$response->setHeader('Pragma', 'public', true);
|
265 |
+
$response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
|
266 |
+
$response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
|
267 |
+
$response->setHeader('Last-Modified', date('r'));
|
268 |
+
$response->setHeader('Accept-Ranges', 'bytes');
|
269 |
+
$response->setHeader('Content-Length', strlen($content));
|
270 |
+
$response->setHeader('Content-type', $contentType);
|
271 |
+
$response->setBody($content);
|
272 |
+
$response->sendResponse();
|
273 |
+
die;
|
274 |
+
}
|
275 |
+
}
|
app/code/local/Tatva/Press/controllers/IndexController.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Tatva_Press_IndexController extends Mage_Core_Controller_Front_Action
|
3 |
+
{
|
4 |
+
public function indexAction()
|
5 |
+
{
|
6 |
+
$store = Mage::app()->getStore();
|
7 |
+
$code = $store->getCode();
|
8 |
+
$enable = Mage::getStoreConfig('press/press/enable',$code);
|
9 |
+
if($enable == 0)
|
10 |
+
{
|
11 |
+
$this->_redirect('');
|
12 |
+
return;
|
13 |
+
}
|
14 |
+
|
15 |
+
$this->loadLayout();
|
16 |
+
$this->getLayout()->getBlock('head')->setTitle('Press');
|
17 |
+
$this->renderLayout();
|
18 |
+
}
|
19 |
+
|
20 |
+
public function viewAction()
|
21 |
+
{
|
22 |
+
$store = Mage::app()->getStore();
|
23 |
+
$code = $store->getCode();
|
24 |
+
$enable = Mage::getStoreConfig('press/press/enable',$code);
|
25 |
+
if($enable == 0)
|
26 |
+
{
|
27 |
+
$this->_redirect('');
|
28 |
+
return;
|
29 |
+
}
|
30 |
+
|
31 |
+
$this->loadLayout();
|
32 |
+
$this->getLayout()->getBlock('head')->setTitle('Press View');
|
33 |
+
$this->renderLayout();
|
34 |
+
}
|
35 |
+
}
|
app/code/local/Tatva/Press/etc/adminhtml.xml
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<adminhtml>
|
3 |
+
<menu>
|
4 |
+
<press module="press">
|
5 |
+
<title>Press</title>
|
6 |
+
<sort_order>71</sort_order>
|
7 |
+
<children>
|
8 |
+
<items module="press">
|
9 |
+
<title>Manage Items</title>
|
10 |
+
<sort_order>0</sort_order>
|
11 |
+
<action>press/adminhtml_press</action>
|
12 |
+
</items>
|
13 |
+
</children>
|
14 |
+
</press>
|
15 |
+
</menu>
|
16 |
+
<acl>
|
17 |
+
<resources>
|
18 |
+
<all>
|
19 |
+
<title>Allow Everything</title>
|
20 |
+
</all>
|
21 |
+
<admin>
|
22 |
+
<children>
|
23 |
+
<children>
|
24 |
+
<Tatva_Press>
|
25 |
+
<title>Press Module</title>
|
26 |
+
<sort_order>10</sort_order>
|
27 |
+
</Tatva_Press>
|
28 |
+
</children>
|
29 |
+
<system>
|
30 |
+
<children>
|
31 |
+
<config>
|
32 |
+
<children>
|
33 |
+
<press translate="title" module="press">
|
34 |
+
<title>Press</title>
|
35 |
+
</press>
|
36 |
+
</children>
|
37 |
+
</config>
|
38 |
+
</children>
|
39 |
+
</system>
|
40 |
+
</children>
|
41 |
+
</admin>
|
42 |
+
</resources>
|
43 |
+
</acl>
|
44 |
+
<layout>
|
45 |
+
<updates>
|
46 |
+
<press>
|
47 |
+
<file>press.xml</file>
|
48 |
+
</press>
|
49 |
+
</updates>
|
50 |
+
</layout>
|
51 |
+
</adminhtml>
|
app/code/local/Tatva/Press/etc/config.xml
ADDED
@@ -0,0 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Tatva_Press>
|
5 |
+
<version>0.1.2</version>
|
6 |
+
</Tatva_Press>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<press>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Tatva_Press</module>
|
14 |
+
<frontName>press</frontName>
|
15 |
+
</args>
|
16 |
+
</press>
|
17 |
+
</routers>
|
18 |
+
<layout>
|
19 |
+
<updates>
|
20 |
+
<press>
|
21 |
+
<file>press.xml</file>
|
22 |
+
</press>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
</frontend>
|
26 |
+
<admin>
|
27 |
+
<routers>
|
28 |
+
<press>
|
29 |
+
<use>admin</use>
|
30 |
+
<args>
|
31 |
+
<module>Tatva_Press</module>
|
32 |
+
<frontName>press</frontName>
|
33 |
+
</args>
|
34 |
+
</press>
|
35 |
+
</routers>
|
36 |
+
</admin>
|
37 |
+
<adminhtml>
|
38 |
+
<menu>
|
39 |
+
<press module="press">
|
40 |
+
<title>Press</title>
|
41 |
+
<sort_order>90</sort_order>
|
42 |
+
<children>
|
43 |
+
<items module="press">
|
44 |
+
<title>Manage Items</title>
|
45 |
+
<sort_order>0</sort_order>
|
46 |
+
<action>press/adminhtml_press</action>
|
47 |
+
</items>
|
48 |
+
</children>
|
49 |
+
</press>
|
50 |
+
</menu>
|
51 |
+
<acl>
|
52 |
+
<resources>
|
53 |
+
<all>
|
54 |
+
<title>Allow Everything</title>
|
55 |
+
</all>
|
56 |
+
<admin>
|
57 |
+
<children>
|
58 |
+
<children>
|
59 |
+
<Tatva_Press>
|
60 |
+
<title>Press Module</title>
|
61 |
+
<sort_order>10</sort_order>
|
62 |
+
</Tatva_Press>
|
63 |
+
</children>
|
64 |
+
<system>
|
65 |
+
<children>
|
66 |
+
<config>
|
67 |
+
<children>
|
68 |
+
<press translate="title" module="press">
|
69 |
+
<title>Press</title>
|
70 |
+
</press>
|
71 |
+
</children>
|
72 |
+
</config>
|
73 |
+
</children>
|
74 |
+
</system>
|
75 |
+
</children>
|
76 |
+
</admin>
|
77 |
+
</resources>
|
78 |
+
</acl>
|
79 |
+
<layout>
|
80 |
+
<updates>
|
81 |
+
<press>
|
82 |
+
<file>press.xml</file>
|
83 |
+
</press>
|
84 |
+
</updates>
|
85 |
+
</layout>
|
86 |
+
</adminhtml>
|
87 |
+
<global>
|
88 |
+
<models>
|
89 |
+
<press>
|
90 |
+
<class>Tatva_Press_Model</class>
|
91 |
+
<resourceModel>press_mysql4</resourceModel>
|
92 |
+
</press>
|
93 |
+
<press_mysql4>
|
94 |
+
<class>Tatva_Press_Model_Mysql4</class>
|
95 |
+
<entities>
|
96 |
+
<press>
|
97 |
+
<table>press</table>
|
98 |
+
</press>
|
99 |
+
<press_store>
|
100 |
+
<table>press_store</table>
|
101 |
+
</press_store>
|
102 |
+
</entities>
|
103 |
+
</press_mysql4>
|
104 |
+
</models>
|
105 |
+
<resources>
|
106 |
+
<press_setup>
|
107 |
+
<setup>
|
108 |
+
<module>Tatva_Press</module>
|
109 |
+
</setup>
|
110 |
+
<connection>
|
111 |
+
<use>core_setup</use>
|
112 |
+
</connection>
|
113 |
+
</press_setup>
|
114 |
+
<press_write>
|
115 |
+
<connection>
|
116 |
+
<use>core_write</use>
|
117 |
+
</connection>
|
118 |
+
</press_write>
|
119 |
+
<press_read>
|
120 |
+
<connection>
|
121 |
+
<use>core_read</use>
|
122 |
+
</connection>
|
123 |
+
</press_read>
|
124 |
+
</resources>
|
125 |
+
<blocks>
|
126 |
+
<press>
|
127 |
+
<class>Tatva_Press_Block</class>
|
128 |
+
</press>
|
129 |
+
</blocks>
|
130 |
+
<helpers>
|
131 |
+
<press>
|
132 |
+
<class>Tatva_Press_Helper</class>
|
133 |
+
</press>
|
134 |
+
</helpers>
|
135 |
+
</global>
|
136 |
+
<default>
|
137 |
+
<press>
|
138 |
+
<press>
|
139 |
+
<enable>1</enable>
|
140 |
+
<displayvideo>1</displayvideo>
|
141 |
+
<videoheight>600</videoheight>
|
142 |
+
<videowidth>700</videowidth>
|
143 |
+
<displaypdf>1</displaypdf>
|
144 |
+
<displaytext>1</displaytext>
|
145 |
+
<displayimage>1</displayimage>
|
146 |
+
<imagewidth>500</imagewidth>
|
147 |
+
<imageheight>400</imageheight>
|
148 |
+
</press>
|
149 |
+
</press>
|
150 |
+
</default>
|
151 |
+
</config>
|
app/code/local/Tatva/Press/etc/system.xml
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<press translate="label" module="press">
|
5 |
+
<label>Press</label>
|
6 |
+
<sort_order>100</sort_order>
|
7 |
+
</press>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<press translate="label" module="press">
|
11 |
+
<label>Press Configuration</label>
|
12 |
+
<class>separator-top</class>
|
13 |
+
<tab>press</tab>
|
14 |
+
<frontend_type>text</frontend_type>
|
15 |
+
<sort_order>1000</sort_order>
|
16 |
+
<show_in_default>1</show_in_default>
|
17 |
+
<show_in_website>1</show_in_website>
|
18 |
+
<show_in_store>1</show_in_store>
|
19 |
+
<groups>
|
20 |
+
<press translate="label" module="press">
|
21 |
+
<label>Press Configuration</label>
|
22 |
+
<frontend_type>text</frontend_type>
|
23 |
+
<sort_order>50</sort_order>
|
24 |
+
<show_in_default>1</show_in_default>
|
25 |
+
<show_in_website>1</show_in_website>
|
26 |
+
<show_in_store>1</show_in_store>
|
27 |
+
<fields>
|
28 |
+
<enable translate="label" module="press">
|
29 |
+
<label>Enable</label>
|
30 |
+
<frontend_type>select</frontend_type>
|
31 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
32 |
+
<sort_order>1</sort_order>
|
33 |
+
<show_in_default>1</show_in_default>
|
34 |
+
<show_in_website>1</show_in_website>
|
35 |
+
<show_in_store>1</show_in_store>
|
36 |
+
</enable>
|
37 |
+
<displayvideo translate="label" module="press">
|
38 |
+
<label>Display Video Link</label>
|
39 |
+
<frontend_type>select</frontend_type>
|
40 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
41 |
+
<sort_order>2</sort_order>
|
42 |
+
<show_in_default>1</show_in_default>
|
43 |
+
<show_in_website>1</show_in_website>
|
44 |
+
<show_in_store>1</show_in_store>
|
45 |
+
</displayvideo>
|
46 |
+
<videoheight translate="label" module="press">
|
47 |
+
<label>Video Height</label>
|
48 |
+
<frontend_type>text</frontend_type>
|
49 |
+
<validate>validate-digits validate-greater-than-zero</validate>
|
50 |
+
<sort_order>3</sort_order>
|
51 |
+
<show_in_default>1</show_in_default>
|
52 |
+
<show_in_website>1</show_in_website>
|
53 |
+
<show_in_store>1</show_in_store>
|
54 |
+
</videoheight>
|
55 |
+
<videowidth translate="label" module="press">
|
56 |
+
<label>Video Width</label>
|
57 |
+
<frontend_type>text</frontend_type>
|
58 |
+
<validate>validate-digits validate-greater-than-zero</validate>
|
59 |
+
<sort_order>4</sort_order>
|
60 |
+
<show_in_default>1</show_in_default>
|
61 |
+
<show_in_website>1</show_in_website>
|
62 |
+
<show_in_store>1</show_in_store>
|
63 |
+
</videowidth>
|
64 |
+
<displaypdf translate="label" module="press">
|
65 |
+
<label>Display Download Link</label>
|
66 |
+
<frontend_type>select</frontend_type>
|
67 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
68 |
+
<sort_order>5</sort_order>
|
69 |
+
<show_in_default>1</show_in_default>
|
70 |
+
<show_in_website>1</show_in_website>
|
71 |
+
<show_in_store>1</show_in_store>
|
72 |
+
</displaypdf>
|
73 |
+
<displaytext translate="label" module="press">
|
74 |
+
<label>Display Content</label>
|
75 |
+
<frontend_type>select</frontend_type>
|
76 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
77 |
+
<sort_order>6</sort_order>
|
78 |
+
<show_in_default>1</show_in_default>
|
79 |
+
<show_in_website>1</show_in_website>
|
80 |
+
<show_in_store>1</show_in_store>
|
81 |
+
</displaytext>
|
82 |
+
<displayimage translate="label" module="press">
|
83 |
+
<label>Display Image</label>
|
84 |
+
<frontend_type>select</frontend_type>
|
85 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
86 |
+
<sort_order>7</sort_order>
|
87 |
+
<show_in_default>1</show_in_default>
|
88 |
+
<show_in_website>1</show_in_website>
|
89 |
+
<show_in_store>1</show_in_store>
|
90 |
+
</displayimage>
|
91 |
+
<imagewidth translate="label" module="press">
|
92 |
+
<label>Image Width</label>
|
93 |
+
<frontend_type>text</frontend_type>
|
94 |
+
<validate>validate-digits validate-greater-than-zero</validate>
|
95 |
+
<sort_order>10</sort_order>
|
96 |
+
<show_in_default>1</show_in_default>
|
97 |
+
<show_in_website>1</show_in_website>
|
98 |
+
<show_in_store>1</show_in_store>
|
99 |
+
</imagewidth>
|
100 |
+
<imageheight translate="label" module="press">
|
101 |
+
<label>Image Height</label>
|
102 |
+
<frontend_type>text</frontend_type>
|
103 |
+
<validate>validate-digits validate-greater-than-zero</validate>
|
104 |
+
<sort_order>11</sort_order>
|
105 |
+
<show_in_default>1</show_in_default>
|
106 |
+
<show_in_website>1</show_in_website>
|
107 |
+
<show_in_store>1</show_in_store>
|
108 |
+
</imageheight>
|
109 |
+
</fields>
|
110 |
+
</press>
|
111 |
+
</groups>
|
112 |
+
</press>
|
113 |
+
</sections>
|
114 |
+
</config>
|
app/code/local/Tatva/Press/sql/press_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
|
9 |
+
-- DROP TABLE IF EXISTS `press`;
|
10 |
+
CREATE TABLE `press` (
|
11 |
+
`press_id` int(11) unsigned NOT NULL auto_increment,
|
12 |
+
`title` varchar(255) NOT NULL default '',
|
13 |
+
`displaypicture` varchar(255) NOT NULL default '',
|
14 |
+
`content` text NOT NULL default '',
|
15 |
+
`status` smallint(6) NOT NULL default '0',
|
16 |
+
PRIMARY KEY (`press_id`)
|
17 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
18 |
+
|
19 |
+
");
|
20 |
+
|
21 |
+
$installer->endSetup();
|
app/code/local/Tatva/Press/sql/press_setup/mysql4-upgrade-0.1.0-0.1.1.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
|
9 |
+
ALTER TABLE `press`
|
10 |
+
ADD `date` date NOT NULL AFTER `press_id`,
|
11 |
+
ADD `pdffile` varchar(255) NOT NULL AFTER `displaypicture`,
|
12 |
+
ADD `pressvideo` varchar(255) NOT NULL AFTER `pdffile`,
|
13 |
+
");
|
14 |
+
|
15 |
+
$installer->endSetup();
|
app/code/local/Tatva/Press/sql/press_setup/mysql4-upgrade-0.1.1-0.1.2.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
|
9 |
+
CREATE TABLE `press_store` (
|
10 |
+
`press_id` int(11) unsigned NOT NULL,
|
11 |
+
`store_id` smallint(5) unsigned NOT NULL,
|
12 |
+
KEY `press_id` (`press_id`),
|
13 |
+
KEY `store_id` (`store_id`),
|
14 |
+
CONSTRAINT `press_store_ibfk_2` FOREIGN KEY (`store_id`) REFERENCES `core_store` (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
15 |
+
CONSTRAINT `press_store_ibfk` FOREIGN KEY (`press_id`) REFERENCES `press` (`press_id`) ON DELETE CASCADE ON UPDATE CASCADE
|
16 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
17 |
+
|
18 |
+
");
|
19 |
+
|
20 |
+
$installer->endSetup();
|
app/code/local/Tatva/Promotionalbanner/Block/Adminhtml/Promotionalbanner.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Tatva_Promotionalbanner_Block_Adminhtml_Promotionalbanner extends Mage_Adminhtml_Block_Widget_Grid_Container
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
$this->_controller = 'adminhtml_promotionalbanner';
|
7 |
+
$this->_blockGroup = 'promotionalbanner';
|
8 |
+
$this->_headerText = Mage::helper('promotionalbanner')->__('Item Manager');
|
9 |
+
$this->_addButtonLabel = Mage::helper('promotionalbanner')->__('Add Item');
|
10 |
+
parent::__construct();
|
11 |
+
}
|
12 |
+
}
|
app/code/local/Tatva/Promotionalbanner/Block/Adminhtml/Promotionalbanner/Edit.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Promotionalbanner_Block_Adminhtml_Promotionalbanner_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 = 'promotionalbanner';
|
11 |
+
$this->_controller = 'adminhtml_promotionalbanner';
|
12 |
+
|
13 |
+
$this->_updateButton('save', 'label', Mage::helper('promotionalbanner')->__('Save Item'));
|
14 |
+
$this->_updateButton('delete', 'label', Mage::helper('promotionalbanner')->__('Delete Item'));
|
15 |
+
|
16 |
+
$this->_addButton('saveandcontinue', array(
|
17 |
+
'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
|
18 |
+
'onclick' => 'saveAndContinueEdit()',
|
19 |
+
'class' => 'save',
|
20 |
+
), -100);
|
21 |
+
|
22 |
+
$this->_formScripts[] = "
|
23 |
+
function toggleEditor() {
|
24 |
+
if (tinyMCE.getInstanceById('promotionalbanner_content') == null) {
|
25 |
+
tinyMCE.execCommand('mceAddControl', false, 'promotionalbanner_content');
|
26 |
+
} else {
|
27 |
+
tinyMCE.execCommand('mceRemoveControl', false, 'promotionalbanner_content');
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
function saveAndContinueEdit(){
|
32 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
33 |
+
}
|
34 |
+
";
|
35 |
+
}
|
36 |
+
|
37 |
+
public function getHeaderText()
|
38 |
+
{
|
39 |
+
if( Mage::registry('promotionalbanner_data') && Mage::registry('promotionalbanner_data')->getId() ) {
|
40 |
+
return Mage::helper('promotionalbanner')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('promotionalbanner_data')->getTitle()));
|
41 |
+
} else {
|
42 |
+
return Mage::helper('promotionalbanner')->__('Add Item');
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
app/code/local/Tatva/Promotionalbanner/Block/Adminhtml/Promotionalbanner/Edit/Form.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Promotionalbanner_Block_Adminhtml_Promotionalbanner_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
4 |
+
{
|
5 |
+
protected function _prepareForm()
|
6 |
+
{
|
7 |
+
$form = new Varien_Data_Form(array(
|
8 |
+
'id' => 'edit_form',
|
9 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
10 |
+
'method' => 'post',
|
11 |
+
'enctype' => 'multipart/form-data'
|
12 |
+
)
|
13 |
+
);
|
14 |
+
|
15 |
+
$form->setUseContainer(true);
|
16 |
+
$this->setForm($form);
|
17 |
+
return parent::_prepareForm();
|
18 |
+
}
|
19 |
+
}
|
app/code/local/Tatva/Promotionalbanner/Block/Adminhtml/Promotionalbanner/Edit/Tab/Form.php
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Promotionalbanner_Block_Adminhtml_Promotionalbanner_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('promotionalbanner_form', array('legend'=>Mage::helper('promotionalbanner')->__('Item information')));
|
10 |
+
|
11 |
+
$fieldset->addField('title', 'text', array(
|
12 |
+
'label' => Mage::helper('promotionalbanner')->__('Title'),
|
13 |
+
'class' => 'required-entry',
|
14 |
+
'required' => true,
|
15 |
+
'name' => 'title',
|
16 |
+
));
|
17 |
+
|
18 |
+
$fieldset->addField('filename', 'file', array(
|
19 |
+
'label' => Mage::helper('promotionalbanner')->__('File'),
|
20 |
+
'required' => false,
|
21 |
+
'name' => 'filename',
|
22 |
+
));
|
23 |
+
|
24 |
+
$fieldset->addField('position', 'select', array(
|
25 |
+
'label' => Mage::helper('promotionalbanner')->__('Banner Position'),
|
26 |
+
'required' => false,
|
27 |
+
'name' => 'position',
|
28 |
+
'values' => array(''),
|
29 |
+
));
|
30 |
+
|
31 |
+
$fieldset->addField('sort_order', 'text', array(
|
32 |
+
'label' => Mage::helper('promotionalbanner')->__('Sort'),
|
33 |
+
'required' => false,
|
34 |
+
'name' => 'position',
|
35 |
+
));
|
36 |
+
|
37 |
+
$fieldset->addField('status', 'select', array(
|
38 |
+
'label' => Mage::helper('promotionalbanner')->__('Status'),
|
39 |
+
'name' => 'status',
|
40 |
+
'values' => array(
|
41 |
+
array(
|
42 |
+
'value' => 1,
|
43 |
+
'label' => Mage::helper('promotionalbanner')->__('Enabled'),
|
44 |
+
),
|
45 |
+
|
46 |
+
array(
|
47 |
+
'value' => 2,
|
48 |
+
'label' => Mage::helper('promotionalbanner')->__('Disabled'),
|
49 |
+
),
|
50 |
+
),
|
51 |
+
));
|
52 |
+
|
53 |
+
$fieldset->addField('content', 'editor', array(
|
54 |
+
'name' => 'content',
|
55 |
+
'label' => Mage::helper('promotionalbanner')->__('Content'),
|
56 |
+
'title' => Mage::helper('promotionalbanner')->__('Content'),
|
57 |
+
'style' => 'width:700px; height:500px;',
|
58 |
+
'wysiwyg' => false,
|
59 |
+
'required' => true,
|
60 |
+
));
|
61 |
+
|
62 |
+
if ( Mage::getSingleton('adminhtml/session')->getPromotionalbannerData() )
|
63 |
+
{
|
64 |
+
$form->setValues(Mage::getSingleton('adminhtml/session')->getPromotionalbannerData());
|
65 |
+
Mage::getSingleton('adminhtml/session')->setPromotionalbannerData(null);
|
66 |
+
} elseif ( Mage::registry('promotionalbanner_data') ) {
|
67 |
+
$form->setValues(Mage::registry('promotionalbanner_data')->getData());
|
68 |
+
}
|
69 |
+
return parent::_prepareForm();
|
70 |
+
}
|
71 |
+
}
|
app/code/local/Tatva/Promotionalbanner/Block/Adminhtml/Promotionalbanner/Edit/Tabs.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Promotionalbanner_Block_Adminhtml_Promotionalbanner_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
4 |
+
{
|
5 |
+
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
parent::__construct();
|
9 |
+
$this->setId('promotionalbanner_tabs');
|
10 |
+
$this->setDestElementId('edit_form');
|
11 |
+
$this->setTitle(Mage::helper('promotionalbanner')->__('Item Information'));
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _beforeToHtml()
|
15 |
+
{
|
16 |
+
$this->addTab('form_section', array(
|
17 |
+
'label' => Mage::helper('promotionalbanner')->__('Item Information'),
|
18 |
+
'title' => Mage::helper('promotionalbanner')->__('Item Information'),
|
19 |
+
'content' => $this->getLayout()->createBlock('promotionalbanner/adminhtml_promotionalbanner_edit_tab_form')->toHtml(),
|
20 |
+
));
|
21 |
+
|
22 |
+
return parent::_beforeToHtml();
|
23 |
+
}
|
24 |
+
}
|
app/code/local/Tatva/Promotionalbanner/Block/Adminhtml/Promotionalbanner/Grid.php
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Promotionalbanner_Block_Adminhtml_Promotionalbanner_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->setId('promotionalbannerGrid');
|
9 |
+
$this->setDefaultSort('promotionalbanner_id');
|
10 |
+
$this->setDefaultDir('ASC');
|
11 |
+
$this->setSaveParametersInSession(true);
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _prepareCollection()
|
15 |
+
{
|
16 |
+
$collection = Mage::getModel('promotionalbanner/promotionalbanner')->getCollection();
|
17 |
+
$this->setCollection($collection);
|
18 |
+
return parent::_prepareCollection();
|
19 |
+
}
|
20 |
+
|
21 |
+
protected function _prepareColumns()
|
22 |
+
{
|
23 |
+
$this->addColumn('promotionalbanner_id', array(
|
24 |
+
'header' => Mage::helper('promotionalbanner')->__('ID'),
|
25 |
+
'align' =>'right',
|
26 |
+
'width' => '50px',
|
27 |
+
'index' => 'promotionalbanner_id',
|
28 |
+
));
|
29 |
+
|
30 |
+
$this->addColumn('title', array(
|
31 |
+
'header' => Mage::helper('promotionalbanner')->__('Title'),
|
32 |
+
'align' =>'left',
|
33 |
+
'index' => 'title',
|
34 |
+
));
|
35 |
+
|
36 |
+
/*
|
37 |
+
$this->addColumn('content', array(
|
38 |
+
'header' => Mage::helper('promotionalbanner')->__('Item Content'),
|
39 |
+
'width' => '150px',
|
40 |
+
'index' => 'content',
|
41 |
+
));
|
42 |
+
*/
|
43 |
+
|
44 |
+
$this->addColumn('status', array(
|
45 |
+
'header' => Mage::helper('promotionalbanner')->__('Status'),
|
46 |
+
'align' => 'left',
|
47 |
+
'width' => '80px',
|
48 |
+
'index' => 'status',
|
49 |
+
'type' => 'options',
|
50 |
+
'options' => array(
|
51 |
+
1 => 'Enabled',
|
52 |
+
2 => 'Disabled',
|
53 |
+
),
|
54 |
+
));
|
55 |
+
|
56 |
+
$this->addColumn('action',
|
57 |
+
array(
|
58 |
+
'header' => Mage::helper('promotionalbanner')->__('Action'),
|
59 |
+
'width' => '100',
|
60 |
+
'type' => 'action',
|
61 |
+
'getter' => 'getId',
|
62 |
+
'actions' => array(
|
63 |
+
array(
|
64 |
+
'caption' => Mage::helper('promotionalbanner')->__('Edit'),
|
65 |
+
'url' => array('base'=> '*/*/edit'),
|
66 |
+
'field' => 'id'
|
67 |
+
)
|
68 |
+
),
|
69 |
+
'filter' => false,
|
70 |
+
'sortable' => false,
|
71 |
+
'index' => 'stores',
|
72 |
+
'is_system' => true,
|
73 |
+
));
|
74 |
+
|
75 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('promotionalbanner')->__('CSV'));
|
76 |
+
$this->addExportType('*/*/exportXml', Mage::helper('promotionalbanner')->__('XML'));
|
77 |
+
|
78 |
+
return parent::_prepareColumns();
|
79 |
+
}
|
80 |
+
|
81 |
+
protected function _prepareMassaction()
|
82 |
+
{
|
83 |
+
$this->setMassactionIdField('promotionalbanner_id');
|
84 |
+
$this->getMassactionBlock()->setFormFieldName('promotionalbanner');
|
85 |
+
|
86 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
87 |
+
'label' => Mage::helper('promotionalbanner')->__('Delete'),
|
88 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
89 |
+
'confirm' => Mage::helper('promotionalbanner')->__('Are you sure?')
|
90 |
+
));
|
91 |
+
|
92 |
+
$statuses = Mage::getSingleton('promotionalbanner/status')->getOptionArray();
|
93 |
+
|
94 |
+
array_unshift($statuses, array('label'=>'', 'value'=>''));
|
95 |
+
$this->getMassactionBlock()->addItem('status', array(
|
96 |
+
'label'=> Mage::helper('promotionalbanner')->__('Change status'),
|
97 |
+
'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
|
98 |
+
'additional' => array(
|
99 |
+
'visibility' => array(
|
100 |
+
'name' => 'status',
|
101 |
+
'type' => 'select',
|
102 |
+
'class' => 'required-entry',
|
103 |
+
'label' => Mage::helper('promotionalbanner')->__('Status'),
|
104 |
+
'values' => $statuses
|
105 |
+
)
|
106 |
+
)
|
107 |
+
));
|
108 |
+
return $this;
|
109 |
+
}
|
110 |
+
|
111 |
+
public function getRowUrl($row)
|
112 |
+
{
|
113 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
114 |
+
}
|
115 |
+
|
116 |
+
}
|
app/code/local/Tatva/Promotionalbanner/Block/Promotionalbanner.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Tatva_Promotionalbanner_Block_Promotionalbanner extends Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
public function _prepareLayout()
|
5 |
+
{
|
6 |
+
return parent::_prepareLayout();
|
7 |
+
}
|
8 |
+
|
9 |
+
public function getPromotionalbanner()
|
10 |
+
{
|
11 |
+
if (!$this->hasData('promotionalbanner')) {
|
12 |
+
$this->setData('promotionalbanner', Mage::registry('promotionalbanner'));
|
13 |
+
}
|
14 |
+
return $this->getData('promotionalbanner');
|
15 |
+
|
16 |
+
}
|
17 |
+
}
|
app/code/local/Tatva/Promotionalbanner/Helper/Data.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Promotionalbanner_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
app/code/local/Tatva/Promotionalbanner/Model/Mysql4/Promotionalbanner.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Promotionalbanner_Model_Mysql4_Promotionalbanner extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
// Note that the promotionalbanner_id refers to the key field in your database table.
|
8 |
+
$this->_init('promotionalbanner/promotionalbanner', 'promotionalbanner_id');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Tatva/Promotionalbanner/Model/Mysql4/Promotionalbanner/Collection.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Promotionalbanner_Model_Mysql4_Promotionalbanner_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('promotionalbanner/promotionalbanner');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Tatva/Promotionalbanner/Model/Promotionalbanner.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Promotionalbanner_Model_Promotionalbanner extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('promotionalbanner/promotionalbanner');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Tatva/Promotionalbanner/Model/Status.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Promotionalbanner_Model_Status extends Varien_Object
|
4 |
+
{
|
5 |
+
const STATUS_ENABLED = 1;
|
6 |
+
const STATUS_DISABLED = 2;
|
7 |
+
|
8 |
+
static public function getOptionArray()
|
9 |
+
{
|
10 |
+
return array(
|
11 |
+
self::STATUS_ENABLED => Mage::helper('promotionalbanner')->__('Enabled'),
|
12 |
+
self::STATUS_DISABLED => Mage::helper('promotionalbanner')->__('Disabled')
|
13 |
+
);
|
14 |
+
}
|
15 |
+
}
|
app/code/local/Tatva/Promotionalbanner/controllers/Adminhtml/PromotionalbannerController.php
ADDED
@@ -0,0 +1,214 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tatva_Promotionalbanner_Adminhtml_PromotionalbannerController extends Mage_Adminhtml_Controller_action
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _initAction() {
|
7 |
+
$this->loadLayout()
|
8 |
+
->_setActiveMenu('promotionalbanner/items')
|
9 |
+
->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
10 |
+
|
11 |
+
return $this;
|
12 |
+
}
|
13 |
+
|
14 |
+
public function indexAction() {
|
15 |
+
$this->_initAction()
|
16 |
+
->renderLayout();
|
17 |
+
}
|
18 |
+
|
19 |
+
public function editAction() {
|
20 |
+
$id = $this->getRequest()->getParam('id');
|
21 |
+
$model = Mage::getModel('promotionalbanner/promotionalbanner')->load($id);
|
22 |
+
|
23 |
+
if ($model->getId() || $id == 0) {
|
24 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
25 |
+
if (!empty($data)) {
|
26 |
+
$model->setData($data);
|
27 |
+
}
|
28 |
+
|
29 |
+
Mage::register('promotionalbanner_data', $model);
|
30 |
+
|
31 |
+
$this->loadLayout();
|
32 |
+
$this->_setActiveMenu('promotionalbanner/items');
|
33 |
+
|
34 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
35 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
|
36 |
+
|
37 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
38 |
+
|
39 |
+
$this->_addContent($this->getLayout()->createBlock('promotionalbanner/adminhtml_promotionalbanner_edit'))
|
40 |
+
->_addLeft($this->getLayout()->createBlock('promotionalbanner/adminhtml_promotionalbanner_edit_tabs'));
|
41 |
+
|
42 |
+
$this->renderLayout();
|
43 |
+
} else {
|
44 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('promotionalbanner')->__('Item does not exist'));
|
45 |
+
$this->_redirect('*/*/');
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
public function newAction() {
|
50 |
+
$this->_forward('edit');
|
51 |
+
}
|
52 |
+
|
53 |
+
public function saveAction() {
|
54 |
+
if ($data = $this->getRequest()->getPost()) {
|
55 |
+
|
56 |
+
if(isset($_FILES['filename']['name']) && $_FILES['filename']['name'] != '') {
|
57 |
+
try {
|
58 |
+
/* Starting upload */
|
59 |
+
$uploader = new Varien_File_Uploader('filename');
|
60 |
+
|
61 |
+
// Any extention would work
|
62 |
+
$uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
|
63 |
+
$uploader->setAllowRenameFiles(false);
|
64 |
+
|
65 |
+
// Set the file upload mode
|
66 |
+
// false -> get the file directly in the specified folder
|
67 |
+
// true -> get the file in the product like folders
|
68 |
+
// (file.jpg will go in something like /media/f/i/file.jpg)
|
69 |
+
$uploader->setFilesDispersion(false);
|
70 |
+
|
71 |
+
// We set media as the upload dir
|
72 |
+
$path = Mage::getBaseDir('media') . DS ;
|
73 |
+
$uploader->save($path, $_FILES['filename']['name'] );
|
74 |
+
|
75 |
+
} catch (Exception $e) {
|
76 |
+
|
77 |
+
}
|
78 |
+
|
79 |
+
//this way the name is saved in DB
|
80 |
+
$data['filename'] = $_FILES['filename']['name'];
|
81 |
+
}
|
82 |
+
|
83 |
+
|
84 |
+
$model = Mage::getModel('promotionalbanner/promotionalbanner');
|
85 |
+
$model->setData($data)
|
86 |
+
->setId($this->getRequest()->getParam('id'));
|
87 |
+
|
88 |
+
try {
|
89 |
+
if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
|
90 |
+
$model->setCreatedTime(now())
|
91 |
+
->setUpdateTime(now());
|
92 |
+
} else {
|
93 |
+
$model->setUpdateTime(now());
|
94 |
+
}
|
95 |
+
|
96 |
+
$model->save();
|
97 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('promotionalbanner')->__('Item was successfully saved'));
|
98 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
99 |
+
|
100 |
+
if ($this->getRequest()->getParam('back')) {
|
101 |
+
$this->_redirect('*/*/edit', array('id' => $model->getId()));
|
102 |
+
return;
|
103 |
+
}
|
104 |
+
$this->_redirect('*/*/');
|
105 |
+
return;
|
106 |
+
} catch (Exception $e) {
|
107 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
108 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
109 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
110 |
+
return;
|
111 |
+
}
|
112 |
+
}
|
113 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('promotionalbanner')->__('Unable to find item to save'));
|
114 |
+
$this->_redirect('*/*/');
|
115 |
+
}
|
116 |
+
|
117 |
+
public function deleteAction() {
|
118 |
+
if( $this->getRequest()->getParam('id') > 0 ) {
|
119 |
+
try {
|
120 |
+
$model = Mage::getModel('promotionalbanner/promotionalbanner');
|
121 |
+
|
122 |
+
$model->setId($this->getRequest()->getParam('id'))
|
123 |
+
->delete();
|
124 |
+
|
125 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
|
126 |
+
$this->_redirect('*/*/');
|
127 |
+
} catch (Exception $e) {
|
128 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
129 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
130 |
+
}
|
131 |
+
}
|
132 |
+
$this->_redirect('*/*/');
|
133 |
+
}
|
134 |
+
|
135 |
+
public function massDeleteAction() {
|
136 |
+
$promotionalbannerIds = $this->getRequest()->getParam('promotionalbanner');
|
137 |
+
if(!is_array($promotionalbannerIds)) {
|
138 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
|
139 |
+
} else {
|
140 |
+
try {
|
141 |
+
foreach ($promotionalbannerIds as $promotionalbannerId) {
|
142 |
+
$promotionalbanner = Mage::getModel('promotionalbanner/promotionalbanner')->load($promotionalbannerId);
|
143 |
+
$promotionalbanner->delete();
|
144 |
+
}
|
145 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
146 |
+
Mage::helper('adminhtml')->__(
|
147 |
+
'Total of %d record(s) were successfully deleted', count($promotionalbannerIds)
|
148 |
+
)
|
149 |
+
);
|
150 |
+
} catch (Exception $e) {
|
151 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
152 |
+
}
|
153 |
+
}
|
154 |
+
$this->_redirect('*/*/index');
|
155 |
+
}
|
156 |
+
|
157 |
+
public function massStatusAction()
|
158 |
+
{
|
159 |
+
$promotionalbannerIds = $this->getRequest()->getParam('promotionalbanner');
|
160 |
+
if(!is_array($promotionalbannerIds)) {
|
161 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
|
162 |
+
} else {
|
163 |
+
try {
|
164 |
+
foreach ($promotionalbannerIds as $promotionalbannerId) {
|
165 |
+
$promotionalbanner = Mage::getSingleton('promotionalbanner/promotionalbanner')
|
166 |
+
->load($promotionalbannerId)
|
167 |
+
->setStatus($this->getRequest()->getParam('status'))
|
168 |
+
->setIsMassupdate(true)
|
169 |
+
->save();
|
170 |
+
}
|
171 |
+
$this->_getSession()->addSuccess(
|
172 |
+
$this->__('Total of %d record(s) were successfully updated', count($promotionalbannerIds))
|
173 |
+
);
|
174 |
+
} catch (Exception $e) {
|
175 |
+
$this->_getSession()->addError($e->getMessage());
|
176 |
+
}
|
177 |
+
}
|
178 |
+
$this->_redirect('*/*/index');
|
179 |
+
}
|
180 |
+
|
181 |
+
public function exportCsvAction()
|
182 |
+
{
|
183 |
+
$fileName = 'promotionalbanner.csv';
|
184 |
+
$content = $this->getLayout()->createBlock('promotionalbanner/adminhtml_promotionalbanner_grid')
|
185 |
+
->getCsv();
|
186 |
+
|
187 |
+
$this->_sendUploadResponse($fileName, $content);
|
188 |
+
}
|
189 |
+
|
190 |
+
public function exportXmlAction()
|
191 |
+
{
|
192 |
+
$fileName = 'promotionalbanner.xml';
|
193 |
+
$content = $this->getLayout()->createBlock('promotionalbanner/adminhtml_promotionalbanner_grid')
|
194 |
+
->getXml();
|
195 |
+
|
196 |
+
$this->_sendUploadResponse($fileName, $content);
|
197 |
+
}
|
198 |
+
|
199 |
+
protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
|
200 |
+
{
|
201 |
+
$response = $this->getResponse();
|
202 |
+
$response->setHeader('HTTP/1.1 200 OK','');
|
203 |
+
$response->setHeader('Pragma', 'public', true);
|
204 |
+
$response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
|
205 |
+
$response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
|
206 |
+
$response->setHeader('Last-Modified', date('r'));
|
207 |
+
$response->setHeader('Accept-Ranges', 'bytes');
|
208 |
+
$response->setHeader('Content-Length', strlen($content));
|
209 |
+
$response->setHeader('Content-type', $contentType);
|
210 |
+
$response->setBody($content);
|
211 |
+
$response->sendResponse();
|
212 |
+
die;
|
213 |
+
}
|
214 |
+
}
|
app/code/local/Tatva/Promotionalbanner/controllers/IndexController.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Tatva_Promotionalbanner_IndexController extends Mage_Core_Controller_Front_Action
|
3 |
+
{
|
4 |
+
public function indexAction()
|
5 |
+
{
|
6 |
+
|
7 |
+
/*
|
8 |
+
* Load an object by id
|
9 |
+
* Request looking like:
|
10 |
+
* http://site.com/promotionalbanner?id=15
|
11 |
+
* or
|
12 |
+
* http://site.com/promotionalbanner/id/15
|
13 |
+
*/
|
14 |
+
/*
|
15 |
+
$promotionalbanner_id = $this->getRequest()->getParam('id');
|
16 |
+
|
17 |
+
if($promotionalbanner_id != null && $promotionalbanner_id != '') {
|
18 |
+
$promotionalbanner = Mage::getModel('promotionalbanner/promotionalbanner')->load($promotionalbanner_id)->getData();
|
19 |
+
} else {
|
20 |
+
$promotionalbanner = null;
|
21 |
+
}
|
22 |
+
*/
|
23 |
+
|
24 |
+
/*
|
25 |
+
* If no param we load a the last created item
|
26 |
+
*/
|
27 |
+
/*
|
28 |
+
if($promotionalbanner == null) {
|
29 |
+
$resource = Mage::getSingleton('core/resource');
|
30 |
+
$read= $resource->getConnection('core_read');
|
31 |
+
$promotionalbannerTable = $resource->getTableName('promotionalbanner');
|
32 |
+
|
33 |
+
$select = $read->select()
|
34 |
+
->from($promotionalbannerTable,array('promotionalbanner_id','title','content','status'))
|
35 |
+
->where('status',1)
|
36 |
+
->order('created_time DESC') ;
|
37 |
+
|
38 |
+
$promotionalbanner = $read->fetchRow($select);
|
39 |
+
}
|
40 |
+
Mage::register('promotionalbanner', $promotionalbanner);
|
41 |
+
*/
|
42 |
+
|
43 |
+
|
44 |
+
$this->loadLayout();
|
45 |
+
$this->renderLayout();
|
46 |
+
}
|
47 |
+
}
|
app/code/local/Tatva/Promotionalbanner/etc/config.xml
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Tatva_Promotionalbanner>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Tatva_Promotionalbanner>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<promotionalbanner>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Tatva_Promotionalbanner</module>
|
14 |
+
<frontName>promotionalbanner</frontName>
|
15 |
+
</args>
|
16 |
+
</promotionalbanner>
|
17 |
+
</routers>
|
18 |
+
<layout>
|
19 |
+
<updates>
|
20 |
+
<promotionalbanner>
|
21 |
+
<file>promotionalbanner.xml</file>
|
22 |
+
</promotionalbanner>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
</frontend>
|
26 |
+
<admin>
|
27 |
+
<routers>
|
28 |
+
<promotionalbanner>
|
29 |
+
<use>admin</use>
|
30 |
+
<args>
|
31 |
+
<module>Tatva_Promotionalbanner</module>
|
32 |
+
<frontName>promotionalbanner</frontName>
|
33 |
+
</args>
|
34 |
+
</promotionalbanner>
|
35 |
+
</routers>
|
36 |
+
</admin>
|
37 |
+
<adminhtml>
|
38 |
+
<menu>
|
39 |
+
<promotionalbanner module="promotionalbanner">
|
40 |
+
<title>Promotionalbanner</title>
|
41 |
+
<sort_order>71</sort_order>
|
42 |
+
<children>
|
43 |
+
<items module="promotionalbanner">
|
44 |
+
<title>Manage Items</title>
|
45 |
+
<sort_order>0</sort_order>
|
46 |
+
<action>promotionalbanner/adminhtml_promotionalbanner</action>
|
47 |
+
</items>
|
48 |
+
</children>
|
49 |
+
</promotionalbanner>
|
50 |
+
</menu>
|
51 |
+
<acl>
|
52 |
+
<resources>
|
53 |
+
<all>
|
54 |
+
<title>Allow Everything</title>
|
55 |
+
</all>
|
56 |
+
<admin>
|
57 |
+
<children>
|
58 |
+
<Tatva_Promotionalbanner>
|
59 |
+
<title>Promotionalbanner Module</title>
|
60 |
+
<sort_order>10</sort_order>
|
61 |
+
</Tatva_Promotionalbanner>
|
62 |
+
</children>
|
63 |
+
</admin>
|
64 |
+
</resources>
|
65 |
+
</acl>
|
66 |
+
<layout>
|
67 |
+
<updates>
|
68 |
+
<promotionalbanner>
|
69 |
+
<file>promotionalbanner.xml</file>
|
70 |
+
</promotionalbanner>
|
71 |
+
</updates>
|
72 |
+
</layout>
|
73 |
+
</adminhtml>
|
74 |
+
<global>
|
75 |
+
<models>
|
76 |
+
<promotionalbanner>
|
77 |
+
<class>Tatva_Promotionalbanner_Model</class>
|
78 |
+
<resourceModel>promotionalbanner_mysql4</resourceModel>
|
79 |
+
</promotionalbanner>
|
80 |
+
<promotionalbanner_mysql4>
|
81 |
+
<class>Tatva_Promotionalbanner_Model_Mysql4</class>
|
82 |
+
<entities>
|
83 |
+
<promotionalbanner>
|
84 |
+
<table>promotionalbanner</table>
|
85 |
+
</promotionalbanner>
|
86 |
+
</entities>
|
87 |
+
</promotionalbanner_mysql4>
|
88 |
+
</models>
|
89 |
+
<resources>
|
90 |
+
<promotionalbanner_setup>
|
91 |
+
<setup>
|
92 |
+
<module>Tatva_Promotionalbanner</module>
|
93 |
+
</setup>
|
94 |
+
<connection>
|
95 |
+
<use>core_setup</use>
|
96 |
+
</connection>
|
97 |
+
</promotionalbanner_setup>
|
98 |
+
<promotionalbanner_write>
|
99 |
+
<connection>
|
100 |
+
<use>core_write</use>
|
101 |
+
</connection>
|
102 |
+
</promotionalbanner_write>
|
103 |
+
<promotionalbanner_read>
|
104 |
+
<connection>
|
105 |
+
<use>core_read</use>
|
106 |
+
</connection>
|
107 |
+
</promotionalbanner_read>
|
108 |
+
</resources>
|
109 |
+
<blocks>
|
110 |
+
<promotionalbanner>
|
111 |
+
<class>Tatva_Promotionalbanner_Block</class>
|
112 |
+
</promotionalbanner>
|
113 |
+
</blocks>
|
114 |
+
<helpers>
|
115 |
+
<promotionalbanner>
|
116 |
+
<class>Tatva_Promotionalbanner_Helper</class>
|
117 |
+
</promotionalbanner>
|
118 |
+
</helpers>
|
119 |
+
</global>
|
120 |
+
</config>
|
app/code/local/Tatva/Promotionalbanner/sql/promotionalbanner_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
|
9 |
+
-- DROP TABLE IF EXISTS {$this->getTable('promotionalbanner')};
|
10 |
+
CREATE TABLE {$this->getTable('promotionalbanner')} (
|
11 |
+
`promotionalbanner_id` int(11) unsigned NOT NULL auto_increment,
|
12 |
+
`title` varchar(255) NOT NULL default '',
|
13 |
+
`filename` varchar(255) NOT NULL default '',
|
14 |
+
`position` smallint(6) NOT NULL default '1',
|
15 |
+
`status` smallint(6) NOT NULL default '0',
|
16 |
+
`sort_order` int(11) NOT NULL default '0',
|
17 |
+
`created_time` datetime NULL,
|
18 |
+
`update_time` datetime NULL,
|
19 |
+
PRIMARY KEY (`promotionalbanner_id`)
|
20 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
21 |
+
|
22 |
+
");
|
23 |
+
|
24 |
+
$installer->endSetup();
|
app/code/local/Tatva/Slider/Block/Adminhtml/Slider/Edit/Tabs.php
CHANGED
@@ -24,7 +24,7 @@ class Tatva_Slider_Block_Adminhtml_Slider_Edit_Tabs extends Mage_Adminhtml_Block
|
|
24 |
'active' => true,
|
25 |
)
|
26 |
);
|
27 |
-
|
28 |
return $return;
|
29 |
}
|
30 |
}
|
24 |
'active' => true,
|
25 |
)
|
26 |
);
|
27 |
+
|
28 |
return $return;
|
29 |
}
|
30 |
}
|
app/code/local/Tatva/Slider/etc/adminhtml.xml
CHANGED
@@ -10,6 +10,11 @@
|
|
10 |
<sort_order>0</sort_order>
|
11 |
<action>slider/adminhtml_slider</action>
|
12 |
</items>
|
|
|
|
|
|
|
|
|
|
|
13 |
</children>
|
14 |
</slider>
|
15 |
</menu>
|
10 |
<sort_order>0</sort_order>
|
11 |
<action>slider/adminhtml_slider</action>
|
12 |
</items>
|
13 |
+
<config module="slider">
|
14 |
+
<title>Slider Configuration</title>
|
15 |
+
<sort_order>3</sort_order>
|
16 |
+
<action>adminhtml/system_config/edit/section/slider</action>
|
17 |
+
</config>
|
18 |
</children>
|
19 |
</slider>
|
20 |
</menu>
|
app/code/local/Tatva/Slider/etc/config.xml
CHANGED
@@ -45,6 +45,11 @@
|
|
45 |
<sort_order>0</sort_order>
|
46 |
<action>slider/adminhtml_slider</action>
|
47 |
</items>
|
|
|
|
|
|
|
|
|
|
|
48 |
</children>
|
49 |
</slider>
|
50 |
</menu>
|
45 |
<sort_order>0</sort_order>
|
46 |
<action>slider/adminhtml_slider</action>
|
47 |
</items>
|
48 |
+
<config module="slider">
|
49 |
+
<title>Slider Configuration</title>
|
50 |
+
<sort_order>3</sort_order>
|
51 |
+
<action>adminhtml/system_config/edit/section/slider</action>
|
52 |
+
</config>
|
53 |
</children>
|
54 |
</slider>
|
55 |
</menu>
|
app/design/frontend/default/default/template/slider/slider.phtml
CHANGED
@@ -29,7 +29,7 @@
|
|
29 |
?>
|
30 |
|
31 |
<script type="text/javascript" language="javascript">
|
32 |
-
|
33 |
function mycarousel_initCallback(carousel) {
|
34 |
carousel.buttonNext.bind('click', function() {
|
35 |
carousel.startAuto(0);
|
@@ -92,18 +92,10 @@
|
|
92 |
}
|
93 |
});
|
94 |
});
|
|
|
95 |
</script>
|
96 |
|
97 |
<div id="primopiano_big" style="width:<?php echo $width?>px; height:<?php echo $height?>px;">
|
98 |
-
<?php if($square) { ?>
|
99 |
-
<ul id="primopiano_menu" style="left: <?php echo $left?>px;">
|
100 |
-
<?php $i=1;foreach($slider as $item):?>
|
101 |
-
<li id="link_primopiano_<?php echo $i?>">
|
102 |
-
<a rel="<?php echo $i?>" href="#"> </a>
|
103 |
-
</li>
|
104 |
-
<?php $i++;endforeach;?>
|
105 |
-
</ul>
|
106 |
-
<?php } ?>
|
107 |
<div class="jcarousel-container jcarousel-container-horizontal" style="display: block;">
|
108 |
<?php if($button == 1) { ?>
|
109 |
<div class="jcarousel-prev jcarousel-prev-horizontal" style="display: block;" disabled="false"></div>
|
@@ -113,7 +105,13 @@
|
|
113 |
<ul id="primopiano_slide" class="jcarousel-list jcarousel-list-horizontal" >
|
114 |
<?php $i=1;foreach($slider as $item):?>
|
115 |
<li id="primopiano_<?php echo $i?>" jcarouselindex="<?php echo $i?>">
|
116 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
<?php if($content) { ?>
|
118 |
<div class="text" style="width:<?php echo $contentwidth?>px; height:<?php echo ($height-15) ?>px;">
|
119 |
<h2><?php echo $item->getTitle();?></h2>
|
@@ -128,6 +126,16 @@
|
|
128 |
</div>
|
129 |
</div>
|
130 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
<?php if($title) { ?>
|
132 |
<div class="paging banscrollbg" id="mygaltop" style="width: <?php echo ($width-12) ;?>px;">
|
133 |
<ul id="gooeymenu" class="solidblockmenu">
|
29 |
?>
|
30 |
|
31 |
<script type="text/javascript" language="javascript">
|
32 |
+
|
33 |
function mycarousel_initCallback(carousel) {
|
34 |
carousel.buttonNext.bind('click', function() {
|
35 |
carousel.startAuto(0);
|
92 |
}
|
93 |
});
|
94 |
});
|
95 |
+
jQuery.noConflict();
|
96 |
</script>
|
97 |
|
98 |
<div id="primopiano_big" style="width:<?php echo $width?>px; height:<?php echo $height?>px;">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
<div class="jcarousel-container jcarousel-container-horizontal" style="display: block;">
|
100 |
<?php if($button == 1) { ?>
|
101 |
<div class="jcarousel-prev jcarousel-prev-horizontal" style="display: block;" disabled="false"></div>
|
105 |
<ul id="primopiano_slide" class="jcarousel-list jcarousel-list-horizontal" >
|
106 |
<?php $i=1;foreach($slider as $item):?>
|
107 |
<li id="primopiano_<?php echo $i?>" jcarouselindex="<?php echo $i?>">
|
108 |
+
<?php if($item->getSliderUrl()){ ?>
|
109 |
+
<a href="<?php echo $item->getSliderUrl() ?>" target="_blank">
|
110 |
+
<?php } ?>
|
111 |
+
<img src="<?php echo Mage::getBaseUrl('media') . 'customerslider/' . $item->getFilename(); ?>" height="<?php echo $imageheight?>" width="<?php echo $imagewidth?>"/>
|
112 |
+
<?php if($item->getSliderUrl()){ ?>
|
113 |
+
</a>
|
114 |
+
<?php } ?>
|
115 |
<?php if($content) { ?>
|
116 |
<div class="text" style="width:<?php echo $contentwidth?>px; height:<?php echo ($height-15) ?>px;">
|
117 |
<h2><?php echo $item->getTitle();?></h2>
|
126 |
</div>
|
127 |
</div>
|
128 |
</div>
|
129 |
+
|
130 |
+
<?php if($square) { ?>
|
131 |
+
<ul id="primopiano_menu" style="left: <?php echo $left?>px;">
|
132 |
+
<?php $i=1;foreach($slider as $item):?>
|
133 |
+
<li id="link_primopiano_<?php echo $i?>">
|
134 |
+
<a rel="<?php echo $i?>" href="#"> </a>
|
135 |
+
</li>
|
136 |
+
<?php $i++;endforeach;?>
|
137 |
+
</ul>
|
138 |
+
<?php } ?>
|
139 |
<?php if($title) { ?>
|
140 |
<div class="paging banscrollbg" id="mygaltop" style="width: <?php echo ($width-12) ;?>px;">
|
141 |
<ul id="gooeymenu" class="solidblockmenu">
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Etatvasoft_Dynamic_Image_Slider</name>
|
4 |
-
<version>1.5.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
|
7 |
<channel>community</channel>
|
@@ -14,9 +14,9 @@ All features are configurable from admin like width, height, auto slideshow, dis
|
|
14 |
</description>
|
15 |
<notes>All features are configurable from admin like width, height, auto slideshow, display next previous arrow, show caption, show navigation images, max number of slides to display, display slide content, time between two slides.</notes>
|
16 |
<authors><author><name>Etatvasoft</name><user>Etatvasoft</user><email>etatvasoft.magentodevelopment@gmail.com</email></author></authors>
|
17 |
-
<date>2013-
|
18 |
-
<time>
|
19 |
-
<contents><target name="magelocal"><dir name="Tatva"><dir name="Slider"><dir name="Block"><dir name="Adminhtml"><dir name="Slider"><dir name="Edit"><file name="Form.php" hash="ca930481c7735510714bc08f3ed54388"/><dir name="Tab"><file name="Form.php" hash="54e9c80c9066465a2bf8f69fc54769a2"/></dir><file name="Tabs.php" hash="caad7f9056c9c07c392980656c356871"/></dir><file name="Edit.php" hash="8a3a0fef10e2e61350a5b96d42919fc3"/><file name="Grid.php" hash="f514362d14115b3723e936728a856ce0"/></dir><file name="Slider.php" hash="d1c6599add8772e4b564fa24d0706742"/></dir><file name="Slider.php" hash="206931d8e27c6917f7a2644006780348"/></dir><dir name="Helper"><file name="Data.php" hash="1040dcdf8a42eed3e0010fed0d6128a3"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Slider"><file name="Collection.php" hash="2ae22e2c3320dd3a22c853d443cc914f"/></dir><file name="Slider.php" hash="f58a717ab3b4bd59ba605649129ca9d1"/></dir><file name="Slider.php" hash="0d75c8352f467422a324d68e4e8f1ccb"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="SliderController.php" hash="cea85ed88e7daefc237ba9554f78ec30"/></dir><file name="IndexController.php" hash="c1fc4c20c94f5c3076b1be1370add42a"/></dir><dir name="etc"><file name="adminhtml.xml" hash="bebfdfea65ef756de4153f0dba4a2b10"/><file name="config.xml" hash="a2800ac31a36329fc7740b00ceee1070"/><file name="system.xml" hash="0ce62b0e65d5096ddc8564169705cb92"/></dir><dir name="sql"><dir name="slider_setup"><file name="mysql4-install-0.1.0.php" hash="efd60f0f0fd9351c16c15aca41bdfb48"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="slider"><file name="slider.xml" hash="a110923b7eeb351204c9e43f6ca8e0dd"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><dir name="slider"><file name="slider.xml" hash="9651b1f4114b5f8ff1229886b4607fca"/></dir></dir><dir name="template"><dir name="slider"><file name="slider.phtml" hash="54bebb898706ad8a076829b9acf477df"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Tatva_Slider.xml" hash="248fedac6d3c4175a2564765fde3b4a9"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><dir name="slider"><file name="slider.css" hash="dab445ad3a99959812c5af9d2865a780"/></dir></dir><dir name="images"><dir name="slider"><file name="Thumbs.db" hash="a4e466bbbb29524e0d89c23c19829437"/><file name="b_next.png" hash="d72dde0609aded61a24fa18cdca4bf7f"/><file name="b_prev.png" hash="86e333b7023d493e8024ccc6b32cd690"/><file name="bannerscrollbg.gif" hash="bd8c7ef3273a6219fd1bb56bc24cbf6d"/><file name="bluehbg.gif" hash="bdd4f53932bd952684d5d87a69c261c3"/><file name="carousel_next.png" hash="8a6d7719accc317e0dbd4a831677598c"/><file name="carousel_prev.png" hash="849d28e8873e8104c232348348c5e5b8"/><file name="content_bg.jpg" hash="e32654532856667842f9002208341e15"/><file name="next.png" hash="1b2ee17462251a2bd374a8a8a49d6ede"/><file name="next_arrow.png" hash="f395949692f96b812d41521dc8418e37"/><file name="num-act.png" hash="bead24653e91070840cec1153577ba24"/><file name="num.png" hash="4847ee03d68096c72339117db3ce981d"/><file name="prev.png" hash="e0b379b1a7db33c59cc90c4068b2ae3f"/><file name="prev_arrow.png" hash="3ba0da3255d4aac51f8bddf814abd480"/><file name="primopiano_menu.gif" hash="157cf32c6c9a103000441d1cf13768bf"/><file name="primopiano_menu2.gif" hash="2e08aa45e6ad2bd460832bf2c0c20069"/><file name="scroolbg.gif" hash="39d89710b27da072e63bbbdc474ab090"/></dir></dir><dir name="js"><dir name="slider"><file name="jquery-1.6.4.min.js" hash="fdcd59e694043785ddaebb2c688cfa64"/><file name="jquery.jcarousel.js" hash="c12b6393fdd5aa32fc572ce1594d4184"/></dir></dir></dir></dir></dir></target></contents>
|
20 |
<compatible/>
|
21 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
22 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Etatvasoft_Dynamic_Image_Slider</name>
|
4 |
+
<version>1.5.3</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
|
7 |
<channel>community</channel>
|
14 |
</description>
|
15 |
<notes>All features are configurable from admin like width, height, auto slideshow, display next previous arrow, show caption, show navigation images, max number of slides to display, display slide content, time between two slides.</notes>
|
16 |
<authors><author><name>Etatvasoft</name><user>Etatvasoft</user><email>etatvasoft.magentodevelopment@gmail.com</email></author></authors>
|
17 |
+
<date>2013-05-07</date>
|
18 |
+
<time>12:45:22</time>
|
19 |
+
<contents><target name="magelocal"><dir name="Tatva"><dir name="Attachpdf"><dir name="Block"><dir name="Adminhtml"><dir name="Attachpdf"><dir name="Edit"><file name="Form.php" hash="71167307526c08ac0542e614bf415563"/><dir name="Tab"><file name="Form.php" hash="272a88df27d0745a088eb7dda2647060"/></dir><file name="Tabs.php" hash="61752efa8f219f6d22ac8ec9740a3968"/></dir><file name="Edit.php" hash="21344666f3a8cc6e60614540c22aea11"/><file name="Grid.php" hash="051c12d5151e5fd7939c5d79f489ef06"/></dir><file name="Attachpdf.php" hash="b675e659432cb6ce42c414d1b6dddd09"/></dir><file name="Attachpdf.php" hash="d4cc880be6d6569787690b9654080e53"/></dir><dir name="Helper"><file name="Data.php" hash="818f669b000506a41788c47598172a9e"/></dir><dir name="Model"><file name="Attachpdf.php" hash="b372e4490e204c4ae9780ca9ea5dd254"/><dir name="Mysql4"><dir name="Attachpdf"><file name="Collection.php" hash="30c06057b8aec69132ff63d28a68ca6b"/></dir><file name="Attachpdf.php" hash="dba497e0be600334ebbf4902aab1b3be"/></dir><file name="Status.php" hash="e7daf4fcf69f842287557b19c4661c98"/></dir><dir name="controllers"><file name="IndexController.php" hash="ca68cf7e84ac470188da10b2b12453cb"/></dir><dir name="etc"><file name="config.xml" hash="46e807981c33a144220b7efd79b8283c"/></dir></dir><dir name="Catalogextensions"><dir name="Block"><dir name="Allproducts"><file name="List.php" hash="23bb783bec9a95377cf7d7bfeebc82e5"/></dir><dir name="Bestsellers"><dir name="Home"><file name="List.php" hash="2ca6ba90bc5f94b767208e9744f2378d"/></dir><file name="List.php" hash="fd407b80b108662fbf3455551f500fd9"/></dir><file name="Catalogextensions.php" hash="c8db46ed313124e15f4547cd23481805"/><dir name="Featured"><dir name="Home"><file name="List.php" hash="821b6fd6ef9beabddb9c74d1d1da26cd"/></dir><file name="List.php" hash="216bff6d57edeb08ec1fbe113f171b61"/></dir><dir name="Mostviewed"><dir name="Home"><file name="List.php" hash="acae4de506c8c106912fc1bbdedd6be0"/></dir><file name="List.php" hash="0b107893f3ac3b0b41308a2a115bb8fd"/></dir><dir name="Newproduct"><dir name="Home"><file name="List.php" hash="3fb45a68a9634e88de44a729caca32da"/></dir><file name="List.php" hash="9585d810fcf72d9df1157510900e6219"/></dir><dir name="Promotional"><dir name="Home"><file name="List.php" hash="60824f9318b57f2ee2cd50f0133b1461"/></dir><file name="List.php" hash="cc021c39e82f12208c86f9f6ac4b043d"/></dir><dir name="lastordered"><dir name="Home"><file name="List.php" hash="f335f13d27a151867e186600a3ba21a3"/></dir><file name="List.php" hash="03fefd64e05776599af96d286c01b48a"/></dir></dir><dir name="Helper"><file name="Data.php" hash="b611bd4cc8fcfbb18474ae0f7abbb92f"/></dir><dir name="Model"><file name="Catalogextensions.php" hash="d13d2010207ce2a98c7aa4d105ab0c89"/><dir name="Mysql4"><dir name="Catalogextensions"><file name="Collection.php" hash="78c860170f8a69d2853dd244d30c3086"/></dir><file name="Catalogextensions.php" hash="19ccf69401d4e2f68c84a99b1fa12e02"/></dir><file name="Status.php" hash="0544078ffbda9356571152f217b4728c"/></dir><dir name="controllers"><file name="IndexController.php" hash="77345a6fd4f3d432d751e98156e8f448"/></dir><dir name="etc"><file name="adminhtml.xml" hash="d049baa4bd9d3ea71f2ea01176344c74"/><file name="config.xml" hash="8f1a67cb30208b1fd87c0d56c9a4cc19"/><file name="system.xml" hash="a7f9c330c14972c0b0052055df509f91"/></dir><dir name="sql"><dir name="catalogextensions_setup"><file name="mysql4-install-0.1.0.php" hash="da1797c1b3d77ae8a140dfd894f139bb"/></dir></dir></dir><dir name="Customtab"><dir name="Block"><dir name="Adminhtml"><dir name="Customtab"><dir name="Edit"><file name="Form.php" hash="a27a450cc8ce6b145d06468cac3ba3f8"/><dir name="Tab"><file name="Form.php" hash="399f13d1a51f86d12a2d733f01e1dc40"/></dir><file name="Tabs.php" hash="48a3e22f77cfcde64c3ebee60a8af70c"/></dir><file name="Edit.php" hash="e6e9e7b54118284776d21d11f368b0eb"/><file name="Grid.php" hash="f68a7102ed5b038de920016f1a9a62a4"/></dir><file name="Customtab.php" hash="8374194529bd3d00abba9b658f822a44"/></dir><file name="Customtab.php" hash="0b25a63f0d60ec41a0171af08f480974"/></dir><dir name="Helper"><file name="Data.php" hash="5817a9110e741c8da224f94037312499"/></dir><dir name="Model"><file name="Customtab.php" hash="3b5a1bab02e19b9f48d11119a4f04e3d"/><dir name="Mysql4"><dir name="Customtab"><file name="Collection.php" hash="98ed0e74ebf3930ebdd6d85bbc5c64ed"/></dir><file name="Customtab.php" hash="f59ba37df980f9abd111bf1a2290540e"/></dir><file name="Status.php" hash="0e63b9babd2e6dc60637f0717a0b046b"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="CustomtabController.php" hash="707f3257de821187d43e7f52bfb62bcc"/></dir><file name="IndexController.php" hash="2c7d48dfed058bf9c79e1f7a8720917a"/></dir><dir name="etc"><file name="adminhtml.xml" hash="565b3f92e130c2175159552065f962ec"/><file name="config.xml" hash="b15eb3ea2bc472f29ddf5565c1ae19b0"/></dir><dir name="sql"><dir name="customtab_setup"><file name="mysql4-install-0.1.0.php" hash="5ed7f3c185e049eba0efb22303c195e5"/></dir></dir></dir><dir name="Downloadablereport"><dir name="Block"><dir name="Adminhtml"><dir name="Downloadablereport"><dir name="Edit"><file name="Form.php" hash="8e486535367fb8b8b3b431aa2c64a050"/><dir name="Tab"><file name="Form.php" hash="241d2d7ef04444dd253acc702a286fc7"/></dir><file name="Tabs.php" hash="9c0ae1b8c9e3257759d575dbf876ac47"/></dir><file name="Edit.php" hash="dcf3612a607c6e08c29b3e53f053a520"/><file name="Grid.php" hash="ed36d34c00177e41bf3c57e21cfcfd45"/></dir><file name="Downloadablereport.php" hash="fea6eca807b63b7813db8d58e41b24b7"/></dir><file name="Downloadablereport.php" hash="a6db01454924d3ee9bc8ea1b88ae62b0"/></dir><dir name="Helper"><file name="Data.php" hash="a8567da03125b258ae13dde552118f3c"/></dir><dir name="Model"><file name="Downloadablereport.php" hash="9f4592bf8caf9bc1ebc1aa387c9c4d7a"/><dir name="Mysql4"><dir name="Downloadablereport"><file name="Collection.php" hash="8ebc1996d41159142652791735d96225"/></dir><file name="Downloadablereport.php" hash="388f77f380fd1e22a377b0439e43e911"/></dir><file name="Status.php" hash="ba59c744ba717cb713d3c67f579ea1ac"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="DownloadablereportController.php" hash="04471a8ce129922af0c629aa3d042dec"/></dir><file name="IndexController.php" hash="6e708f36f0628fc91d6caeecbc4bc5b2"/></dir><dir name="etc"><file name="config.xml" hash="d2677f82ab837de646108d57205506f0"/></dir><dir name="sql"><dir name="downloadablereport_setup"><file name="mysql4-install-0.1.0.php" hash="e02faa1ca822edb64bf1cd02d83b27a7"/></dir></dir></dir><dir name="Editorder"><dir name="Block"><dir name="Adminhtml"><dir name="Editorder"><dir name="Edit"><file name="Form.php" hash="24d23ddeee1f132dde30407d69523bbb"/><dir name="Tab"><file name="Form.php" hash="768011f9321589a1018bcc8653d19fd9"/></dir><file name="Tabs.php" hash="594bde9dce29e9bd60db741cf102d21f"/></dir><file name="Edit.php" hash="13fa1426a81aa9d6a0ff7ee5fa48c4b2"/><file name="Grid.php" hash="8041cf4361ec8e84ed224284987917b7"/></dir><file name="Editorder.php" hash="651996a53ecb91b759d6b937962c218a"/></dir><file name="Editorder.php" hash="9b2366cdc3baa4f00c285a38c818908b"/></dir><dir name="Helper"><file name="Data.php" hash="69b0ba17775a86ba95415332bedf1768"/></dir><dir name="Model"><file name="Editorder.php" hash="9e86db74abd40b12bbf00d90f5373477"/><dir name="Mysql4"><dir name="Editorder"><file name="Collection.php" hash="f7a8e6120bf723190a71d6b37d042a05"/></dir><file name="Editorder.php" hash="695a5f549da0d85232b5860fab073e9a"/></dir><file name="Status.php" hash="d12f6f0cae84ff593e296aeaa8c1da0b"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="EditorderController.php" hash="44b3802cb3f5ddd363a4d92c1d7a4df9"/></dir><file name="IndexController.php" hash="74d20f383e4ce6fbd78b087f1c6318e9"/></dir><dir name="etc"><file name="config.xml" hash="1a1d59d9c278c92acdffdd05fd5137af"/></dir><dir name="sql"><dir name="editorder_setup"><file name="mysql4-install-0.1.0.php" hash="d639f02f96de3943512f901cae138f39"/></dir></dir></dir><dir name="Gallery"><dir name="Block"><dir name="Adminhtml"><dir name="Gallery"><dir name="Edit"><file name="Form.php" hash="b047a0629a42e3cfa3e5eeeac6a6c3d9"/><dir name="Tab"><file name="Form.php" hash="d4f9838af84fda33f03ea489030f7a57"/></dir><file name="Tabs.php" hash="b6438d98d47e5e4f572905f9886656c2"/></dir><file name="Edit.php" hash="7a74dd0d4a8c5a353878d2bd44d4327c"/><file name="Grid.php" hash="afe3be9f4f0fd71bd19dc25e7ac6d4c4"/></dir><file name="Gallery.php" hash="78f7fc7238a648725e89269ab1b1bc6b"/></dir><file name="Gallery.php" hash="7623e5a0dac8a8e8f40c825ce1bcd766"/></dir><dir name="Helper"><file name="Data.php" hash="6e19ac429a5976e5a6d7a68312d1aaf4"/></dir><dir name="Model"><file name="Gallery.php" hash="d393f48bd826e8072b452ed84ff50f91"/><dir name="Mysql4"><dir name="Gallery"><file name="Collection.php" hash="c761a1c1673411aafed6bbc63a91147b"/></dir><file name="Gallery.php" hash="adb807b4b4d196a81fca68eb1d88f2fb"/></dir><file name="Status.php" hash="61c9752a5e8aa3caa7b5f0068f9f8285"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="GalleryController.php" hash="92735e71c216f8ecdd0d2492f954b9eb"/></dir><file name="IndexController.php" hash="9ce7a896d4d640cbf836570a0cc725e3"/></dir><dir name="etc"><file name="config.xml" hash="45cdc67502af19cda3ad945cd8042fde"/></dir><dir name="sql"><dir name="gallery_setup"><file name="mysql4-install-0.1.0.php" hash="f48b3e51c84af8f0a2993f8d7f5c0376"/></dir></dir></dir><dir name="Orderreport"><dir name="Block"><dir name="Adminhtml"><dir name="Orderreport"><dir name="Edit"><file name="Form.php" hash="ad7fb2193e24cb2b00d79f95e8f862b1"/><dir name="Tab"><file name="Form.php" hash="8fff076d1311e04c67968f4deada4f9a"/></dir><file name="Tabs.php" hash="89c3573a7227d07dbad289cf346afaf2"/></dir><file name="Edit.php" hash="24549c44f5317a92a6e87a97ea794417"/><file name="Grid.php" hash="977323859c142cad8a3ad88d2b5ce10b"/></dir><file name="Orderreport.php" hash="d2cf373f60ec062e95ab5959d85e0ed4"/></dir><file name="Orderreport.php" hash="7c4cdfcfc5b95565962a92373b2aabb8"/></dir><dir name="Helper"><file name="Data.php" hash="4e8452b3ffe012843d74dd249a067a26"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Orderreport"><file name="Collection.php" hash="b43fa3bed466033794048c8497aa57a4"/></dir><file name="Orderreport.php" hash="28cd9015065f5500cafd4c5533c6fa73"/></dir><file name="Orderreport.php" hash="39f0e0d4fd81b0248f9197210457f7b6"/><file name="Status.php" hash="462163ddf8ab804d6f84ce29a7b1e37f"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="OrderreportController.php" hash="0a5146f0f4e8bb40861304117b8d3901"/></dir><file name="IndexController.php" hash="ce32c195b1ccb73f418a466fb522aa20"/></dir><dir name="etc"><file name="config.xml" hash="704c37dc7aec28f7bb9a4bdaf2ec37fa"/></dir><dir name="sql"><dir name="orderreport_setup"><file name="mysql4-install-0.1.0.php" hash="499386e75dab020c7ac3a64f7663ea60"/></dir></dir></dir><dir name="Press"><dir name="Block"><dir name="Adminhtml"><dir name="Press"><dir name="Edit"><file name="Form.php" hash="ad47e3678465d50289821385675bb424"/><dir name="Tab"><file name="Form.php" hash="781b74b982504a69faeab14ff8158211"/></dir><file name="Tabs.php" hash="300701aa9664a6a4a557461062d8c592"/></dir><file name="Edit.php" hash="087a1052a64e65f90c3591d6e8bce35f"/><file name="Grid.php" hash="d14e48135829dbdd78ac7959c34444d1"/></dir><file name="Press.php" hash="7b60f69eef219d73598ab8a1387dab4a"/></dir><file name="Press.php" hash="a0df115981f071134e4b2e25ec9c816d"/></dir><dir name="Helper"><file name="Data.php" hash="d3206f9858dc8b38f1cead355424b361"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Press"><file name="Collection.php" hash="45ed41bc770b567a0805a3832d330f72"/></dir><file name="Press.php" hash="f43c10890595ffe24021c01ed3f3f36c"/><dir name="Press_store"><file name="Collection.php" hash="fc7b18ada57014cbe6eac0e3e4ed2fcd"/></dir><file name="Press_store.php" hash="5ead548067fd284f025dbae8f7ebaccc"/></dir><file name="Press.php" hash="23b9e17959c7d8eb40b8d525143e49e6"/><file name="Press_store.php" hash="1c4efe49b22be2f2270d229d1c7d735b"/><file name="Status.php" hash="173892677cbabb5b13567b6e6212c347"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="PressController.php" hash="1a9b344f76adf5486e99f1849c6fa5e2"/></dir><file name="IndexController.php" hash="f7d118b34f1f9ddc89edad001bf41ed4"/></dir><dir name="etc"><file name="adminhtml.xml" hash="62055f196449f1f4cf4bad95a7ce50ee"/><file name="config.xml" hash="55c4a977df9941aedd0d86a73058c0f4"/><file name="system.xml" hash="d2f5dc4d658103737670be1b167c3fe4"/></dir><dir name="sql"><dir name="press_setup"><file name="mysql4-install-0.1.0.php" hash="03a8b75ad5be5dc23b4c8a78aeea5391"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="99ff1d565f180b13fd4a175948fc9b43"/><file name="mysql4-upgrade-0.1.1-0.1.2.php" hash="2398f20b3942f7a9efc9b32ebf724f30"/></dir></dir></dir><dir name="Promotionalbanner"><dir name="Block"><dir name="Adminhtml"><dir name="Promotionalbanner"><dir name="Edit"><file name="Form.php" hash="087963dfc7495abbefe500032e6c3771"/><dir name="Tab"><file name="Form.php" hash="49ebab4b78573f9b5c96d1cb7cad8945"/></dir><file name="Tabs.php" hash="571cf2c8f6ddda7cdf1bdfce7bee457c"/></dir><file name="Edit.php" hash="7e9ff48cdc9cd593c05d2bc166213d73"/><file name="Grid.php" hash="77d073401be533c47bfec4c356f0b884"/></dir><file name="Promotionalbanner.php" hash="bcbf5933fad7fec3305998c88624e16b"/></dir><file name="Promotionalbanner.php" hash="f3eaedcab4dca871cc4b97456293db39"/></dir><dir name="Helper"><file name="Data.php" hash="f1f00e13b228d274ae944c29776863dc"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Promotionalbanner"><file name="Collection.php" hash="9dca8e80de6ed28f6495a60704bcd757"/></dir><file name="Promotionalbanner.php" hash="ffbef4bfe3b0025d705d456588d64fa2"/></dir><file name="Promotionalbanner.php" hash="c807fa217d832065e03d17efa6571b54"/><file name="Status.php" hash="bfc65e8dc4d49c83849bcb23017d4300"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="PromotionalbannerController.php" hash="1bff57aada1c19624ea5e53a13a27b5d"/></dir><file name="IndexController.php" hash="5830cf818556b05010381b7404e77647"/></dir><dir name="etc"><file name="config.xml" hash="e8165609d6be83674a3d78741886379b"/></dir><dir name="sql"><dir name="promotionalbanner_setup"><file name="mysql4-install-0.1.0.php" hash="bb85cccff3468e73d21f287ce7250aa5"/></dir></dir></dir><dir name="Slider"><dir name="Block"><dir name="Adminhtml"><dir name="Slider"><dir name="Edit"><file name="Form.php" hash="ca930481c7735510714bc08f3ed54388"/><dir name="Tab"><file name="Form.php" hash="54e9c80c9066465a2bf8f69fc54769a2"/></dir><file name="Tabs.php" hash="0c3f7a0eac2017c80051e863962dedeb"/></dir><file name="Edit.php" hash="8a3a0fef10e2e61350a5b96d42919fc3"/><file name="Grid.php" hash="f514362d14115b3723e936728a856ce0"/></dir><file name="Slider.php" hash="d1c6599add8772e4b564fa24d0706742"/></dir><file name="Slider.php" hash="206931d8e27c6917f7a2644006780348"/></dir><dir name="Helper"><file name="Data.php" hash="1040dcdf8a42eed3e0010fed0d6128a3"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Slider"><file name="Collection.php" hash="2ae22e2c3320dd3a22c853d443cc914f"/></dir><file name="Slider.php" hash="f58a717ab3b4bd59ba605649129ca9d1"/></dir><file name="Slider.php" hash="0d75c8352f467422a324d68e4e8f1ccb"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="SliderController.php" hash="cea85ed88e7daefc237ba9554f78ec30"/></dir><file name="IndexController.php" hash="c1fc4c20c94f5c3076b1be1370add42a"/></dir><dir name="etc"><file name="adminhtml.xml" hash="a9040db3e6497a97fe64483d19ccbda1"/><file name="config.xml" hash="3d5e3e946ba1aec4c828363ab16c82b5"/><file name="system.xml" hash="0ce62b0e65d5096ddc8564169705cb92"/></dir><dir name="sql"><dir name="slider_setup"><file name="mysql4-install-0.1.0.php" hash="efd60f0f0fd9351c16c15aca41bdfb48"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="slider"><file name="slider.xml" hash="a110923b7eeb351204c9e43f6ca8e0dd"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><dir name="slider"><file name="slider.xml" hash="9651b1f4114b5f8ff1229886b4607fca"/></dir></dir><dir name="template"><dir name="slider"><file name="slider.phtml" hash="c9125cc1cfd169f42416eaac97d3013b"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Tatva_Slider.xml" hash="248fedac6d3c4175a2564765fde3b4a9"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><dir name="slider"><file name="slider.css" hash="dab445ad3a99959812c5af9d2865a780"/></dir></dir><dir name="images"><dir name="slider"><file name="Thumbs.db" hash="a4e466bbbb29524e0d89c23c19829437"/><file name="b_next.png" hash="d72dde0609aded61a24fa18cdca4bf7f"/><file name="b_prev.png" hash="86e333b7023d493e8024ccc6b32cd690"/><file name="bannerscrollbg.gif" hash="bd8c7ef3273a6219fd1bb56bc24cbf6d"/><file name="bluehbg.gif" hash="bdd4f53932bd952684d5d87a69c261c3"/><file name="carousel_next.png" hash="8a6d7719accc317e0dbd4a831677598c"/><file name="carousel_prev.png" hash="849d28e8873e8104c232348348c5e5b8"/><file name="content_bg.jpg" hash="e32654532856667842f9002208341e15"/><file name="next.png" hash="1b2ee17462251a2bd374a8a8a49d6ede"/><file name="next_arrow.png" hash="f395949692f96b812d41521dc8418e37"/><file name="num-act.png" hash="bead24653e91070840cec1153577ba24"/><file name="num.png" hash="4847ee03d68096c72339117db3ce981d"/><file name="prev.png" hash="e0b379b1a7db33c59cc90c4068b2ae3f"/><file name="prev_arrow.png" hash="3ba0da3255d4aac51f8bddf814abd480"/><file name="primopiano_menu.gif" hash="157cf32c6c9a103000441d1cf13768bf"/><file name="primopiano_menu2.gif" hash="2e08aa45e6ad2bd460832bf2c0c20069"/><file name="scroolbg.gif" hash="39d89710b27da072e63bbbdc474ab090"/></dir></dir><dir name="js"><dir name="slider"><file name="jquery-1.6.4.min.js" hash="fdcd59e694043785ddaebb2c688cfa64"/><file name="jquery.jcarousel.js" hash="c12b6393fdd5aa32fc572ce1594d4184"/></dir></dir></dir></dir></dir></target></contents>
|
20 |
<compatible/>
|
21 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
22 |
</package>
|