Version Notes
This module is now compatible with 1.9.x
Download this release
Release Info
| Developer | Tech Innovations |
| Extension | Ti_AdminComment |
| Version | 1.2.7 |
| Comparing to | |
| See all releases | |
Version 1.2.7
- app/code/community/Ti/AdminComment/Block/Adminhtml/Admincomment.php +27 -0
- app/code/community/Ti/AdminComment/Block/Adminhtml/Admincomment/Edit.php +53 -0
- app/code/community/Ti/AdminComment/Block/Adminhtml/Admincomment/Edit/Form.php +28 -0
- app/code/community/Ti/AdminComment/Block/Adminhtml/Admincomment/Edit/Tab/Form.php +67 -0
- app/code/community/Ti/AdminComment/Block/Adminhtml/Admincomment/Edit/Tabs.php +33 -0
- app/code/community/Ti/AdminComment/Block/Adminhtml/Admincomment/Grid.php +135 -0
- app/code/community/Ti/AdminComment/Block/Adminhtml/Admincomment/Grid/Renderer/Content.php +24 -0
- app/code/community/Ti/AdminComment/Block/Adminhtml/Order/Messages.php +43 -0
- app/code/community/Ti/AdminComment/Helper/Data.php +18 -0
- app/code/community/Ti/AdminComment/Model/Messages.php +19 -0
- app/code/community/Ti/AdminComment/Model/Mysql4/Messages.php +19 -0
- app/code/community/Ti/AdminComment/Model/Mysql4/Messages/Collection.php +50 -0
- app/code/community/Ti/AdminComment/Model/Observer.php +38 -0
- app/code/community/Ti/AdminComment/Model/Status.php +24 -0
- app/code/community/Ti/AdminComment/controllers/Adminhtml/AdmincommentController.php +227 -0
- app/code/community/Ti/AdminComment/etc/adminhtml.xml +38 -0
- app/code/community/Ti/AdminComment/etc/config.xml +99 -0
- app/code/community/Ti/AdminComment/etc/system.xml +41 -0
- app/code/community/Ti/AdminComment/sql/admincomment_setup/mysql4-install-1.0.0.php +33 -0
- app/code/community/Ti/AdminComment/sql/admincomment_setup/mysql4-upgrade-1.0.0-1.0.1.php +33 -0
- app/design/adminhtml/default/default/layout/ti/admincomment.xml +28 -0
- app/etc/modules/Ti_AdminComment.xml +9 -0
- js/ti/admincomment/order_messages.js +38 -0
- package.xml +18 -0
app/code/community/Ti/AdminComment/Block/Adminhtml/Admincomment.php
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Ti Admin Comment Module
|
| 5 |
+
*
|
| 6 |
+
* @category Ti
|
| 7 |
+
* @package Ti_AdminComment
|
| 8 |
+
* @copyright Copyright (c) 2014 Ti Technologies (http://www.titechnologies.in)
|
| 9 |
+
* @link http://www.titechnologies.in
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
class Ti_AdminComment_Block_Adminhtml_Admincomment extends Mage_Adminhtml_Block_Widget_Grid_Container
|
| 13 |
+
{
|
| 14 |
+
public function __construct()
|
| 15 |
+
{
|
| 16 |
+
$configValue = Mage::getStoreConfig('admincomment/admincomment_group/admincomment_enable');
|
| 17 |
+
if($configValue == 1) {
|
| 18 |
+
$this->_controller = 'adminhtml_admincomment';
|
| 19 |
+
$this->_blockGroup = 'admincomment';
|
| 20 |
+
$this->_headerText = Mage::helper('admincomment')->__('Pre-Defined Messages');
|
| 21 |
+
$this->_addButtonLabel = Mage::helper('admincomment')->__('Create New Message');
|
| 22 |
+
parent::__construct();
|
| 23 |
+
}else {
|
| 24 |
+
return parent::__construct();
|
| 25 |
+
}
|
| 26 |
+
}
|
| 27 |
+
}
|
app/code/community/Ti/AdminComment/Block/Adminhtml/Admincomment/Edit.php
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Ti Admin Comment Module
|
| 5 |
+
*
|
| 6 |
+
* @category Ti
|
| 7 |
+
* @package Ti_AdminComment
|
| 8 |
+
* @copyright Copyright (c) 2014 Ti Technologies (http://www.titechnologies.in)
|
| 9 |
+
* @link http://www.titechnologies.in
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
class Ti_AdminComment_Block_Adminhtml_Admincomment_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
| 13 |
+
{
|
| 14 |
+
public function __construct()
|
| 15 |
+
{
|
| 16 |
+
$configValue = Mage::getStoreConfig('admincomment/admincomment_group/admincomment_enable');
|
| 17 |
+
if($configValue == 1) {
|
| 18 |
+
parent::__construct();
|
| 19 |
+
|
| 20 |
+
$this->_objectId = 'id';
|
| 21 |
+
$this->_blockGroup = 'admincomment';
|
| 22 |
+
$this->_controller = 'adminhtml_admincomment';
|
| 23 |
+
|
| 24 |
+
$this->_updateButton('save', 'label', Mage::helper('admincomment')->__('Save Message'));
|
| 25 |
+
$this->_updateButton('delete', 'label', Mage::helper('admincomment')->__('Delete Message'));
|
| 26 |
+
|
| 27 |
+
$this->_addButton('saveandcontinue', array(
|
| 28 |
+
'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
|
| 29 |
+
'onclick' => 'saveAndContinueEdit()',
|
| 30 |
+
'class' => 'save',
|
| 31 |
+
), -100);
|
| 32 |
+
|
| 33 |
+
$this->_formScripts[] = "
|
| 34 |
+
function saveAndContinueEdit(){
|
| 35 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
| 36 |
+
}
|
| 37 |
+
";
|
| 38 |
+
}
|
| 39 |
+
else {
|
| 40 |
+
return parent::__construct();
|
| 41 |
+
}
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
public function getHeaderText()
|
| 45 |
+
{
|
| 46 |
+
if( Mage::registry('admincomment_data') && Mage::registry('admincomment_data')->getId() ) {
|
| 47 |
+
return Mage::helper('admincomment')->__("Edit Message '%s'", $this->htmlEscape(Mage::registry('admincomment_data')->getTitle()));
|
| 48 |
+
} else {
|
| 49 |
+
return Mage::helper('admincomment')->__('Create New Message');
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
}
|
| 53 |
+
}
|
app/code/community/Ti/AdminComment/Block/Adminhtml/Admincomment/Edit/Form.php
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Ti Admin Comment Module
|
| 5 |
+
*
|
| 6 |
+
* @category Ti
|
| 7 |
+
* @package Ti_AdminComment
|
| 8 |
+
* @copyright Copyright (c) 2014 Ti Technologies (http://www.titechnologies.in)
|
| 9 |
+
* @link http://www.titechnologies.in
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
class Ti_AdminComment_Block_Adminhtml_Admincomment_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
| 14 |
+
{
|
| 15 |
+
protected function _prepareForm()
|
| 16 |
+
{
|
| 17 |
+
$form = new Varien_Data_Form(array(
|
| 18 |
+
'id' => 'edit_form',
|
| 19 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
| 20 |
+
'method' => 'post'
|
| 21 |
+
)
|
| 22 |
+
);
|
| 23 |
+
|
| 24 |
+
$form->setUseContainer(true);
|
| 25 |
+
$this->setForm($form);
|
| 26 |
+
return parent::_prepareForm();
|
| 27 |
+
}
|
| 28 |
+
}
|
app/code/community/Ti/AdminComment/Block/Adminhtml/Admincomment/Edit/Tab/Form.php
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Ti Admin Comment Module
|
| 5 |
+
*
|
| 6 |
+
* @category Ti
|
| 7 |
+
* @package Ti_AdminComment
|
| 8 |
+
* @copyright Copyright (c) 2014 Ti Technologies (http://www.titechnologies.in)
|
| 9 |
+
* @link http://www.titechnologies.in
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
class Ti_AdminComment_Block_Adminhtml_Admincomment_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
|
| 13 |
+
{
|
| 14 |
+
protected function _prepareForm()
|
| 15 |
+
{
|
| 16 |
+
$form = new Varien_Data_Form();
|
| 17 |
+
$this->setForm($form);
|
| 18 |
+
$fieldset = $form->addFieldset('admincomment_form', array('legend'=>Mage::helper('admincomment')->__('Message information')));
|
| 19 |
+
|
| 20 |
+
$fieldset->addField('title', 'text', array(
|
| 21 |
+
'label' => Mage::helper('admincomment')->__('Title'),
|
| 22 |
+
'class' => 'required-entry',
|
| 23 |
+
'required' => true,
|
| 24 |
+
'name' => 'title',
|
| 25 |
+
));
|
| 26 |
+
|
| 27 |
+
$fieldset->addField('status', 'select', array(
|
| 28 |
+
'label' => Mage::helper('admincomment')->__('Status'),
|
| 29 |
+
'name' => 'status',
|
| 30 |
+
'values' => array(
|
| 31 |
+
array(
|
| 32 |
+
'value' => 1,
|
| 33 |
+
'label' => Mage::helper('admincomment')->__('Enabled'),
|
| 34 |
+
),
|
| 35 |
+
|
| 36 |
+
array(
|
| 37 |
+
'value' => 2,
|
| 38 |
+
'label' => Mage::helper('admincomment')->__('Disabled'),
|
| 39 |
+
),
|
| 40 |
+
),
|
| 41 |
+
));
|
| 42 |
+
|
| 43 |
+
$orderStatuses = Mage::getSingleton('sales/order_config')->getStatuses();
|
| 44 |
+
$fieldset->addField('order_status', 'select', array(
|
| 45 |
+
'label' => Mage::helper('admincomment')->__('Status'),
|
| 46 |
+
'name' => 'order_status',
|
| 47 |
+
'values' => $orderStatuses
|
| 48 |
+
));
|
| 49 |
+
|
| 50 |
+
$fieldset->addField('content', 'editor', array(
|
| 51 |
+
'name' => 'content',
|
| 52 |
+
'label' => Mage::helper('admincomment')->__('Message'),
|
| 53 |
+
'title' => Mage::helper('admincomment')->__('Message'),
|
| 54 |
+
'style' => 'width:700px; height:100px;',
|
| 55 |
+
'required' => true,
|
| 56 |
+
));
|
| 57 |
+
|
| 58 |
+
if (Mage::getSingleton('adminhtml/session')->getPrepopulateData()) {
|
| 59 |
+
$form->setValues(Mage::getSingleton('adminhtml/session')->getPrepopulateData());
|
| 60 |
+
Mage::getSingleton('adminhtml/session')->setPrepopulateData(null);
|
| 61 |
+
} elseif (Mage::registry('admincomment_data')) {
|
| 62 |
+
$form->setValues(Mage::registry('admincomment_data')->getData());
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
return parent::_prepareForm();
|
| 66 |
+
}
|
| 67 |
+
}
|
app/code/community/Ti/AdminComment/Block/Adminhtml/Admincomment/Edit/Tabs.php
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Ti Admin Comment Module
|
| 5 |
+
*
|
| 6 |
+
* @category Ti
|
| 7 |
+
* @package Ti_AdminComment
|
| 8 |
+
* @copyright Copyright (c) 2014 Ti Technologies (http://www.titechnologies.in)
|
| 9 |
+
* @link http://www.titechnologies.in
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
class Ti_AdminComment_Block_Adminhtml_Admincomment_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
| 14 |
+
{
|
| 15 |
+
public function __construct()
|
| 16 |
+
{
|
| 17 |
+
parent::__construct();
|
| 18 |
+
$this->setId('admincomment_tabs');
|
| 19 |
+
$this->setDestElementId('edit_form');
|
| 20 |
+
$this->setTitle(Mage::helper('admincomment')->__('Message'));
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
protected function _beforeToHtml()
|
| 24 |
+
{
|
| 25 |
+
$this->addTab('form_section', array(
|
| 26 |
+
'label' => Mage::helper('admincomment')->__('Message'),
|
| 27 |
+
'title' => Mage::helper('admincomment')->__('Message'),
|
| 28 |
+
'content' => $this->getLayout()->createBlock('admincomment/adminhtml_admincomment_edit_tab_form')->toHtml(),
|
| 29 |
+
));
|
| 30 |
+
|
| 31 |
+
return parent::_beforeToHtml();
|
| 32 |
+
}
|
| 33 |
+
}
|
app/code/community/Ti/AdminComment/Block/Adminhtml/Admincomment/Grid.php
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Ti Admin Comment Module
|
| 5 |
+
*
|
| 6 |
+
* @category Ti
|
| 7 |
+
* @package Ti_AdminComment
|
| 8 |
+
* @copyright Copyright (c) 2014 Ti Technologies (http://www.titechnologies.in)
|
| 9 |
+
* @link http://www.titechnologies.in
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
class Ti_AdminComment_Block_Adminhtml_Admincomment_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
| 13 |
+
{
|
| 14 |
+
public function __construct()
|
| 15 |
+
{
|
| 16 |
+
parent::__construct();
|
| 17 |
+
$this->setId('admincommentGrid');
|
| 18 |
+
$this->setDefaultSort('message_id');
|
| 19 |
+
$this->setDefaultDir('ASC');
|
| 20 |
+
$this->setUseAjax(true);
|
| 21 |
+
$this->setSaveParametersInSession(true);
|
| 22 |
+
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
protected function _prepareCollection()
|
| 26 |
+
{
|
| 27 |
+
$collection = Mage::getModel('admincomment/messages')->getCollection();
|
| 28 |
+
$this->setCollection($collection);
|
| 29 |
+
return parent::_prepareCollection();
|
| 30 |
+
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
protected function _prepareColumns()
|
| 34 |
+
{
|
| 35 |
+
|
| 36 |
+
$this->addColumn('message_id', array(
|
| 37 |
+
'header' => Mage::helper('admincomment')->__('ID'),
|
| 38 |
+
'align' =>'right',
|
| 39 |
+
'width' => '50px',
|
| 40 |
+
'index' => 'message_id',
|
| 41 |
+
));
|
| 42 |
+
|
| 43 |
+
$this->addColumn('title', array(
|
| 44 |
+
'header' => Mage::helper('admincomment')->__('Title'),
|
| 45 |
+
'align' =>'left',
|
| 46 |
+
'width' => '150px',
|
| 47 |
+
'index' => 'title',
|
| 48 |
+
));
|
| 49 |
+
|
| 50 |
+
$this->addColumn('content', array(
|
| 51 |
+
'header' => Mage::helper('admincomment')->__('Message'),
|
| 52 |
+
'index' => 'content',
|
| 53 |
+
'renderer' => 'admincomment/adminhtml_admincomment_grid_renderer_content'
|
| 54 |
+
));
|
| 55 |
+
|
| 56 |
+
$this->addColumn('order_status', array(
|
| 57 |
+
'header' => Mage::helper('admincomment')->__('Order Status'),
|
| 58 |
+
'width' => '150px',
|
| 59 |
+
'index' => 'order_status',
|
| 60 |
+
'type' => 'options',
|
| 61 |
+
'options' => Mage::getSingleton('sales/order_config')->getStatuses()
|
| 62 |
+
));
|
| 63 |
+
|
| 64 |
+
$this->addColumn('status', array(
|
| 65 |
+
'header' => Mage::helper('admincomment')->__('Status'),
|
| 66 |
+
'align' => 'left',
|
| 67 |
+
'width' => '80px',
|
| 68 |
+
'index' => 'status',
|
| 69 |
+
'type' => 'options',
|
| 70 |
+
'options' => array(
|
| 71 |
+
1 => 'Enabled',
|
| 72 |
+
2 => 'Disabled',
|
| 73 |
+
),
|
| 74 |
+
));
|
| 75 |
+
|
| 76 |
+
$this->addColumn('action',
|
| 77 |
+
array(
|
| 78 |
+
'header' => Mage::helper('admincomment')->__('Action'),
|
| 79 |
+
'width' => '100',
|
| 80 |
+
'type' => 'action',
|
| 81 |
+
'getter' => 'getId',
|
| 82 |
+
'actions' => array(
|
| 83 |
+
array(
|
| 84 |
+
'caption' => Mage::helper('admincomment')->__('Edit'),
|
| 85 |
+
'url' => array('base'=> '*/*/edit'),
|
| 86 |
+
'field' => 'id'
|
| 87 |
+
)
|
| 88 |
+
),
|
| 89 |
+
'filter' => false,
|
| 90 |
+
'sortable' => false,
|
| 91 |
+
'index' => 'stores',
|
| 92 |
+
'is_system' => true,
|
| 93 |
+
));
|
| 94 |
+
|
| 95 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('admincomment')->__('CSV'));
|
| 96 |
+
$this->addExportType('*/*/exportXml', Mage::helper('admincomment')->__('XML'));
|
| 97 |
+
|
| 98 |
+
return parent::_prepareColumns();
|
| 99 |
+
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
protected function _prepareMassaction()
|
| 103 |
+
{
|
| 104 |
+
$this->setMassactionIdField('message_id');
|
| 105 |
+
$this->getMassactionBlock()->setFormFieldName('admincomment');
|
| 106 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
| 107 |
+
'label' => Mage::helper('admincomment')->__('Delete'),
|
| 108 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
| 109 |
+
'confirm' => Mage::helper('admincomment')->__('Are you sure?')
|
| 110 |
+
));
|
| 111 |
+
|
| 112 |
+
$statuses = Mage::getSingleton('admincomment/status')->getOptionArray();
|
| 113 |
+
|
| 114 |
+
array_unshift($statuses, array('label'=>'', 'value'=>''));
|
| 115 |
+
$this->getMassactionBlock()->addItem('status', array(
|
| 116 |
+
'label'=> Mage::helper('admincomment')->__('Change status'),
|
| 117 |
+
'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
|
| 118 |
+
'additional' => array(
|
| 119 |
+
'visibility' => array(
|
| 120 |
+
'name' => 'status',
|
| 121 |
+
'type' => 'select',
|
| 122 |
+
'class' => 'required-entry',
|
| 123 |
+
'label' => Mage::helper('admincomment')->__('Status'),
|
| 124 |
+
'values' => $statuses
|
| 125 |
+
)
|
| 126 |
+
)
|
| 127 |
+
));
|
| 128 |
+
return $this;
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
public function getRowUrl($row)
|
| 132 |
+
{
|
| 133 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
| 134 |
+
}
|
| 135 |
+
}
|
app/code/community/Ti/AdminComment/Block/Adminhtml/Admincomment/Grid/Renderer/Content.php
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Ti Admin Comment Module
|
| 5 |
+
*
|
| 6 |
+
* @category Ti
|
| 7 |
+
* @package Ti_AdminComment
|
| 8 |
+
* @copyright Copyright (c) 2014 Ti Technologies (http://www.titechnologies.in)
|
| 9 |
+
* @link http://www.titechnologies.in
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
class Ti_AdminComment_Block_Adminhtml_Admincomment_Grid_Renderer_Content extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
| 13 |
+
{
|
| 14 |
+
public function render(Varien_Object $row)
|
| 15 |
+
{
|
| 16 |
+
$content = $row->getContent();
|
| 17 |
+
|
| 18 |
+
if (strlen($content) > 200) {
|
| 19 |
+
$content = substr($content, 0, 200) . ' ... ';
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
return $content;
|
| 23 |
+
}
|
| 24 |
+
}
|
app/code/community/Ti/AdminComment/Block/Adminhtml/Order/Messages.php
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Ti Admin Comment Module
|
| 5 |
+
*
|
| 6 |
+
* @category Ti
|
| 7 |
+
* @package Ti_AdminComment
|
| 8 |
+
* @copyright Copyright (c) 2014 Ti Technologies (http://www.titechnologies.in)
|
| 9 |
+
* @link http://www.titechnologies.in
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
class Ti_AdminComment_Block_Adminhtml_Order_Messages extends Mage_Adminhtml_Block_Template
|
| 13 |
+
{
|
| 14 |
+
private $_passedTransportHtml;
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* Get admin defined messages
|
| 18 |
+
*
|
| 19 |
+
* @return <select>
|
| 20 |
+
*/
|
| 21 |
+
public function getMessages()
|
| 22 |
+
{
|
| 23 |
+
$select = $this->getLayout()->createBlock('adminhtml/html_select')
|
| 24 |
+
->setData(array(
|
| 25 |
+
'id' => 'admincomment_messages_dropdown',
|
| 26 |
+
'class' => 'select'
|
| 27 |
+
))
|
| 28 |
+
->setName('admincomment_messages_dropdown')
|
| 29 |
+
->setOptions(Mage::getResourceModel('admincomment/messages_collection')->toOptionArray());
|
| 30 |
+
|
| 31 |
+
return $select->getHtml();
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
public function setPassingTransport($transport)
|
| 35 |
+
{
|
| 36 |
+
$this->_passedTransportHtml = $transport;
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
public function getPassedTransport()
|
| 40 |
+
{
|
| 41 |
+
return $this->_passedTransportHtml;
|
| 42 |
+
}
|
| 43 |
+
}
|
app/code/community/Ti/AdminComment/Helper/Data.php
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Ti Admin Comment Module
|
| 5 |
+
*
|
| 6 |
+
* @category Ti
|
| 7 |
+
* @package Ti_AdminComment
|
| 8 |
+
* @copyright Copyright (c) 2014 Ti Technologies (http://www.titechnologies.in)
|
| 9 |
+
* @link http://www.titechnologies.in
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
class Ti_AdminComment_Helper_Data extends Mage_Adminhtml_Helper_Data
|
| 13 |
+
{
|
| 14 |
+
public function getPrePopulateMessagesUrl()
|
| 15 |
+
{
|
| 16 |
+
return $this->getUrl('admincomment/adminhtml_admincomment/getMessages');
|
| 17 |
+
}
|
| 18 |
+
}
|
app/code/community/Ti/AdminComment/Model/Messages.php
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Ti Admin Comment Module
|
| 5 |
+
*
|
| 6 |
+
* @category Ti
|
| 7 |
+
* @package Ti_AdminComment
|
| 8 |
+
* @copyright Copyright (c) 2014 Ti Technologies (http://www.titechnologies.in)
|
| 9 |
+
* @link http://www.titechnologies.in
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
class Ti_AdminComment_Model_Messages extends Mage_Core_Model_Abstract
|
| 13 |
+
{
|
| 14 |
+
public function _construct()
|
| 15 |
+
{
|
| 16 |
+
parent::_construct();
|
| 17 |
+
$this->_init('admincomment/messages');
|
| 18 |
+
}
|
| 19 |
+
}
|
app/code/community/Ti/AdminComment/Model/Mysql4/Messages.php
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Ti Admin Comment Module
|
| 5 |
+
*
|
| 6 |
+
* @category Ti
|
| 7 |
+
* @package Ti_AdminComment
|
| 8 |
+
* @copyright Copyright (c) 2014 Ti Technologies (http://www.titechnologies.in)
|
| 9 |
+
* @link http://www.titechnologies.in
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
class Ti_AdminComment_Model_Mysql4_Messages extends Mage_Core_Model_Mysql4_Abstract
|
| 13 |
+
{
|
| 14 |
+
public function _construct()
|
| 15 |
+
{
|
| 16 |
+
// Note that the message_id refers to the key field in your database table.
|
| 17 |
+
$this->_init('admincomment/messages', 'message_id');
|
| 18 |
+
}
|
| 19 |
+
}
|
app/code/community/Ti/AdminComment/Model/Mysql4/Messages/Collection.php
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Ti Admin Comment Module
|
| 5 |
+
*
|
| 6 |
+
* @category Ti
|
| 7 |
+
* @package Ti_AdminComment
|
| 8 |
+
* @copyright Copyright (c) 2014 Ti Technologies (http://www.titechnologies.in)
|
| 9 |
+
* @link http://www.titechnologies.in
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
class Ti_AdminComment_Model_Mysql4_Messages_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
| 13 |
+
{
|
| 14 |
+
public function _construct()
|
| 15 |
+
{
|
| 16 |
+
parent::_construct();
|
| 17 |
+
$this->_init('admincomment/messages');
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
public function toOptionArray()
|
| 21 |
+
{
|
| 22 |
+
$orderStatusesMessages = array(
|
| 23 |
+
array('value' => '', 'label' => Mage::helper('adminhtml')->__('-- Please select --'))
|
| 24 |
+
);
|
| 25 |
+
|
| 26 |
+
$messagesCollection = $this->addFieldToFilter('status', 1);
|
| 27 |
+
$orderStatuses = Mage::getSingleton('sales/order_config')->getStatuses();
|
| 28 |
+
|
| 29 |
+
foreach ($orderStatuses as $statusCode => $statusLabel) {
|
| 30 |
+
$messages = array();
|
| 31 |
+
$statusMessages = $messagesCollection->getItemsByColumnValue('order_status', $statusCode);
|
| 32 |
+
|
| 33 |
+
if (sizeof($statusMessages)) {
|
| 34 |
+
foreach ($statusMessages as $message) {
|
| 35 |
+
$messages[] = array(
|
| 36 |
+
'label' => $message->getTitle(),
|
| 37 |
+
'value' => $message->getContent()
|
| 38 |
+
);
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
$orderStatusesMessages[] = array(
|
| 42 |
+
'label' => $statusLabel,
|
| 43 |
+
'value' => $messages
|
| 44 |
+
);
|
| 45 |
+
}
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
return $orderStatusesMessages;
|
| 49 |
+
}
|
| 50 |
+
}
|
app/code/community/Ti/AdminComment/Model/Observer.php
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Ti Admin Comment Module
|
| 5 |
+
*
|
| 6 |
+
* @category Ti
|
| 7 |
+
* @package Ti_AdminComment
|
| 8 |
+
* @copyright Copyright (c) 2014 Ti Technologies (http://www.titechnologies.in)
|
| 9 |
+
* @link http://www.titechnologies.in
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
class Ti_AdminComment_Model_Observer
|
| 13 |
+
{
|
| 14 |
+
const MODULE_NAME = 'Ti_AdminComment';
|
| 15 |
+
|
| 16 |
+
public function addUpdateOrderCommentsBlock($observer = null)
|
| 17 |
+
{
|
| 18 |
+
if (!$observer) {
|
| 19 |
+
return;
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
if ('order_history' == $observer->getEvent()->getBlock()->getNameInLayout()) {
|
| 23 |
+
if (!Mage::getStoreConfig('advanced/modules_disable_output/' . self::MODULE_NAME)) {
|
| 24 |
+
$transport = $observer->getEvent()->getTransport();
|
| 25 |
+
|
| 26 |
+
$block = Mage::app()->getLayout()
|
| 27 |
+
->createBlock('admincomment/adminhtml_order_messages');
|
| 28 |
+
$block->setPassingTransport($transport['html']);
|
| 29 |
+
$block->setTemplate('admincomment/order/messages.phtml')
|
| 30 |
+
->toHtml();
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
}
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
return $this;
|
| 37 |
+
}
|
| 38 |
+
}
|
app/code/community/Ti/AdminComment/Model/Status.php
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Ti Admin Comment Module
|
| 5 |
+
*
|
| 6 |
+
* @category Ti
|
| 7 |
+
* @package Ti_AdminComment
|
| 8 |
+
* @copyright Copyright (c) 2014 Ti Technologies (http://www.titechnologies.in)
|
| 9 |
+
* @link http://www.titechnologies.in
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
class Ti_AdminComment_Model_Status extends Varien_Object
|
| 13 |
+
{
|
| 14 |
+
const STATUS_ENABLED = 1;
|
| 15 |
+
const STATUS_DISABLED = 2;
|
| 16 |
+
|
| 17 |
+
static public function getOptionArray()
|
| 18 |
+
{
|
| 19 |
+
return array(
|
| 20 |
+
self::STATUS_ENABLED => Mage::helper('admincomment')->__('Enabled'),
|
| 21 |
+
self::STATUS_DISABLED => Mage::helper('admincomment')->__('Disabled')
|
| 22 |
+
);
|
| 23 |
+
}
|
| 24 |
+
}
|
app/code/community/Ti/AdminComment/controllers/Adminhtml/AdmincommentController.php
ADDED
|
@@ -0,0 +1,227 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Ti Admin Comment Module
|
| 5 |
+
*
|
| 6 |
+
* @category Ti
|
| 7 |
+
* @package Ti_AdminComment
|
| 8 |
+
* @copyright Copyright (c) 2014 Ti Technologies (http://www.titechnologies.in)
|
| 9 |
+
* @link http://www.titechnologies.in
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
class Ti_AdminComment_Adminhtml_AdmincommentController extends Mage_Adminhtml_Controller_action
|
| 13 |
+
{
|
| 14 |
+
|
| 15 |
+
protected function _initAction()
|
| 16 |
+
{
|
| 17 |
+
$this->loadLayout()
|
| 18 |
+
->_setActiveMenu('sales/admincomment')
|
| 19 |
+
->_addBreadcrumb(Mage::helper('adminhtml')->__('Manage Pre-Defined Messages'), Mage::helper('adminhtml')->__('Manage Pre-Defined Message'));
|
| 20 |
+
|
| 21 |
+
return $this;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
public function indexAction()
|
| 25 |
+
{
|
| 26 |
+
if ($this->getRequest()->getQuery('ajax')) {
|
| 27 |
+
$this->_forward('grid');
|
| 28 |
+
return;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
$this->_title($this->__('Pre-Defined Messages'))->_title($this->__('Manage Messages'));
|
| 32 |
+
$this->_initAction()
|
| 33 |
+
->renderLayout();
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
public function gridAction()
|
| 37 |
+
{
|
| 38 |
+
$this->loadLayout();
|
| 39 |
+
$this->getResponse()->setBody($this->getLayout()->createBlock('admincomment/adminhtml_admincomment_grid')->toHtml());
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
public function editAction()
|
| 43 |
+
{
|
| 44 |
+
$this->_title($this->__('Pre-Defined Messages'))->_title($this->__('Manage Message'));
|
| 45 |
+
$id = $this->getRequest()->getParam('id');
|
| 46 |
+
$model = Mage::getModel('admincomment/messages')->load($id);
|
| 47 |
+
|
| 48 |
+
if ($model->getId() || $id == 0) {
|
| 49 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
| 50 |
+
if (!empty($data)) {
|
| 51 |
+
$model->setData($data);
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
Mage::register('admincomment_data', $model);
|
| 55 |
+
|
| 56 |
+
$this->loadLayout();
|
| 57 |
+
$this->_setActiveMenu('sales/admincomment');
|
| 58 |
+
|
| 59 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Manage Pre-Defined Message'), Mage::helper('adminhtml')->__('Manage Pre-Defined Message'));
|
| 60 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Pre-Defined Message'), Mage::helper('adminhtml')->__('Pre-Defined Message'));
|
| 61 |
+
|
| 62 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
| 63 |
+
|
| 64 |
+
$this->_addContent($this->getLayout()->createBlock('admincomment/adminhtml_admincomment_edit'))
|
| 65 |
+
->_addLeft($this->getLayout()->createBlock('admincomment/adminhtml_admincomment_edit_tabs'));
|
| 66 |
+
|
| 67 |
+
$this->renderLayout();
|
| 68 |
+
} else {
|
| 69 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('admincomment')->__('Message does not exist'));
|
| 70 |
+
$this->_redirect('*/*/');
|
| 71 |
+
}
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
public function getMessagesAction()
|
| 75 |
+
{
|
| 76 |
+
$layout = $this->getLayout();
|
| 77 |
+
$update = $layout->getUpdate();
|
| 78 |
+
$update->load('admincomment_messages_dropdown');
|
| 79 |
+
$layout->generateXml();
|
| 80 |
+
$layout->generateBlocks();
|
| 81 |
+
$output = $layout->getOutput();
|
| 82 |
+
|
| 83 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array('dropdown' => $output)));
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
public function newAction()
|
| 87 |
+
{
|
| 88 |
+
$this->_forward('edit');
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
public function saveAction()
|
| 92 |
+
{
|
| 93 |
+
if ($data = $this->getRequest()->getPost()) {
|
| 94 |
+
$model = Mage::getModel('admincomment/messages');
|
| 95 |
+
$model->setData($data)
|
| 96 |
+
->setId($this->getRequest()->getParam('id'));
|
| 97 |
+
|
| 98 |
+
try {
|
| 99 |
+
if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
|
| 100 |
+
$model->setCreatedTime(now())
|
| 101 |
+
->setUpdateTime(now());
|
| 102 |
+
} else {
|
| 103 |
+
$model->setUpdateTime(now());
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
$model->save();
|
| 107 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('admincomment')->__('Message was successfully saved'));
|
| 108 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
| 109 |
+
|
| 110 |
+
if ($this->getRequest()->getParam('back')) {
|
| 111 |
+
$this->_redirect('*/*/edit', array('id' => $model->getId()));
|
| 112 |
+
return;
|
| 113 |
+
}
|
| 114 |
+
$this->_redirect('*/*/');
|
| 115 |
+
return;
|
| 116 |
+
} catch (Exception $e) {
|
| 117 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 118 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
| 119 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
| 120 |
+
return;
|
| 121 |
+
}
|
| 122 |
+
}
|
| 123 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('admincomment')->__('Unable to find Message to save'));
|
| 124 |
+
$this->_redirect('*/*/');
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
public function deleteAction()
|
| 128 |
+
{
|
| 129 |
+
if ($this->getRequest()->getParam('id') > 0) {
|
| 130 |
+
try {
|
| 131 |
+
$model = Mage::getModel('admincomment/messages');
|
| 132 |
+
|
| 133 |
+
$model->setId($this->getRequest()->getParam('id'))
|
| 134 |
+
->delete();
|
| 135 |
+
|
| 136 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Message was successfully deleted'));
|
| 137 |
+
$this->_redirect('*/*/');
|
| 138 |
+
} catch (Exception $e) {
|
| 139 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 140 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
| 141 |
+
}
|
| 142 |
+
}
|
| 143 |
+
$this->_redirect('*/*/');
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
public function massDeleteAction()
|
| 147 |
+
{
|
| 148 |
+
$prepopulateIds = $this->getRequest()->getParam('admincomment');
|
| 149 |
+
if (!is_array($prepopulateIds)) {
|
| 150 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select Message(s)'));
|
| 151 |
+
} else {
|
| 152 |
+
try {
|
| 153 |
+
foreach ($prepopulateIds as $prepopulateId) {
|
| 154 |
+
$prepopulate = Mage::getModel('admincomment/messages')->load($prepopulateId);
|
| 155 |
+
$prepopulate->delete();
|
| 156 |
+
}
|
| 157 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
| 158 |
+
Mage::helper('adminhtml')->__(
|
| 159 |
+
'Total of %d record(s) were successfully deleted', count($prepopulateIds)
|
| 160 |
+
)
|
| 161 |
+
);
|
| 162 |
+
} catch (Exception $e) {
|
| 163 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 164 |
+
}
|
| 165 |
+
}
|
| 166 |
+
$this->_redirect('*/*/index');
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
public function massStatusAction()
|
| 170 |
+
{
|
| 171 |
+
$prepopulateIds = $this->getRequest()->getParam('admincomment');
|
| 172 |
+
if (!is_array($prepopulateIds)) {
|
| 173 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Please select Message(s)'));
|
| 174 |
+
} else {
|
| 175 |
+
try {
|
| 176 |
+
foreach ($prepopulateIds as $prepopulateId) {
|
| 177 |
+
$prepopulate = Mage::getSingleton('admincomment/messages')
|
| 178 |
+
->load($prepopulateId)
|
| 179 |
+
->setStatus($this->getRequest()->getParam('status'))
|
| 180 |
+
->setIsMassupdate(true)
|
| 181 |
+
->save();
|
| 182 |
+
}
|
| 183 |
+
$this->_getSession()->addSuccess(
|
| 184 |
+
$this->__('Total of %d record(s) were successfully updated', count($prepopulateIds))
|
| 185 |
+
);
|
| 186 |
+
} catch (Exception $e) {
|
| 187 |
+
$this->_getSession()->addError($e->getMessage());
|
| 188 |
+
}
|
| 189 |
+
}
|
| 190 |
+
$this->_redirect('*/*/index');
|
| 191 |
+
}
|
| 192 |
+
|
| 193 |
+
public function exportCsvAction()
|
| 194 |
+
{
|
| 195 |
+
$fileName = 'predefined_messages.csv';
|
| 196 |
+
$content = $this->getLayout()->createBlock('admincomment/adminhtml_admincomment_grid')
|
| 197 |
+
->getCsv();
|
| 198 |
+
|
| 199 |
+
$this->_sendUploadResponse($fileName, $content);
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
public function exportXmlAction()
|
| 203 |
+
{
|
| 204 |
+
$fileName = 'predefined_messages.xml';
|
| 205 |
+
$content = $this->getLayout()->createBlock('admincomment/adminhtml_admincomment_grid')
|
| 206 |
+
->getXml();
|
| 207 |
+
|
| 208 |
+
$this->_sendUploadResponse($fileName, $content);
|
| 209 |
+
}
|
| 210 |
+
|
| 211 |
+
protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
|
| 212 |
+
{
|
| 213 |
+
$response = $this->getResponse();
|
| 214 |
+
$response->setHeader('HTTP/1.1 200 OK', '');
|
| 215 |
+
$response->setHeader('Pragma', 'public', true);
|
| 216 |
+
$response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
|
| 217 |
+
$response->setHeader('Content-Disposition', 'attachment; filename=' . $fileName);
|
| 218 |
+
$response->setHeader('Last-Modified', date('r'));
|
| 219 |
+
$response->setHeader('Accept-Ranges', 'bytes');
|
| 220 |
+
$response->setHeader('Content-Length', strlen($content));
|
| 221 |
+
$response->setHeader('Content-type', $contentType);
|
| 222 |
+
$response->setBody($content);
|
| 223 |
+
$response->sendResponse();
|
| 224 |
+
die;
|
| 225 |
+
}
|
| 226 |
+
|
| 227 |
+
}
|
app/code/community/Ti/AdminComment/etc/adminhtml.xml
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<config>
|
| 3 |
+
<menu>
|
| 4 |
+
<cms>
|
| 5 |
+
<children>
|
| 6 |
+
<items module="admincomment" translate="title">
|
| 7 |
+
<title>Admin Order Comments</title>
|
| 8 |
+
<sort_order>500</sort_order>
|
| 9 |
+
<action>admincomment/adminhtml_admincomment</action>
|
| 10 |
+
<depends>
|
| 11 |
+
<config>admincomment/admincomment_group/admincomment_enable</config>
|
| 12 |
+
</depends>
|
| 13 |
+
</items>
|
| 14 |
+
</children>
|
| 15 |
+
</cms>
|
| 16 |
+
</menu>
|
| 17 |
+
|
| 18 |
+
<acl>
|
| 19 |
+
<resources>
|
| 20 |
+
<admin>
|
| 21 |
+
<children>
|
| 22 |
+
<system>
|
| 23 |
+
<children>
|
| 24 |
+
<config>
|
| 25 |
+
<children>
|
| 26 |
+
<admincomment translate="title" module="ti_admincomment">
|
| 27 |
+
<title>Admin Order Comments Settings</title>
|
| 28 |
+
</admincomment>
|
| 29 |
+
</children>
|
| 30 |
+
</config>
|
| 31 |
+
</children>
|
| 32 |
+
</system>
|
| 33 |
+
</children>
|
| 34 |
+
</admin>
|
| 35 |
+
</resources>
|
| 36 |
+
</acl>
|
| 37 |
+
|
| 38 |
+
</config>
|
app/code/community/Ti/AdminComment/etc/config.xml
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Ti_AdminComment>
|
| 5 |
+
<version>1.2.7</version>
|
| 6 |
+
</Ti_AdminComment>
|
| 7 |
+
</modules>
|
| 8 |
+
|
| 9 |
+
<admin>
|
| 10 |
+
<routers>
|
| 11 |
+
<admincomment>
|
| 12 |
+
<use>admin</use>
|
| 13 |
+
<args>
|
| 14 |
+
<module>Ti_AdminComment</module>
|
| 15 |
+
<frontName>admincomment</frontName>
|
| 16 |
+
</args>
|
| 17 |
+
</admincomment>
|
| 18 |
+
</routers>
|
| 19 |
+
</admin>
|
| 20 |
+
|
| 21 |
+
<adminhtml>
|
| 22 |
+
<layout>
|
| 23 |
+
<updates>
|
| 24 |
+
<admincomment>
|
| 25 |
+
<file>ti/admincomment.xml</file>
|
| 26 |
+
</admincomment>
|
| 27 |
+
</updates>
|
| 28 |
+
</layout>
|
| 29 |
+
|
| 30 |
+
<events>
|
| 31 |
+
<core_block_abstract_to_html_after>
|
| 32 |
+
<observers>
|
| 33 |
+
<add_messages_dropdown_to_comment_area>
|
| 34 |
+
<type>singleton</type>
|
| 35 |
+
<class>admincomment/observer</class>
|
| 36 |
+
<method>addUpdateOrderCommentsBlock</method>
|
| 37 |
+
</add_messages_dropdown_to_comment_area>
|
| 38 |
+
</observers>
|
| 39 |
+
</core_block_abstract_to_html_after>
|
| 40 |
+
</events>
|
| 41 |
+
</adminhtml>
|
| 42 |
+
|
| 43 |
+
<global>
|
| 44 |
+
<models>
|
| 45 |
+
<admincomment>
|
| 46 |
+
<class>Ti_AdminComment_Model</class>
|
| 47 |
+
<resourceModel>admincomment_mysql4</resourceModel>
|
| 48 |
+
</admincomment>
|
| 49 |
+
<admincomment_mysql4>
|
| 50 |
+
<class>Ti_AdminComment_Model_Mysql4</class>
|
| 51 |
+
<entities>
|
| 52 |
+
<messages>
|
| 53 |
+
<table>messages</table>
|
| 54 |
+
</messages>
|
| 55 |
+
</entities>
|
| 56 |
+
</admincomment_mysql4>
|
| 57 |
+
</models>
|
| 58 |
+
|
| 59 |
+
<resources>
|
| 60 |
+
<admincomment_setup>
|
| 61 |
+
<setup>
|
| 62 |
+
<module>Ti_AdminComment</module>
|
| 63 |
+
</setup>
|
| 64 |
+
<connection>
|
| 65 |
+
<use>core_setup</use>
|
| 66 |
+
</connection>
|
| 67 |
+
</admincomment_setup>
|
| 68 |
+
<admincomment_write>
|
| 69 |
+
<connection>
|
| 70 |
+
<use>core_write</use>
|
| 71 |
+
</connection>
|
| 72 |
+
</admincomment_write>
|
| 73 |
+
<admincomment_read>
|
| 74 |
+
<connection>
|
| 75 |
+
<use>core_read</use>
|
| 76 |
+
</connection>
|
| 77 |
+
</admincomment_read>
|
| 78 |
+
</resources>
|
| 79 |
+
|
| 80 |
+
<blocks>
|
| 81 |
+
<admincomment>
|
| 82 |
+
<class>Ti_AdminComment_Block</class>
|
| 83 |
+
</admincomment>
|
| 84 |
+
</blocks>
|
| 85 |
+
|
| 86 |
+
<helpers>
|
| 87 |
+
<admincomment>
|
| 88 |
+
<class>Ti_AdminComment_Helper</class>
|
| 89 |
+
</admincomment>
|
| 90 |
+
</helpers>
|
| 91 |
+
</global>
|
| 92 |
+
<default>
|
| 93 |
+
<admincomment>
|
| 94 |
+
<admincomment_group>
|
| 95 |
+
<admincomment_enable>1</admincomment_enable>
|
| 96 |
+
</admincomment_group>
|
| 97 |
+
</admincomment>
|
| 98 |
+
</default>
|
| 99 |
+
</config>
|
app/code/community/Ti/AdminComment/etc/system.xml
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<config>
|
| 3 |
+
<tabs>
|
| 4 |
+
<ti translate="label" module="admincomment">
|
| 5 |
+
<label>Ti</label>
|
| 6 |
+
<sort_order>110</sort_order>
|
| 7 |
+
</ti>
|
| 8 |
+
</tabs>
|
| 9 |
+
<sections>
|
| 10 |
+
<admincomment translate="label" module="admincomment">
|
| 11 |
+
<label>Admin Order Comments</label>
|
| 12 |
+
<tab>ti</tab>
|
| 13 |
+
<sort_order>1055</sort_order>
|
| 14 |
+
<show_in_default>1</show_in_default>
|
| 15 |
+
<show_in_website>1</show_in_website>
|
| 16 |
+
<show_in_store>1</show_in_store>
|
| 17 |
+
<groups>
|
| 18 |
+
<admincomment_group translate="label" module="admincomment">
|
| 19 |
+
<label>Admin Order Comments Module Settings</label>
|
| 20 |
+
<frontend_type>text</frontend_type>
|
| 21 |
+
<sort_order>1010</sort_order>
|
| 22 |
+
<show_in_default>1</show_in_default>
|
| 23 |
+
<show_in_website>1</show_in_website>
|
| 24 |
+
<show_in_store>1</show_in_store>
|
| 25 |
+
<fields>
|
| 26 |
+
<admincomment_enable translate="label">
|
| 27 |
+
<label>Enable Admin Comment Module</label>
|
| 28 |
+
<comment>If selected 'yes' then admin can add pre-defined messages to customer orders. Messages can be managed from 'Cms-> Admin Order Comments' menu</comment>
|
| 29 |
+
<frontend_type>select</frontend_type>
|
| 30 |
+
<sort_order>90</sort_order>
|
| 31 |
+
<show_in_default>1</show_in_default>
|
| 32 |
+
<show_in_website>1</show_in_website>
|
| 33 |
+
<show_in_store>1</show_in_store>
|
| 34 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 35 |
+
</admincomment_enable>
|
| 36 |
+
</fields>
|
| 37 |
+
</admincomment_group>
|
| 38 |
+
</groups>
|
| 39 |
+
</admincomment>
|
| 40 |
+
</sections>
|
| 41 |
+
</config>
|
app/code/community/Ti/AdminComment/sql/admincomment_setup/mysql4-install-1.0.0.php
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
$installer = $this;
|
| 4 |
+
|
| 5 |
+
$installer->startSetup();
|
| 6 |
+
|
| 7 |
+
$installer->run("
|
| 8 |
+
|
| 9 |
+
DROP TABLE IF EXISTS {$this->getTable('admincomment/messages')};
|
| 10 |
+
CREATE TABLE {$this->getTable('admincomment/messages')} (
|
| 11 |
+
`message_id` int(11) unsigned NOT NULL auto_increment,
|
| 12 |
+
`title` varchar(255) NOT NULL default '',
|
| 13 |
+
`content` text NOT NULL default '',
|
| 14 |
+
`status` smallint(6) NOT NULL default '0',
|
| 15 |
+
`order_status` varchar(32) NOT NULL default'',
|
| 16 |
+
`created_time` datetime NULL,
|
| 17 |
+
`update_time` datetime NULL,
|
| 18 |
+
PRIMARY KEY (`message_id`)
|
| 19 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
| 20 |
+
|
| 21 |
+
");
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
$installer->getConnection()
|
| 25 |
+
->addConstraint(
|
| 26 |
+
'FK_ORDER_STATUS',
|
| 27 |
+
$this->getTable('admincomment/messages'),
|
| 28 |
+
'order_status',
|
| 29 |
+
$this->getTable('sales/order_status_state'),
|
| 30 |
+
'status'
|
| 31 |
+
);
|
| 32 |
+
|
| 33 |
+
$installer->endSetup();
|
app/code/community/Ti/AdminComment/sql/admincomment_setup/mysql4-upgrade-1.0.0-1.0.1.php
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
$installer = $this;
|
| 4 |
+
|
| 5 |
+
$installer->startSetup();
|
| 6 |
+
|
| 7 |
+
$installer->run("
|
| 8 |
+
|
| 9 |
+
DROP TABLE IF EXISTS {$this->getTable('admincomment/messages')};
|
| 10 |
+
CREATE TABLE {$this->getTable('admincomment/messages')} (
|
| 11 |
+
`message_id` int(11) unsigned NOT NULL auto_increment,
|
| 12 |
+
`title` varchar(255) NOT NULL default '',
|
| 13 |
+
`content` text NOT NULL default '',
|
| 14 |
+
`status` smallint(6) NOT NULL default '0',
|
| 15 |
+
`order_status` varchar(32) NOT NULL default'',
|
| 16 |
+
`created_time` datetime NULL,
|
| 17 |
+
`update_time` datetime NULL,
|
| 18 |
+
PRIMARY KEY (`message_id`)
|
| 19 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
| 20 |
+
|
| 21 |
+
");
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
$installer->getConnection()
|
| 25 |
+
->addConstraint(
|
| 26 |
+
'FK_ORDER_STATUS',
|
| 27 |
+
$this->getTable('admincomment/messages'),
|
| 28 |
+
'order_status',
|
| 29 |
+
$this->getTable('sales/order_status_state'),
|
| 30 |
+
'status'
|
| 31 |
+
);
|
| 32 |
+
|
| 33 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/ti/admincomment.xml
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<!--
|
| 3 |
+
/**
|
| 4 |
+
* Ti Admin Comment Module
|
| 5 |
+
*
|
| 6 |
+
* @category Ti
|
| 7 |
+
* @package Ti_AdminComment
|
| 8 |
+
* @copyright Copyright (c) 2014 Ti Technologies (http://www.titechnologies.in)
|
| 9 |
+
* @link http://www.titechnologies.in
|
| 10 |
+
*/
|
| 11 |
+
-->
|
| 12 |
+
<layout version="0.1.0">
|
| 13 |
+
<admincomment_adminhtml_admincomment_index>
|
| 14 |
+
<reference name="content">
|
| 15 |
+
<block type="admincomment/adminhtml_admincomment" name="admincomment" />
|
| 16 |
+
</reference>
|
| 17 |
+
</admincomment_adminhtml_admincomment_index>
|
| 18 |
+
|
| 19 |
+
<adminhtml_sales_order_view>
|
| 20 |
+
<reference name="head">
|
| 21 |
+
<action method="addJs"><file>ti/admincomment/order_messages.js</file></action>
|
| 22 |
+
</reference>
|
| 23 |
+
</adminhtml_sales_order_view>
|
| 24 |
+
|
| 25 |
+
<admincomment_messages_dropdown>
|
| 26 |
+
<block type="admincomment/adminhtml_order_messages" name="dropdown" as="dropdown" template="admincomment/order/dropdown.phtml" output="toHtml" />
|
| 27 |
+
</admincomment_messages_dropdown>
|
| 28 |
+
</layout>
|
app/etc/modules/Ti_AdminComment.xml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Ti_AdminComment>
|
| 5 |
+
<active>true</active>
|
| 6 |
+
<codePool>community</codePool>
|
| 7 |
+
</Ti_AdminComment>
|
| 8 |
+
</modules>
|
| 9 |
+
</config>
|
js/ti/admincomment/order_messages.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Ti Admin Comment Module
|
| 3 |
+
*
|
| 4 |
+
* @category Ti
|
| 5 |
+
* @package Ti_AdminComment
|
| 6 |
+
* @copyright Copyright (c) 2014 Ti Technologies (http://www.titechnologies.in)
|
| 7 |
+
* @link http://www.titechnologies.in
|
| 8 |
+
*/
|
| 9 |
+
|
| 10 |
+
var PrePopulatedMessages = Class.create();
|
| 11 |
+
PrePopulatedMessages.prototype = {
|
| 12 |
+
initialize: function() {
|
| 13 |
+
this.loadMessagesDropdown();
|
| 14 |
+
},
|
| 15 |
+
|
| 16 |
+
loadMessagesDropdown: function() {
|
| 17 |
+
console.log(prePopulateMessagesUrl)
|
| 18 |
+
new Ajax.Request(prePopulateMessagesUrl, {
|
| 19 |
+
method: 'get',
|
| 20 |
+
loaderArea: false,
|
| 21 |
+
onComplete: function(transport) {
|
| 22 |
+
var response = transport.responseText.evalJSON();
|
| 23 |
+
var dropdown = response.dropdown;
|
| 24 |
+
console.log(dropdown)
|
| 25 |
+
$('history_form').down('span.field-row', 1).insert({
|
| 26 |
+
'before': dropdown
|
| 27 |
+
});
|
| 28 |
+
prePopulatedMessages.initMessagesDropdownListener();
|
| 29 |
+
}
|
| 30 |
+
});
|
| 31 |
+
},
|
| 32 |
+
|
| 33 |
+
initMessagesDropdownListener: function() {
|
| 34 |
+
var selectedMessage = new Form.Element.Observer('admincomment_messages_dropdown', 0, function() {
|
| 35 |
+
$('history_comment').setValue(this.getValue())
|
| 36 |
+
});
|
| 37 |
+
}
|
| 38 |
+
}
|
package.xml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>Ti_AdminComment</name>
|
| 4 |
+
<version>1.2.7</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license>OSL</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>Module allow administrator to append pre-defined order comments and sent customers notification emails.</summary>
|
| 10 |
+
<description><p>This extension allow you to create messages against each order status from admin side. A dropdown will appear in your admin's order detail page just above the comment textarea. Select the dropdown then message will display in comments text area.</p><p>Administrator can send notification email by checking 'Notify Customer by Email' checkbox.</p></description>
|
| 11 |
+
<notes>This module is now compatible with 1.9.x</notes>
|
| 12 |
+
<authors><author><name>Tech Innovations</name><user>MAG002092034</user><email>magento@titechnologies.in</email></author></authors>
|
| 13 |
+
<date>2015-01-27</date>
|
| 14 |
+
<time>14:19:04</time>
|
| 15 |
+
<contents><target name="magecommunity"><dir name="Ti"><dir name="AdminComment"><dir name="Block"><dir name="Adminhtml"><dir name="Admincomment"><dir name="Edit"><file name="Form.php" hash="257666cdb89ebc4f57988f8413a63b7e"/><dir name="Tab"><file name="Form.php" hash="9911b9d8400a412114e4ced956906073"/></dir><file name="Tabs.php" hash="4277d75d20b0c5a3cbc643bd99d999d0"/></dir><file name="Edit.php" hash="4247e4810607506404c3ae66d3bb596a"/><dir name="Grid"><dir name="Renderer"><file name="Content.php" hash="5868bac0ea6d6c0f9dbd110276fbd7a2"/></dir></dir><file name="Grid.php" hash="3a834e5df84a2956fd39df877d0baea5"/></dir><file name="Admincomment.php" hash="5e0431487be5f07248d8b442a824967b"/><dir name="Order"><file name="Messages.php" hash="0f5eb50913eb389793fc64f7dca8e899"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="de238d5c1a3d4cc4bece1b382719c1e9"/></dir><dir name="Model"><file name="Messages.php" hash="10526fa8ea488fd6c93880431b7754f4"/><dir name="Mysql4"><dir name="Messages"><file name="Collection.php" hash="48305566c707ef3a6c6ab1702821dbb4"/></dir><file name="Messages.php" hash="b10f4067533f635fa8cc81cba2cffe0a"/></dir><file name="Observer.php" hash="5f16f18a8c303fcef9b08d57f20a8d86"/><file name="Status.php" hash="6bf903c61d78fc163d64c70be6960e0c"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="AdmincommentController.php" hash="589108247e2cfc8a671cc14fb7caeadc"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="f2bf4e4a94a8d073928218dd7b6e32bf"/><file name="config.xml" hash="bb94d4f8a5e53c6f98cf0a3921d2e1fb"/><file name="system.xml" hash="18de14fbd1ed9ee8f81dd5b7d76b3ebb"/></dir><dir name="sql"><dir name="admincomment_setup"><file name="mysql4-install-1.0.0.php" hash="dc1e8985adab9b24f2875ea0fa9205cb"/><file name="mysql4-upgrade-1.0.0-1.0.1.php" hash="72f389e5619bb345f8b93803de412716"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="ti"><file name="admincomment.xml" hash="002b04524a45218f9750c5ab31f0ae90"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ti_AdminComment.xml" hash="9523dfc413b58496466cab3027b2449f"/></dir></target><target name="mage"><dir name="js"><dir name="ti"><dir name="admincomment"><file name="order_messages.js" hash="809c09dbc43b2cc1dc490f7eb6d588c3"/></dir></dir></dir></target></contents>
|
| 16 |
+
<compatible/>
|
| 17 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
| 18 |
+
</package>
|
