Version Notes
New Release.
Download this release
Release Info
Developer | Chandan Kumar Singh |
Extension | Order_Comment_Checkout |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/Goigi/Comment/Block/Adminhtml/Comment.php +13 -0
- app/code/community/Goigi/Comment/Block/Adminhtml/Comment/Edit.php +47 -0
- app/code/community/Goigi/Comment/Block/Adminhtml/Comment/Edit/Form.php +19 -0
- app/code/community/Goigi/Comment/Block/Adminhtml/Comment/Edit/Tab/Form.php +64 -0
- app/code/community/Goigi/Comment/Block/Adminhtml/Comment/Edit/Tabs.php +24 -0
- app/code/community/Goigi/Comment/Block/Adminhtml/Comment/Grid.php +123 -0
- app/code/community/Goigi/Comment/Block/Comment.php +17 -0
- app/code/community/Goigi/Comment/Block/Commentpage.php +9 -0
- app/code/community/Goigi/Comment/Helper/Data.php +6 -0
- app/code/community/Goigi/Comment/Model/Comment.php +10 -0
- app/code/community/Goigi/Comment/Model/Mysql4/Comment.php +10 -0
- app/code/community/Goigi/Comment/Model/Mysql4/Comment/Collection.php +10 -0
- app/code/community/Goigi/Comment/Model/Observer.php +17 -0
- app/code/community/Goigi/Comment/Model/Order/Default.php +87 -0
- app/code/community/Goigi/Comment/Model/Order/Invoice.php +102 -0
- app/code/community/Goigi/Comment/Model/Status.php +15 -0
- app/code/community/Goigi/Comment/controllers/Adminhtml/CommentController.php +185 -0
- app/code/community/Goigi/Comment/controllers/IndexController.php +16 -0
- app/code/community/Goigi/Comment/etc/config.xml +141 -0
- app/code/community/Goigi/Comment/sql/comment_setup/mysql4-install-1.0.0.php +18 -0
- app/design/adminhtml/default/default/layout/comment.xml +8 -0
- app/design/frontend/rwd/default/layout/comment.xml +8 -0
- app/design/frontend/rwd/default/template/comment/comment.phtml +19 -0
- app/etc/modules/Goigi_Comment.xml +9 -0
- package.xml +18 -0
app/code/community/Goigi/Comment/Block/Adminhtml/Comment.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Goigi_Comment_Block_Adminhtml_Comment extends Mage_Adminhtml_Block_Widget_Grid_Container
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
$this->_controller = 'adminhtml_comment';
|
7 |
+
$this->_blockGroup = 'comment';
|
8 |
+
$this->_headerText = Mage::helper('comment')->__('Comment Manager');
|
9 |
+
$this->_addButtonLabel = Mage::helper('comment')->__('Add Comment');
|
10 |
+
parent::__construct();
|
11 |
+
$this->_removeButton('add');
|
12 |
+
}
|
13 |
+
}
|
app/code/community/Goigi/Comment/Block/Adminhtml/Comment/Edit.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Goigi_Comment_Block_Adminhtml_Comment_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->_removeButton('save');
|
9 |
+
$this->_removeButton('reset');
|
10 |
+
|
11 |
+
$this->_objectId = 'id';
|
12 |
+
$this->_blockGroup = 'comment';
|
13 |
+
$this->_controller = 'adminhtml_comment';
|
14 |
+
|
15 |
+
$this->_updateButton('save', 'label', Mage::helper('comment')->__('Save Comment'));
|
16 |
+
$this->_updateButton('delete', 'label', Mage::helper('comment')->__('Delete Comment'));
|
17 |
+
|
18 |
+
/* $this->_addButton('saveandcontinue', array(
|
19 |
+
'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
|
20 |
+
'onclick' => 'saveAndContinueEdit()',
|
21 |
+
'class' => 'save',
|
22 |
+
), -100);
|
23 |
+
*/
|
24 |
+
$this->_formScripts[] = "
|
25 |
+
function toggleEditor() {
|
26 |
+
if (tinyMCE.getInstanceById('comment_content') == null) {
|
27 |
+
tinyMCE.execCommand('mceAddControl', false, 'comment_content');
|
28 |
+
} else {
|
29 |
+
tinyMCE.execCommand('mceRemoveControl', false, 'comment_content');
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
+
function saveAndContinueEdit(){
|
34 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
35 |
+
}
|
36 |
+
";
|
37 |
+
}
|
38 |
+
|
39 |
+
public function getHeaderText()
|
40 |
+
{
|
41 |
+
if( Mage::registry('comment_data') && Mage::registry('comment_data')->getId() ) {
|
42 |
+
return Mage::helper('comment')->__("View Comment '%s'", $this->htmlEscape(Mage::registry('comment_data')->getTitle()));
|
43 |
+
} else {
|
44 |
+
return Mage::helper('comment')->__('Add Comment');
|
45 |
+
}
|
46 |
+
}
|
47 |
+
}
|
app/code/community/Goigi/Comment/Block/Adminhtml/Comment/Edit/Form.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Goigi_Comment_Block_Adminhtml_Comment_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/community/Goigi/Comment/Block/Adminhtml/Comment/Edit/Tab/Form.php
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Goigi_Comment_Block_Adminhtml_Comment_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('comment_form', array('legend'=>Mage::helper('comment')->__('Comment information')));
|
10 |
+
|
11 |
+
$fieldset->addField('customeremail', 'text', array(
|
12 |
+
'label' => Mage::helper('comment')->__('Customer Email Address'),
|
13 |
+
'class' => 'required-entry',
|
14 |
+
'required' => true,
|
15 |
+
'name' => 'customeremail',
|
16 |
+
'readonly' => TRUE,
|
17 |
+
));
|
18 |
+
|
19 |
+
$fieldset->addField('ordernumber', 'text', array(
|
20 |
+
'label' => Mage::helper('comment')->__('Order Number'),
|
21 |
+
'class' => 'required-entry',
|
22 |
+
'required' => true,
|
23 |
+
'name' => 'ordernumber',
|
24 |
+
'readonly' => TRUE,
|
25 |
+
));
|
26 |
+
|
27 |
+
$fieldset->addField('comment', 'editor', array(
|
28 |
+
'name' => 'comment',
|
29 |
+
'label' => Mage::helper('comment')->__('Order Comment'),
|
30 |
+
'title' => Mage::helper('comment')->__('Order Comment'),
|
31 |
+
'style' => 'width:500px; height:300px;',
|
32 |
+
'wysiwyg' => true,
|
33 |
+
'required' => true,
|
34 |
+
'readonly' => TRUE,
|
35 |
+
));
|
36 |
+
|
37 |
+
/*
|
38 |
+
$fieldset->addField('status', 'select', array(
|
39 |
+
'label' => Mage::helper('comment')->__('Status'),
|
40 |
+
'name' => 'status',
|
41 |
+
'values' => array(
|
42 |
+
array(
|
43 |
+
'value' => 1,
|
44 |
+
'label' => Mage::helper('comment')->__('Enabled'),
|
45 |
+
),
|
46 |
+
|
47 |
+
array(
|
48 |
+
'value' => 2,
|
49 |
+
'label' => Mage::helper('comment')->__('Disabled'),
|
50 |
+
),
|
51 |
+
),
|
52 |
+
));
|
53 |
+
|
54 |
+
*/
|
55 |
+
if ( Mage::getSingleton('adminhtml/session')->getCommentData() )
|
56 |
+
{
|
57 |
+
$form->setValues(Mage::getSingleton('adminhtml/session')->getCommentData());
|
58 |
+
Mage::getSingleton('adminhtml/session')->setCommentData(null);
|
59 |
+
} elseif ( Mage::registry('comment_data') ) {
|
60 |
+
$form->setValues(Mage::registry('comment_data')->getData());
|
61 |
+
}
|
62 |
+
return parent::_prepareForm();
|
63 |
+
}
|
64 |
+
}
|
app/code/community/Goigi/Comment/Block/Adminhtml/Comment/Edit/Tabs.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Goigi_Comment_Block_Adminhtml_Comment_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
4 |
+
{
|
5 |
+
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
parent::__construct();
|
9 |
+
$this->setId('comment_tabs');
|
10 |
+
$this->setDestElementId('edit_form');
|
11 |
+
$this->setTitle(Mage::helper('comment')->__('Comment Information'));
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _beforeToHtml()
|
15 |
+
{
|
16 |
+
$this->addTab('form_section', array(
|
17 |
+
'label' => Mage::helper('comment')->__('Comment Information'),
|
18 |
+
'title' => Mage::helper('comment')->__('Comment Information'),
|
19 |
+
'content' => $this->getLayout()->createBlock('comment/adminhtml_comment_edit_tab_form')->toHtml(),
|
20 |
+
));
|
21 |
+
|
22 |
+
return parent::_beforeToHtml();
|
23 |
+
}
|
24 |
+
}
|
app/code/community/Goigi/Comment/Block/Adminhtml/Comment/Grid.php
ADDED
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Goigi_Comment_Block_Adminhtml_Comment_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->setId('commentGrid');
|
9 |
+
$this->setDefaultSort('comment_id');
|
10 |
+
$this->setDefaultDir('ASC');
|
11 |
+
$this->setSaveParametersInSession(true);
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _prepareCollection()
|
15 |
+
{
|
16 |
+
$collection = Mage::getModel('comment/comment')->getCollection();
|
17 |
+
$this->setCollection($collection);
|
18 |
+
return parent::_prepareCollection();
|
19 |
+
}
|
20 |
+
|
21 |
+
protected function _prepareColumns()
|
22 |
+
{
|
23 |
+
$this->addColumn('comment_id', array(
|
24 |
+
'header' => Mage::helper('comment')->__('ID'),
|
25 |
+
'align' =>'right',
|
26 |
+
'width' => '50px',
|
27 |
+
'index' => 'comment_id',
|
28 |
+
));
|
29 |
+
|
30 |
+
$this->addColumn('ordernumber', array(
|
31 |
+
'header' => Mage::helper('comment')->__('Order Number'),
|
32 |
+
'align' =>'left',
|
33 |
+
'width' => '50px',
|
34 |
+
'index' => 'ordernumber',
|
35 |
+
));
|
36 |
+
|
37 |
+
|
38 |
+
$this->addColumn('customeremail', array(
|
39 |
+
'header' => Mage::helper('comment')->__('Customer Email Address'),
|
40 |
+
'width' => '150px',
|
41 |
+
'index' => 'customeremail',
|
42 |
+
));
|
43 |
+
|
44 |
+
$this->addColumn('comment', array(
|
45 |
+
'header' => Mage::helper('comment')->__('Order Comment'),
|
46 |
+
'width' => '450px',
|
47 |
+
'index' => 'comment',
|
48 |
+
));
|
49 |
+
|
50 |
+
|
51 |
+
/* $this->addColumn('status', array(
|
52 |
+
'header' => Mage::helper('comment')->__('Status'),
|
53 |
+
'align' => 'left',
|
54 |
+
'width' => '80px',
|
55 |
+
'index' => 'status',
|
56 |
+
'type' => 'options',
|
57 |
+
'options' => array(
|
58 |
+
1 => 'Enabled',
|
59 |
+
2 => 'Disabled',
|
60 |
+
),
|
61 |
+
));
|
62 |
+
*/
|
63 |
+
// $this->addColumn('action',
|
64 |
+
// array(
|
65 |
+
// 'header' => Mage::helper('comment')->__('Action'),
|
66 |
+
// 'width' => '100',
|
67 |
+
// 'type' => 'action',
|
68 |
+
// 'getter' => 'getId',
|
69 |
+
// 'actions' => array(
|
70 |
+
// array(
|
71 |
+
// 'caption' => Mage::helper('comment')->__('Edit'),
|
72 |
+
// 'url' => array('base'=> '*/*/edit'),
|
73 |
+
// 'field' => 'id'
|
74 |
+
// )
|
75 |
+
// ),
|
76 |
+
// 'filter' => false,
|
77 |
+
// 'sortable' => false,
|
78 |
+
// 'index' => 'stores',
|
79 |
+
// 'is_system' => true,
|
80 |
+
// ));
|
81 |
+
|
82 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('comment')->__('CSV'));
|
83 |
+
$this->addExportType('*/*/exportXml', Mage::helper('comment')->__('XML'));
|
84 |
+
|
85 |
+
return parent::_prepareColumns();
|
86 |
+
}
|
87 |
+
|
88 |
+
protected function _prepareMassaction()
|
89 |
+
{
|
90 |
+
$this->setMassactionIdField('comment_id');
|
91 |
+
$this->getMassactionBlock()->setFormFieldName('comment');
|
92 |
+
|
93 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
94 |
+
'label' => Mage::helper('comment')->__('Delete'),
|
95 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
96 |
+
'confirm' => Mage::helper('comment')->__('Are you sure?')
|
97 |
+
));
|
98 |
+
|
99 |
+
$statuses = Mage::getSingleton('comment/status')->getOptionArray();
|
100 |
+
|
101 |
+
array_unshift($statuses, array('label'=>'', 'value'=>''));
|
102 |
+
$this->getMassactionBlock()->addItem('status', array(
|
103 |
+
'label'=> Mage::helper('comment')->__('Change status'),
|
104 |
+
'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
|
105 |
+
'additional' => array(
|
106 |
+
'visibility' => array(
|
107 |
+
'name' => 'status',
|
108 |
+
'type' => 'select',
|
109 |
+
'class' => 'required-entry',
|
110 |
+
'label' => Mage::helper('comment')->__('Status'),
|
111 |
+
'values' => $statuses
|
112 |
+
)
|
113 |
+
)
|
114 |
+
));
|
115 |
+
return $this;
|
116 |
+
}
|
117 |
+
|
118 |
+
public function getRowUrl($row)
|
119 |
+
{
|
120 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
121 |
+
}
|
122 |
+
|
123 |
+
}
|
app/code/community/Goigi/Comment/Block/Comment.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Goigi_Comment_Block_Comment extends Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
public function _prepareLayout()
|
5 |
+
{
|
6 |
+
return parent::_prepareLayout();
|
7 |
+
}
|
8 |
+
|
9 |
+
public function getComment()
|
10 |
+
{
|
11 |
+
if (!$this->hasData('comment')) {
|
12 |
+
$this->setData('comment', Mage::registry('comment'));
|
13 |
+
}
|
14 |
+
return $this->getData('comment');
|
15 |
+
|
16 |
+
}
|
17 |
+
}
|
app/code/community/Goigi/Comment/Block/Commentpage.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Goigi_Comment_Block_Commentpage extends Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
protected function _toHtml()
|
5 |
+
{
|
6 |
+
$this->setTemplate('comment/comment.phtml');
|
7 |
+
return parent::_toHtml();
|
8 |
+
}
|
9 |
+
}
|
app/code/community/Goigi/Comment/Helper/Data.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Goigi_Comment_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
app/code/community/Goigi/Comment/Model/Comment.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Goigi_Comment_Model_Comment extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('comment/comment');
|
9 |
+
}
|
10 |
+
}
|
app/code/community/Goigi/Comment/Model/Mysql4/Comment.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Goigi_Comment_Model_Mysql4_Comment extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
// Note that the comment_id refers to the key field in your database table.
|
8 |
+
$this->_init('comment/comment', 'comment_id');
|
9 |
+
}
|
10 |
+
}
|
app/code/community/Goigi/Comment/Model/Mysql4/Comment/Collection.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Goigi_Comment_Model_Mysql4_Comment_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('comment/comment');
|
9 |
+
}
|
10 |
+
}
|
app/code/community/Goigi/Comment/Model/Observer.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Goigi_Comment_Model_Observer extends Varien_Object
|
4 |
+
{
|
5 |
+
public function commentadd(Varien_Event_Observer $observer) {
|
6 |
+
$order = $observer->getEvent()->getOrder();
|
7 |
+
$orderid = $order->getIncrementId();
|
8 |
+
$customeremail = $order->getCustomerEmail();
|
9 |
+
$orderComment = Mage::getSingleton('core/session')->gettextval();
|
10 |
+
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
|
11 |
+
$write->insert(
|
12 |
+
"comment",
|
13 |
+
array("ordernumber" => $orderid, "customeremail" => $customeremail, "comment" => $orderComment)
|
14 |
+
);
|
15 |
+
Mage::getSingleton('core/session')->unstextval();
|
16 |
+
}
|
17 |
+
}
|
app/code/community/Goigi/Comment/Model/Order/Default.php
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Goigi_Comment_Model_Order_Default extends Mage_Sales_Model_Order_Pdf_Items_Invoice_Default
|
3 |
+
{
|
4 |
+
public function draw()
|
5 |
+
{
|
6 |
+
$order = $this->getOrder();
|
7 |
+
$item = $this->getItem();
|
8 |
+
$pdf = $this->getPdf();
|
9 |
+
$page = $this->getPage();
|
10 |
+
$lines = array();
|
11 |
+
|
12 |
+
$lines[0] = array(array(
|
13 |
+
'text' => Mage::helper('core/string')->str_split($item->getName(), 60, true, true),
|
14 |
+
'feed' => 35,
|
15 |
+
));
|
16 |
+
|
17 |
+
$lines[0][] = array(
|
18 |
+
'text' => Mage::helper('core/string')->str_split($this->getSku($item), 25),
|
19 |
+
'feed' => 325
|
20 |
+
);
|
21 |
+
|
22 |
+
|
23 |
+
$lines[0][] = array(
|
24 |
+
'text' => $item->getQty()*1,
|
25 |
+
'feed' => 435
|
26 |
+
);
|
27 |
+
|
28 |
+
|
29 |
+
$lines[0][] = array(
|
30 |
+
'text' => $order->formatPriceTxt($item->getPrice()),
|
31 |
+
'feed' => 395,
|
32 |
+
'font' => 'bold',
|
33 |
+
'align' => 'right'
|
34 |
+
);
|
35 |
+
|
36 |
+
|
37 |
+
$lines[0][] = array(
|
38 |
+
'text' => $order->formatPriceTxt($item->getTaxAmount()),
|
39 |
+
'feed' => 495,
|
40 |
+
'font' => 'bold',
|
41 |
+
'align' => 'right'
|
42 |
+
);
|
43 |
+
|
44 |
+
|
45 |
+
$lines[0][] = array(
|
46 |
+
'text' => $order->formatPriceTxt($item->getRowTotal()),
|
47 |
+
'feed' => 565,
|
48 |
+
'font' => 'bold',
|
49 |
+
'align' => 'right'
|
50 |
+
);
|
51 |
+
|
52 |
+
|
53 |
+
$options = $this->getItemOptions();
|
54 |
+
if ($options) {
|
55 |
+
foreach ($options as $option) {
|
56 |
+
|
57 |
+
$lines[][] = array(
|
58 |
+
'text' => Mage::helper('core/string')->str_split(strip_tags($option['label']), 70, true, true),
|
59 |
+
'font' => 'italic',
|
60 |
+
'feed' => 35
|
61 |
+
);
|
62 |
+
|
63 |
+
if ($option['value']) {
|
64 |
+
$_printValue = isset($option['print_value']) ? $option['print_value'] : strip_tags($option['value']);
|
65 |
+
$values = explode(', ', $_printValue);
|
66 |
+
foreach ($values as $value) {
|
67 |
+
$lines[][] = array(
|
68 |
+
'text' => Mage::helper('core/string')->str_split($value, 50, true, true),
|
69 |
+
'feed' => 40
|
70 |
+
);
|
71 |
+
}
|
72 |
+
}
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
$lineBlock = array(
|
77 |
+
'lines' => $lines,
|
78 |
+
'height' => 10
|
79 |
+
);
|
80 |
+
|
81 |
+
$page = $pdf->drawLineBlocks($page, array($lineBlock), array('table_header' => true));
|
82 |
+
$this->setPage($page);
|
83 |
+
|
84 |
+
}
|
85 |
+
|
86 |
+
|
87 |
+
}
|
app/code/community/Goigi/Comment/Model/Order/Invoice.php
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Goigi_Comment_Model_Order_Invoice extends Mage_Sales_Model_Order_Pdf_Invoice
|
3 |
+
{
|
4 |
+
public function getPdf($invoices = array())
|
5 |
+
{
|
6 |
+
$this->_beforeGetPdf();
|
7 |
+
$this->_initRenderer('invoice');
|
8 |
+
|
9 |
+
$pdf = new Zend_Pdf();
|
10 |
+
$this->_setPdf($pdf);
|
11 |
+
$style = new Zend_Pdf_Style();
|
12 |
+
$this->_setFontBold($style, 10);
|
13 |
+
|
14 |
+
foreach ($invoices as $invoice) {
|
15 |
+
if ($invoice->getStoreId()) {
|
16 |
+
Mage::app()->getLocale()->emulate($invoice->getStoreId());
|
17 |
+
}
|
18 |
+
$page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
|
19 |
+
$pdf->pages[] = $page;
|
20 |
+
|
21 |
+
$order = $invoice->getOrder();
|
22 |
+
$this->insertLogo($page, $invoice->getStore());
|
23 |
+
$this->insertAddress($page, $invoice->getStore());
|
24 |
+
$this->insertOrder($page, $order, Mage::getStoreConfigFlag(self::XML_PATH_SALES_PDF_INVOICE_PUT_ORDER_ID, $order->getStoreId()));
|
25 |
+
$page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
|
26 |
+
$this->_setFontRegular($page);
|
27 |
+
$page->drawText(Mage::helper('sales')->__('Invoice # ') . $invoice->getIncrementId(), 35, 780, 'UTF-8');
|
28 |
+
$page->setFillColor(new Zend_Pdf_Color_RGB(0.93, 0.92, 0.92));
|
29 |
+
$page->setLineColor(new Zend_Pdf_Color_GrayScale(0.5));
|
30 |
+
$page->setLineWidth(0.5);
|
31 |
+
$page->drawRectangle(25, $this->y, 570, $this->y -15);
|
32 |
+
$this->y -=10;
|
33 |
+
$page->setFillColor(new Zend_Pdf_Color_RGB(0.4, 0.4, 0.4));
|
34 |
+
$page->drawText(Mage::helper('sales')->__('Products'), 35, $this->y, 'UTF-8');
|
35 |
+
|
36 |
+
|
37 |
+
$page->drawText(Mage::helper('sales')->__('SKU'), 325, $this->y, 'UTF-8');
|
38 |
+
$page->drawText(Mage::helper('sales')->__('Price'), 380, $this->y, 'UTF-8');
|
39 |
+
$page->drawText(Mage::helper('sales')->__('Qty'), 430, $this->y, 'UTF-8');
|
40 |
+
$page->drawText(Mage::helper('sales')->__('Tax'), 480, $this->y, 'UTF-8');
|
41 |
+
$page->drawText(Mage::helper('sales')->__('Subtotal'), 535, $this->y, 'UTF-8');
|
42 |
+
|
43 |
+
$this->y -=15;
|
44 |
+
|
45 |
+
$page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
|
46 |
+
|
47 |
+
|
48 |
+
foreach ($invoice->getAllItems() as $item){
|
49 |
+
if ($item->getOrderItem()->getParentItem()) {
|
50 |
+
continue;
|
51 |
+
}
|
52 |
+
|
53 |
+
if ($this->y < 15) {
|
54 |
+
$page = $this->newPage(array('table_header' => true));
|
55 |
+
}
|
56 |
+
|
57 |
+
|
58 |
+
$page = $this->_drawItem($item, $page, $order);
|
59 |
+
}
|
60 |
+
|
61 |
+
|
62 |
+
$page = $this->insertTotals($page, $invoice);
|
63 |
+
|
64 |
+
if ($invoice->getStoreId()) {
|
65 |
+
Mage::app()->getLocale()->revert();
|
66 |
+
}
|
67 |
+
}
|
68 |
+
$this->_afterGetPdf();
|
69 |
+
$readConnection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
70 |
+
$query = 'SELECT comment FROM comment where ordernumber ='.$order->getIncrementId();
|
71 |
+
$results = $readConnection->fetchAll($query);
|
72 |
+
$page->drawText($results[0]['comment'], 35, $this->y, 'UTF-8');
|
73 |
+
return $pdf;
|
74 |
+
}
|
75 |
+
|
76 |
+
public function newPage(array $settings = array())
|
77 |
+
{
|
78 |
+
$page = $this->_getPdf()->newPage(Zend_Pdf_Page::SIZE_A4);
|
79 |
+
$this->_getPdf()->pages[] = $page;
|
80 |
+
$this->y = 800;
|
81 |
+
|
82 |
+
if (!empty($settings['table_header'])) {
|
83 |
+
$this->_setFontRegular($page);
|
84 |
+
$page->setFillColor(new Zend_Pdf_Color_RGB(0.93, 0.92, 0.92));
|
85 |
+
$page->setLineColor(new Zend_Pdf_Color_GrayScale(0.5));
|
86 |
+
$page->setLineWidth(0.5);
|
87 |
+
$page->drawRectangle(25, $this->y, 570, $this->y-15);
|
88 |
+
$this->y -=10;
|
89 |
+
$page->setFillColor(new Zend_Pdf_Color_RGB(0.4, 0.4, 0.4));
|
90 |
+
$page->drawText(Mage::helper('sales')->__('Product'), 35, $this->y, 'UTF-8');
|
91 |
+
$page->drawText(Mage::helper('sales')->__('SKU'), 325, $this->y, 'UTF-8');
|
92 |
+
$page->drawText(Mage::helper('sales')->__('Price'), 380, $this->y, 'UTF-8');
|
93 |
+
$page->drawText(Mage::helper('sales')->__('Qty'), 430, $this->y, 'UTF-8');
|
94 |
+
$page->drawText(Mage::helper('sales')->__('Tax'), 480, $this->y, 'UTF-8');
|
95 |
+
$page->drawText(Mage::helper('sales')->__('Subtotal'), 535, $this->y, 'UTF-8');
|
96 |
+
|
97 |
+
$page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
|
98 |
+
$this->y -=20;
|
99 |
+
}
|
100 |
+
return $page;
|
101 |
+
}
|
102 |
+
}
|
app/code/community/Goigi/Comment/Model/Status.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Goigi_Comment_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('comment')->__('Enabled'),
|
12 |
+
self::STATUS_DISABLED => Mage::helper('comment')->__('Disabled')
|
13 |
+
);
|
14 |
+
}
|
15 |
+
}
|
app/code/community/Goigi/Comment/controllers/Adminhtml/CommentController.php
ADDED
@@ -0,0 +1,185 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Goigi_Comment_Adminhtml_CommentController extends Mage_Adminhtml_Controller_action
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _initAction() {
|
7 |
+
$this->loadLayout()
|
8 |
+
->_setActiveMenu('comment/items')
|
9 |
+
->_addBreadcrumb(Mage::helper('adminhtml')->__('Comments Manager'), Mage::helper('adminhtml')->__('Comment 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('comment/comment')->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('comment_data', $model);
|
30 |
+
|
31 |
+
$this->loadLayout();
|
32 |
+
$this->_setActiveMenu('comment/items');
|
33 |
+
|
34 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Comment Manager'), Mage::helper('adminhtml')->__('Comment Manager'));
|
35 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Comment News'), Mage::helper('adminhtml')->__('Comment News'));
|
36 |
+
|
37 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
38 |
+
|
39 |
+
$this->_addContent($this->getLayout()->createBlock('comment/adminhtml_comment_edit'))
|
40 |
+
->_addLeft($this->getLayout()->createBlock('comment/adminhtml_comment_edit_tabs'));
|
41 |
+
|
42 |
+
$this->renderLayout();
|
43 |
+
} else {
|
44 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('comment')->__('Comment 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 |
+
$model = Mage::getModel('comment/comment');
|
56 |
+
$model->setData($data)
|
57 |
+
->setId($this->getRequest()->getParam('id'));
|
58 |
+
|
59 |
+
try {
|
60 |
+
if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
|
61 |
+
$model->setCreatedTime(now())
|
62 |
+
->setUpdateTime(now());
|
63 |
+
} else {
|
64 |
+
$model->setUpdateTime(now());
|
65 |
+
}
|
66 |
+
|
67 |
+
$model->save();
|
68 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('comment')->__('Comment was successfully saved'));
|
69 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
70 |
+
|
71 |
+
if ($this->getRequest()->getParam('back')) {
|
72 |
+
$this->_redirect('*/*/edit', array('id' => $model->getId()));
|
73 |
+
return;
|
74 |
+
}
|
75 |
+
$this->_redirect('*/*/');
|
76 |
+
return;
|
77 |
+
} catch (Exception $e) {
|
78 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
79 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
80 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
81 |
+
return;
|
82 |
+
}
|
83 |
+
}
|
84 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('comment')->__('Unable to find comment to save'));
|
85 |
+
$this->_redirect('*/*/');
|
86 |
+
}
|
87 |
+
|
88 |
+
public function deleteAction() {
|
89 |
+
if( $this->getRequest()->getParam('id') > 0 ) {
|
90 |
+
try {
|
91 |
+
$model = Mage::getModel('comment/comment');
|
92 |
+
|
93 |
+
$model->setId($this->getRequest()->getParam('id'))
|
94 |
+
->delete();
|
95 |
+
|
96 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Comment was successfully deleted'));
|
97 |
+
$this->_redirect('*/*/');
|
98 |
+
} catch (Exception $e) {
|
99 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
100 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
101 |
+
}
|
102 |
+
}
|
103 |
+
$this->_redirect('*/*/');
|
104 |
+
}
|
105 |
+
|
106 |
+
public function massDeleteAction() {
|
107 |
+
$commentIds = $this->getRequest()->getParam('comment');
|
108 |
+
if(!is_array($commentIds)) {
|
109 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select comment(s)'));
|
110 |
+
} else {
|
111 |
+
try {
|
112 |
+
foreach ($commentIds as $commentId) {
|
113 |
+
$comment = Mage::getModel('comment/comment')->load($commentId);
|
114 |
+
$comment->delete();
|
115 |
+
}
|
116 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
117 |
+
Mage::helper('adminhtml')->__(
|
118 |
+
'Total of %d record(s) were successfully deleted', count($commentIds)
|
119 |
+
)
|
120 |
+
);
|
121 |
+
} catch (Exception $e) {
|
122 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
123 |
+
}
|
124 |
+
}
|
125 |
+
$this->_redirect('*/*/index');
|
126 |
+
}
|
127 |
+
|
128 |
+
public function massStatusAction()
|
129 |
+
{
|
130 |
+
$commentIds = $this->getRequest()->getParam('comment');
|
131 |
+
if(!is_array($commentIds)) {
|
132 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Please select comment(s)'));
|
133 |
+
} else {
|
134 |
+
try {
|
135 |
+
foreach ($commentIds as $commentId) {
|
136 |
+
$comment = Mage::getSingleton('comment/comment')
|
137 |
+
->load($commentId)
|
138 |
+
->setStatus($this->getRequest()->getParam('status'))
|
139 |
+
->setIsMassupdate(true)
|
140 |
+
->save();
|
141 |
+
}
|
142 |
+
$this->_getSession()->addSuccess(
|
143 |
+
$this->__('Total of %d record(s) were successfully updated', count($commentIds))
|
144 |
+
);
|
145 |
+
} catch (Exception $e) {
|
146 |
+
$this->_getSession()->addError($e->getMessage());
|
147 |
+
}
|
148 |
+
}
|
149 |
+
$this->_redirect('*/*/index');
|
150 |
+
}
|
151 |
+
|
152 |
+
public function exportCsvAction()
|
153 |
+
{
|
154 |
+
$fileName = 'comment.csv';
|
155 |
+
$content = $this->getLayout()->createBlock('comment/adminhtml_comment_grid')
|
156 |
+
->getCsv();
|
157 |
+
|
158 |
+
$this->_sendUploadResponse($fileName, $content);
|
159 |
+
}
|
160 |
+
|
161 |
+
public function exportXmlAction()
|
162 |
+
{
|
163 |
+
$fileName = 'comment.xml';
|
164 |
+
$content = $this->getLayout()->createBlock('comment/adminhtml_comment_grid')
|
165 |
+
->getXml();
|
166 |
+
|
167 |
+
$this->_sendUploadResponse($fileName, $content);
|
168 |
+
}
|
169 |
+
|
170 |
+
protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
|
171 |
+
{
|
172 |
+
$response = $this->getResponse();
|
173 |
+
$response->setHeader('HTTP/1.1 200 OK','');
|
174 |
+
$response->setHeader('Pragma', 'public', true);
|
175 |
+
$response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
|
176 |
+
$response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
|
177 |
+
$response->setHeader('Last-Modified', date('r'));
|
178 |
+
$response->setHeader('Accept-Ranges', 'bytes');
|
179 |
+
$response->setHeader('Content-Length', strlen($content));
|
180 |
+
$response->setHeader('Content-type', $contentType);
|
181 |
+
$response->setBody($content);
|
182 |
+
$response->sendResponse();
|
183 |
+
die;
|
184 |
+
}
|
185 |
+
}
|
app/code/community/Goigi/Comment/controllers/IndexController.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Goigi_Comment_IndexController extends Mage_Core_Controller_Front_Action
|
3 |
+
{
|
4 |
+
public function indexAction()
|
5 |
+
{
|
6 |
+
$this->loadLayout();
|
7 |
+
$this->renderLayout();
|
8 |
+
}
|
9 |
+
|
10 |
+
public function textvalAction()
|
11 |
+
{
|
12 |
+
Mage::getSingleton('core/session')->unstextval();
|
13 |
+
$val = $_REQUEST['ordercomment'];
|
14 |
+
Mage::getSingleton('core/session')->settextval($val);
|
15 |
+
}
|
16 |
+
}
|
app/code/community/Goigi/Comment/etc/config.xml
ADDED
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Goigi_Comment>
|
5 |
+
<version>1.0.0</version>
|
6 |
+
</Goigi_Comment>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<comment>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Goigi_Comment</module>
|
14 |
+
<frontName>comment</frontName>
|
15 |
+
</args>
|
16 |
+
</comment>
|
17 |
+
</routers>
|
18 |
+
<layout>
|
19 |
+
<updates>
|
20 |
+
<comment>
|
21 |
+
<file>comment.xml</file>
|
22 |
+
</comment>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
</frontend>
|
26 |
+
<admin>
|
27 |
+
<routers>
|
28 |
+
<comment>
|
29 |
+
<use>admin</use>
|
30 |
+
<args>
|
31 |
+
<module>Goigi_Comment</module>
|
32 |
+
<frontName>comment</frontName>
|
33 |
+
</args>
|
34 |
+
</comment>
|
35 |
+
</routers>
|
36 |
+
</admin>
|
37 |
+
<adminhtml>
|
38 |
+
<menu>
|
39 |
+
<comment module="comment">
|
40 |
+
<title>Comment</title>
|
41 |
+
<sort_order>71</sort_order>
|
42 |
+
<children>
|
43 |
+
<items module="comment">
|
44 |
+
<title>Manage Items</title>
|
45 |
+
<sort_order>0</sort_order>
|
46 |
+
<action>comment/adminhtml_comment</action>
|
47 |
+
</items>
|
48 |
+
</children>
|
49 |
+
</comment>
|
50 |
+
</menu>
|
51 |
+
<acl>
|
52 |
+
<resources>
|
53 |
+
<all>
|
54 |
+
<title>Allow Everything</title>
|
55 |
+
</all>
|
56 |
+
<admin>
|
57 |
+
<children>
|
58 |
+
<Goigi_Comment>
|
59 |
+
<title>Comment Module</title>
|
60 |
+
<sort_order>10</sort_order>
|
61 |
+
</Goigi_Comment>
|
62 |
+
</children>
|
63 |
+
</admin>
|
64 |
+
</resources>
|
65 |
+
</acl>
|
66 |
+
<layout>
|
67 |
+
<updates>
|
68 |
+
<comment>
|
69 |
+
<file>comment.xml</file>
|
70 |
+
</comment>
|
71 |
+
</updates>
|
72 |
+
</layout>
|
73 |
+
</adminhtml>
|
74 |
+
<global>
|
75 |
+
<models>
|
76 |
+
<comment>
|
77 |
+
<class>Goigi_Comment_Model</class>
|
78 |
+
<resourceModel>comment_mysql4</resourceModel>
|
79 |
+
</comment>
|
80 |
+
<comment_mysql4>
|
81 |
+
<class>Goigi_Comment_Model_Mysql4</class>
|
82 |
+
<entities>
|
83 |
+
<comment>
|
84 |
+
<table>comment</table>
|
85 |
+
</comment>
|
86 |
+
</entities>
|
87 |
+
</comment_mysql4>
|
88 |
+
|
89 |
+
<sales>
|
90 |
+
<rewrite>
|
91 |
+
<order_pdf_invoice>Goigi_Comment_Model_Order_Invoice</order_pdf_invoice>
|
92 |
+
<order_pdf_items_invoice_default>Goigi_Comment_Model_Order_Default</order_pdf_items_invoice_default>
|
93 |
+
</rewrite>
|
94 |
+
</sales>
|
95 |
+
</models>
|
96 |
+
|
97 |
+
|
98 |
+
<events>
|
99 |
+
<checkout_type_onepage_save_order>
|
100 |
+
<observers>
|
101 |
+
<goigi_comment_model_observer>
|
102 |
+
<type>singleton</type>
|
103 |
+
<class>Goigi_Comment_Model_Observer</class>
|
104 |
+
<method>commentadd</method>
|
105 |
+
</goigi_comment_model_observer>
|
106 |
+
</observers>
|
107 |
+
</checkout_type_onepage_save_order>
|
108 |
+
</events>
|
109 |
+
|
110 |
+
<resources>
|
111 |
+
<comment_setup>
|
112 |
+
<setup>
|
113 |
+
<module>Goigi_Comment</module>
|
114 |
+
</setup>
|
115 |
+
<connection>
|
116 |
+
<use>core_setup</use>
|
117 |
+
</connection>
|
118 |
+
</comment_setup>
|
119 |
+
<comment_write>
|
120 |
+
<connection>
|
121 |
+
<use>core_write</use>
|
122 |
+
</connection>
|
123 |
+
</comment_write>
|
124 |
+
<comment_read>
|
125 |
+
<connection>
|
126 |
+
<use>core_read</use>
|
127 |
+
</connection>
|
128 |
+
</comment_read>
|
129 |
+
</resources>
|
130 |
+
<blocks>
|
131 |
+
<comment>
|
132 |
+
<class>Goigi_Comment_Block</class>
|
133 |
+
</comment>
|
134 |
+
</blocks>
|
135 |
+
<helpers>
|
136 |
+
<comment>
|
137 |
+
<class>Goigi_Comment_Helper</class>
|
138 |
+
</comment>
|
139 |
+
</helpers>
|
140 |
+
</global>
|
141 |
+
</config>
|
app/code/community/Goigi/Comment/sql/comment_setup/mysql4-install-1.0.0.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
$installer->startSetup();
|
4 |
+
$installer->run("
|
5 |
+
-- DROP TABLE IF EXISTS {$this->getTable('comment')};
|
6 |
+
CREATE TABLE {$this->getTable('comment')} (
|
7 |
+
`comment_id` int(11) unsigned NOT NULL auto_increment,
|
8 |
+
`ordernumber` varchar(255) NULL default '',
|
9 |
+
`customeremail` varchar(255) NULL default '',
|
10 |
+
`comment` varchar(255) NULL default '',
|
11 |
+
`status` smallint(6) NULL default '1',
|
12 |
+
`created_time` datetime NULL,
|
13 |
+
`update_time` datetime NULL,
|
14 |
+
PRIMARY KEY (`comment_id`)
|
15 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
16 |
+
");
|
17 |
+
|
18 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/comment.xml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<comment_adminhtml_comment_index>
|
4 |
+
<reference name="content">
|
5 |
+
<block type="comment/adminhtml_comment" name="comment" />
|
6 |
+
</reference>
|
7 |
+
</comment_adminhtml_comment_index>
|
8 |
+
</layout>
|
app/design/frontend/rwd/default/layout/comment.xml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout>
|
3 |
+
<checkout_onepage_review>
|
4 |
+
<reference name="checkout.onepage.review.info.items.after">
|
5 |
+
<block type="core/template" name="comment.comment" template="comment/comment.phtml"/>
|
6 |
+
</reference>
|
7 |
+
</checkout_onepage_review>
|
8 |
+
</layout>
|
app/design/frontend/rwd/default/template/comment/comment.phtml
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="tunki">
|
2 |
+
<h4><?php echo $this->__('Order Comment') ?></h4>
|
3 |
+
<textarea name="ordercomment" id="ordercomment"></textarea>
|
4 |
+
</div>
|
5 |
+
<script type="text/javascript">
|
6 |
+
jQuery(document).ready(function(){
|
7 |
+
jQuery("#ordercomment").blur(function(){
|
8 |
+
var p_tunki = jQuery("#ordercomment").val();
|
9 |
+
jQuery.ajax({
|
10 |
+
type : "post",
|
11 |
+
url : "<?php echo $this->getUrl();?>comment/index/textval",
|
12 |
+
data : {ordercomment:p_tunki},
|
13 |
+
success: function(text){
|
14 |
+
// alert('hi');
|
15 |
+
}
|
16 |
+
});
|
17 |
+
});
|
18 |
+
});
|
19 |
+
</script>
|
app/etc/modules/Goigi_Comment.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Goigi_Comment>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Goigi_Comment>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Order_Comment_Checkout</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="https://opensource.org/licenses/osl-3.0.php">Open Software License</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>This extension lets customer to add their comments during placing order. </summary>
|
10 |
+
<description>This extension lets customer to add their comments during placing order. Admin can also view comments added by customer and this is also added to invoice.</description>
|
11 |
+
<notes>New Release.</notes>
|
12 |
+
<authors><author><name>Chandan Kumar Singh</name><user>chandan8050</user><email>chandankumar8050@gmail.com</email></author></authors>
|
13 |
+
<date>2016-11-04</date>
|
14 |
+
<time>07:10:57</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Goigi"><dir name="Comment"><dir name="Block"><dir name="Adminhtml"><dir name="Comment"><dir name="Edit"><file name="Form.php" hash="7eb66c674be0efd56300c447442ccc9e"/><dir name="Tab"><file name="Form.php" hash="24a0515c6d9bd041be56a0b3d967ecfc"/></dir><file name="Tabs.php" hash="6936ee401b4a060cb773bc5ba8a98a34"/></dir><file name="Edit.php" hash="a7e67d15a718888321f93f215c6f72b3"/><file name="Grid.php" hash="46df21ecaa3cc39fdeacce859dcd97fe"/></dir><file name="Comment.php" hash="2ca3a096d12b6b5507906d9e59b4e654"/></dir><file name="Comment.php" hash="1813b443b45b2fcf8fd605f650ff7e5b"/><file name="Commentpage.php" hash="423b0071680a6ab0948e8f211dea3a56"/></dir><dir name="Helper"><file name="Data.php" hash="e30a32e54ef911b542b8b79b202b364d"/></dir><dir name="Model"><file name="Comment.php" hash="8b560f2e7217d6b403c57c0cbcca32d5"/><dir name="Mysql4"><dir name="Comment"><file name="Collection.php" hash="186d2b46795cb5221b60b75a68101f2b"/></dir><file name="Comment.php" hash="96f8aadfe96a78f290c9f20740c725e0"/></dir><file name="Observer.php" hash="20f8512d014d973c40b5137074ac4847"/><dir name="Order"><file name="Default.php" hash="59654ccbf93b3ea008524c76f6578b07"/><file name="Invoice.php" hash="18c34469a7f1530fb9a3f78a78509fd5"/></dir><file name="Status.php" hash="2440f2171fb6f02fd83bfdc32f41dff1"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="CommentController.php" hash="ca15d62c9f61811c3a91a091e02f4cfc"/></dir><file name="IndexController.php" hash="4068257c39e2ae08b54a3c43ed56cf75"/></dir><dir name="etc"><file name="config.xml" hash="e91dea0a4d48e0d2bac3babdd41de036"/></dir><dir name="sql"><dir name="comment_setup"><file name="mysql4-install-1.0.0.php" hash="472b202b1a1befc9077f25f6d5471d1d"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="comment.xml" hash="c4bd2d5ef635163d3c6eb6d1922975f0"/></dir></dir></dir></dir><dir name="frontend"><dir name="rwd"><dir name="default"><dir name="layout"><file name="comment.xml" hash="e001f21d8c498a1fd8a09ae966796647"/></dir><dir name="template"><dir name="comment"><file name="comment.phtml" hash="3ad0e7957fa4623152a13afbbc31b5d4"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Goigi_Comment.xml" hash="918fa5e6b1e779898eaf7fecc128e5c1"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.0.0</min><max>7.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|