Version Notes
Add comment to customer.
Download this release
Release Info
Developer | Marcin Frymark |
Extension | customer_comment |
Version | 0.1.0.0 |
Comparing to | |
See all releases |
Version 0.1.0.0
- app/code/community/Alekseon/CustomerComment/Block/Adminhtml/Comment.php +90 -0
- app/code/community/Alekseon/CustomerComment/Block/Adminhtml/Grid/Renderer/CustomerComment.php +57 -0
- app/code/community/Alekseon/CustomerComment/Block/Adminhtml/Sales/Order/View/Info.php +23 -0
- app/code/community/Alekseon/CustomerComment/Block/Adminhtml/System/Config/Form/Field/AlekseonLogo.php +16 -0
- app/code/community/Alekseon/CustomerComment/Block/Adminhtml/System/Config/Form/Field/AlekseonNotification.php +16 -0
- app/code/community/Alekseon/CustomerComment/Helper/Data.php +39 -0
- app/code/community/Alekseon/CustomerComment/Model/AlekseonAdminNotification/Feed.php +99 -0
- app/code/community/Alekseon/CustomerComment/Model/AlekseonAdminNotification/Observer.php +18 -0
- app/code/community/Alekseon/CustomerComment/Model/Comment.php +1 -0
- app/code/community/Alekseon/CustomerComment/Model/Observer.php +1 -0
- app/code/community/Alekseon/CustomerComment/Model/Resource/Comment.php +15 -0
- app/code/community/Alekseon/CustomerComment/Model/Resource/Comment/Collection.php +14 -0
- app/code/community/Alekseon/CustomerComment/controllers/Adminhtml/CustomerCommentController.php +80 -0
- app/code/community/Alekseon/CustomerComment/etc/adminhtml.xml +35 -0
- app/code/community/Alekseon/CustomerComment/etc/config.xml +1 -1
- app/code/community/Alekseon/CustomerComment/etc/system.xml +120 -0
- app/code/community/Alekseon/CustomerComment/sql/alekseon_customercomment_setup/mysql4-install-0.1.0.php +22 -0
- app/design/adminhtml/default/default/layout/alekseon/customerComment.xml +40 -0
- app/design/adminhtml/default/default/template/alekseon/customerComment/comment.phtml +52 -0
- app/design/adminhtml/default/default/template/alekseon/customerComment/comment/container.phtml +21 -0
- app/design/adminhtml/default/default/template/alekseon/customerComment/customertab.phtml +20 -0
- app/etc/modules/Alekseon_CustomerComment.xml +17 -0
- package.xml +18 -0
- skin/adminhtml/default/default/js/alekseon/customerComment.js +90 -0
app/code/community/Alekseon/CustomerComment/Block/Adminhtml/Comment.php
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Marcin Frymark
|
4 |
+
* @email contact@alekseon.com
|
5 |
+
* @company Alekseon
|
6 |
+
* @website www.alekseon.com
|
7 |
+
*/
|
8 |
+
class Alekseon_CustomerComment_Block_Adminhtml_Comment extends Mage_Adminhtml_Block_Template
|
9 |
+
{
|
10 |
+
protected $_customerComment;
|
11 |
+
protected $_customerCommentTypes;
|
12 |
+
|
13 |
+
public function setComment($comment)
|
14 |
+
{
|
15 |
+
$this->_customerComment = $comment;
|
16 |
+
return $this;
|
17 |
+
}
|
18 |
+
|
19 |
+
public function getCustomerEmail()
|
20 |
+
{
|
21 |
+
$customerEmail = false;
|
22 |
+
|
23 |
+
if ($customer = Mage::registry('current_customer')) {
|
24 |
+
$customerEmail = $customer->getEmail();
|
25 |
+
} elseif ($order = Mage::registry('current_order')) {
|
26 |
+
$customerEmail = $order->getCustomerEmail();
|
27 |
+
}
|
28 |
+
|
29 |
+
return $customerEmail;
|
30 |
+
}
|
31 |
+
|
32 |
+
public function getCustomerComment()
|
33 |
+
{
|
34 |
+
if (is_null($this->_customerComment)) {
|
35 |
+
$customerEmail = $this->getCustomerEmail();
|
36 |
+
$this->_customerComment = Mage::getModel('alekseon_customerComment/comment')
|
37 |
+
->getCollection()
|
38 |
+
->addFieldToFilter('customer_email', $customerEmail)
|
39 |
+
->getFirstItem();
|
40 |
+
}
|
41 |
+
return $this->_customerComment;
|
42 |
+
}
|
43 |
+
|
44 |
+
protected function _getUrlParams()
|
45 |
+
{
|
46 |
+
if ($customer = Mage::registry('current_customer')) {
|
47 |
+
$params = array('customer_id' => $customer->getId());
|
48 |
+
} elseif ($order = Mage::registry('current_order')) {
|
49 |
+
$params = array('order_id' => $order->getId());
|
50 |
+
}
|
51 |
+
|
52 |
+
return $params;
|
53 |
+
}
|
54 |
+
|
55 |
+
public function getSaveUrl()
|
56 |
+
{
|
57 |
+
return $this->getUrl('*/customerComment/save', $this->_getUrlParams());
|
58 |
+
}
|
59 |
+
|
60 |
+
public function getDeleteUrl()
|
61 |
+
{
|
62 |
+
return $this->getUrl('*/customerComment/delete', $this->_getUrlParams());
|
63 |
+
}
|
64 |
+
|
65 |
+
public function getCustomerCommentTypes()
|
66 |
+
{
|
67 |
+
if (is_null($this->_customerCommentTypes)) {
|
68 |
+
$this->_customerCommentTypes = Mage::helper('alekseon_customerComment')->getCustomerCommentTypes();
|
69 |
+
}
|
70 |
+
|
71 |
+
return $this->_customerCommentTypes;
|
72 |
+
}
|
73 |
+
|
74 |
+
public function getCurrentCommentType()
|
75 |
+
{
|
76 |
+
return $this->getCustomerComment()->getType();
|
77 |
+
}
|
78 |
+
|
79 |
+
public function getCommentTypeClass()
|
80 |
+
{
|
81 |
+
$types = $this->getCustomerCommentTypes();
|
82 |
+
$type = $this->getCurrentCommentType();
|
83 |
+
|
84 |
+
if (isset($types[$type])) {
|
85 |
+
return $types[$type]['class'];
|
86 |
+
} else {
|
87 |
+
return $types[Alekseon_CustomerComment_Helper_Data::COMMENT_TYPE_NEUTRAL]['class'];
|
88 |
+
}
|
89 |
+
}
|
90 |
+
}
|
app/code/community/Alekseon/CustomerComment/Block/Adminhtml/Grid/Renderer/CustomerComment.php
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Marcin Frymark
|
4 |
+
* @email contact@alekseon.com
|
5 |
+
* @company Alekseon
|
6 |
+
* @website www.alekseon.com
|
7 |
+
*/
|
8 |
+
class Alekseon_CustomerComment_Block_Adminhtml_Grid_Renderer_CustomerComment extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
9 |
+
{
|
10 |
+
protected $_commentsArray;
|
11 |
+
|
12 |
+
public function render(Varien_Object $row)
|
13 |
+
{
|
14 |
+
if (is_null($this->_commentsArray)) {
|
15 |
+
$gridCollection = $this->getColumn()->getGrid()->getCollection();
|
16 |
+
$this->_commentsArray = array();
|
17 |
+
|
18 |
+
switch ($this->getColumn()->getGrid()->getId()) {
|
19 |
+
case 'sales_order_grid':
|
20 |
+
$collection = Mage::getModel('sales/order')->getCollection();
|
21 |
+
$emailField = 'customer_email';
|
22 |
+
break;
|
23 |
+
case 'customerGrid':
|
24 |
+
$collection = Mage::getModel('customer/customer')->getCollection();
|
25 |
+
$emailField = 'email';
|
26 |
+
break;
|
27 |
+
}
|
28 |
+
|
29 |
+
$collection->addFieldToFilter('entity_id', $gridCollection->getAllIds());
|
30 |
+
$emails = array();
|
31 |
+
|
32 |
+
foreach($collection as $item) {
|
33 |
+
$emails[$item->getId()] = $item->getData($emailField);
|
34 |
+
}
|
35 |
+
|
36 |
+
$comments = Mage::getModel('alekseon_customerComment/comment')
|
37 |
+
->getCollection()
|
38 |
+
->addFieldToFilter('customer_email', $emails);
|
39 |
+
|
40 |
+
$commentsArray = array();
|
41 |
+
foreach($comments as $comment) {
|
42 |
+
$commentsArray[$comment->getCustomerEmail()] = $comment;
|
43 |
+
}
|
44 |
+
|
45 |
+
foreach ($collection as $item) {
|
46 |
+
if (isset($commentsArray[$emails[$item->getId()]])) {
|
47 |
+
$comment = $commentsArray[$emails[$item->getId()]];
|
48 |
+
$this->_commentsArray[$item->getId()] = $comment->getType();
|
49 |
+
}
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
if (isset($this->_commentsArray[$row->getId()])) {
|
54 |
+
return $this->_commentsArray[$row->getId()];
|
55 |
+
}
|
56 |
+
}
|
57 |
+
}
|
app/code/community/Alekseon/CustomerComment/Block/Adminhtml/Sales/Order/View/Info.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Marcin Frymark
|
4 |
+
* @email contact@alekseon.com
|
5 |
+
* @company Alekseon
|
6 |
+
* @website www.alekseon.com
|
7 |
+
*/
|
8 |
+
class Alekseon_CustomerComment_Block_Adminhtml_Sales_Order_View_Info extends Mage_Adminhtml_Block_Sales_Order_View_Info
|
9 |
+
{
|
10 |
+
public function getCustomerAccountData()
|
11 |
+
{
|
12 |
+
$accountData = parent::getCustomerAccountData();
|
13 |
+
$customerCommentBlock = $this->getLayout()->getBlock('customer_comment_container');
|
14 |
+
|
15 |
+
if ($customerCommentBlock) {
|
16 |
+
$accountData[] = array(
|
17 |
+
'label' => $this->__('Customer Comment'),
|
18 |
+
'value' => $customerCommentBlock->toHtml(),
|
19 |
+
);
|
20 |
+
}
|
21 |
+
return $accountData;
|
22 |
+
}
|
23 |
+
}
|
app/code/community/Alekseon/CustomerComment/Block/Adminhtml/System/Config/Form/Field/AlekseonLogo.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Marcin Frymark
|
4 |
+
* @email contact@alekseon.com
|
5 |
+
* @company Alekseon
|
6 |
+
* @website www.alekseon.com
|
7 |
+
*/
|
8 |
+
class Alekseon_CustomerComment_Block_Adminhtml_System_Config_Form_Field_AlekseonLogo extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface
|
9 |
+
{
|
10 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
11 |
+
{
|
12 |
+
$alekseonUrl = Mage::helper('alekseon_customerComment')->getAlekseonUrl();
|
13 |
+
$createdAtImageUrl = $alekseonUrl . '/images/created_by_alekseon.png';
|
14 |
+
return '<div><a href="' . $alekseonUrl . '" target="_blank"><img src="' . $createdAtImageUrl . '" alt="Created by Alekseon" title="Created by Alekseon" /></a></div>';
|
15 |
+
}
|
16 |
+
}
|
app/code/community/Alekseon/CustomerComment/Block/Adminhtml/System/Config/Form/Field/AlekseonNotification.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Marcin Frymark
|
4 |
+
* @email contact@alekseon.com
|
5 |
+
* @company Alekseon
|
6 |
+
* @website www.alekseon.com
|
7 |
+
*/
|
8 |
+
class Alekseon_CustomerComment_Block_Adminhtml_System_Config_Form_Field_AlekseonNotification extends Mage_Adminhtml_Block_System_Config_Form_Field
|
9 |
+
{
|
10 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
11 |
+
{
|
12 |
+
$element->setValue(Mage::app()->loadCache(Alekseon_CustomerComment_Model_AlekseonAdminNotification_Feed::NOTIFICANTION_LASTCHECK_CACHE_KEY));
|
13 |
+
$format = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
|
14 |
+
return Mage::app()->getLocale()->date(intval($element->getValue()))->toString($format);
|
15 |
+
}
|
16 |
+
}
|
app/code/community/Alekseon/CustomerComment/Helper/Data.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Marcin Frymark
|
4 |
+
* @email contact@alekseon.com
|
5 |
+
* @company Alekseon
|
6 |
+
* @website www.alekseon.com
|
7 |
+
*/
|
8 |
+
class Alekseon_CustomerComment_Helper_Data extends Mage_Core_Helper_Abstract
|
9 |
+
{
|
10 |
+
const COMMENT_TYPE_NEUTRAL = 0;
|
11 |
+
const COMMENT_TYPE_POSITIVE = 1;
|
12 |
+
const COMMENT_TYPE_NEGATIVE = 2;
|
13 |
+
|
14 |
+
public function getAlekseonUrl()
|
15 |
+
{
|
16 |
+
return 'http://www.alekseon.com';
|
17 |
+
}
|
18 |
+
|
19 |
+
public function getCustomerCommentTypes()
|
20 |
+
{
|
21 |
+
return array(
|
22 |
+
self::COMMENT_TYPE_NEUTRAL => array(
|
23 |
+
'label' => $this->__('Neutral'),
|
24 |
+
'class' => 'notice-msg',
|
25 |
+
'grid_class' => 'grid-severity-minor'
|
26 |
+
),
|
27 |
+
self::COMMENT_TYPE_POSITIVE => array(
|
28 |
+
'label' => $this->__('Positive'),
|
29 |
+
'class' => 'success-msg',
|
30 |
+
'grid_class' => 'grid-severity-notice'
|
31 |
+
),
|
32 |
+
self::COMMENT_TYPE_NEGATIVE => array(
|
33 |
+
'label' => $this->__('Negative'),
|
34 |
+
'class' => 'error-msg',
|
35 |
+
'grid_class' => 'grid-severity-critical'
|
36 |
+
),
|
37 |
+
);
|
38 |
+
}
|
39 |
+
}
|
app/code/community/Alekseon/CustomerComment/Model/AlekseonAdminNotification/Feed.php
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Marcin Frymark
|
4 |
+
* @email contact@alekseon.com
|
5 |
+
* @company Alekseon
|
6 |
+
* @website www.alekseon.com
|
7 |
+
*/
|
8 |
+
class Alekseon_CustomerComment_Model_AlekseonAdminNotification_Feed extends Mage_AdminNotification_Model_Feed
|
9 |
+
{
|
10 |
+
const XML_ENABLED_PATH = 'alekseon_adminNotification/general/enabled';
|
11 |
+
const XML_FREQUENCY_PATH = 'alekseon_adminNotification/general/frequency';
|
12 |
+
const NOTIFICANTION_LASTCHECK_CACHE_KEY = 'alekseon_notifications_lastcheck';
|
13 |
+
|
14 |
+
protected $_alekseonInstalledModules;
|
15 |
+
|
16 |
+
public function getFeedUrl()
|
17 |
+
{
|
18 |
+
if (is_null($this->_feedUrl)) {
|
19 |
+
$this->_feedUrl = Mage::helper('alekseon_customerComment')->getAlekseonUrl() . '/rss/magento_rss.xml';
|
20 |
+
$query = '?utm_source=' . urlencode(Mage::getStoreConfig('web/unsecure/base_url'));
|
21 |
+
$query .= '&utm_medium=' . urlencode('Magento Connect');
|
22 |
+
if (method_exists('Mage', 'getEdition')) {
|
23 |
+
$query .= '&utm_content=' . urlencode(Mage::getEdition() . ' ' . Mage::getVersion());
|
24 |
+
} else {
|
25 |
+
$query .= '&utm_content=' . urlencode(Mage::getVersion());
|
26 |
+
}
|
27 |
+
$query .= '&utm_term=' . urlencode(implode(',', $this->_getAlekseonInstalledModules()));
|
28 |
+
|
29 |
+
$this->_feedUrl .= $query;
|
30 |
+
}
|
31 |
+
|
32 |
+
return $this->_feedUrl;
|
33 |
+
}
|
34 |
+
|
35 |
+
public function checkUpdate()
|
36 |
+
{
|
37 |
+
if (!Mage::getStoreConfig(self::XML_ENABLED_PATH)) {
|
38 |
+
return $this;
|
39 |
+
}
|
40 |
+
|
41 |
+
if (($this->getFrequency() + $this->getLastUpdate()) > time()) {
|
42 |
+
return $this;
|
43 |
+
}
|
44 |
+
|
45 |
+
$feedData = array();
|
46 |
+
$feedXml = $this->getFeedData();
|
47 |
+
|
48 |
+
if ($feedXml && $feedXml->channel && $feedXml->channel->item) {
|
49 |
+
foreach ($feedXml->channel->item as $item) {
|
50 |
+
|
51 |
+
$module = (string)$item->module;
|
52 |
+
if ($module && !in_array($module, $this->_getAlekseonInstalledModules())) {
|
53 |
+
continue;
|
54 |
+
}
|
55 |
+
|
56 |
+
$feedData[] = array(
|
57 |
+
'severity' => (int)$item->severity,
|
58 |
+
'date_added' => $this->getDate((string)$item->pubDate),
|
59 |
+
'title' => (string)$item->title,
|
60 |
+
'description' => (string)$item->description,
|
61 |
+
'url' => (string)$item->link,
|
62 |
+
);
|
63 |
+
}
|
64 |
+
|
65 |
+
if ($feedData) {
|
66 |
+
Mage::getModel('adminnotification/inbox')->parse(array_reverse($feedData));
|
67 |
+
}
|
68 |
+
|
69 |
+
}
|
70 |
+
$this->setLastUpdate();
|
71 |
+
|
72 |
+
return $this;
|
73 |
+
}
|
74 |
+
|
75 |
+
public function getLastUpdate()
|
76 |
+
{
|
77 |
+
return Mage::app()->loadCache(self::NOTIFICANTION_LASTCHECK_CACHE_KEY);
|
78 |
+
}
|
79 |
+
|
80 |
+
public function setLastUpdate()
|
81 |
+
{
|
82 |
+
Mage::app()->saveCache(time(), self::NOTIFICANTION_LASTCHECK_CACHE_KEY);
|
83 |
+
return $this;
|
84 |
+
}
|
85 |
+
|
86 |
+
protected function _getAlekseonInstalledModules()
|
87 |
+
{
|
88 |
+
if (is_null($this->_alekseonInstalledModules)) {
|
89 |
+
$modules = array_keys((array)Mage::getConfig()->getNode('modules')->children());
|
90 |
+
$this->_alekseonInstalledModules = array();
|
91 |
+
foreach ($modules as $moduleName) {
|
92 |
+
if (substr($moduleName, 0, 9) == 'Alekseon_'){
|
93 |
+
$this->_alekseonInstalledModules[] = $moduleName;
|
94 |
+
}
|
95 |
+
}
|
96 |
+
}
|
97 |
+
return $this->_alekseonInstalledModules;
|
98 |
+
}
|
99 |
+
}
|
app/code/community/Alekseon/CustomerComment/Model/AlekseonAdminNotification/Observer.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Marcin Frymark
|
4 |
+
* @email contact@alekseon.com
|
5 |
+
* @company Alekseon
|
6 |
+
* @website www.alekseon.com
|
7 |
+
*/
|
8 |
+
class Alekseon_CustomerComment_Model_AlekseonAdminNotification_Observer
|
9 |
+
{
|
10 |
+
public function preDispatch(Varien_Event_Observer $observer)
|
11 |
+
{
|
12 |
+
if (Mage::getSingleton('admin/session')->isLoggedIn()) {
|
13 |
+
$feedModel = Mage::getModel('alekseon_customerComment/alekseonAdminNotification_feed');
|
14 |
+
$feedModel->checkUpdate();
|
15 |
+
}
|
16 |
+
|
17 |
+
}
|
18 |
+
}
|
app/code/community/Alekseon/CustomerComment/Model/Comment.php
ADDED
@@ -0,0 +1 @@
|
|
|
|
0 |
* @author Marcin Frymark
|
1 |
* @email contact@alekseon.com
|
2 |
* @company Alekseon
|
3 |
* @website www.alekseon.com
|
4 |
*/
|
5 |
public function __construct($args = array())
|
6 |
{
|
7 |
}
|
1 |
+
<?php
|
2 |
* @author Marcin Frymark
|
3 |
* @email contact@alekseon.com
|
4 |
* @company Alekseon
|
5 |
* @website www.alekseon.com
|
6 |
*/
|
7 |
public function __construct($args = array())
|
8 |
{
|
9 |
}
|
app/code/community/Alekseon/CustomerComment/Model/Observer.php
ADDED
@@ -0,0 +1 @@
|
|
|
|
0 |
* @author Marcin Frymark
|
1 |
* @email contact@alekseon.com
|
2 |
* @company Alekseon
|
3 |
* @website www.alekseon.com
|
4 |
*/
|
5 |
public function addCustomerCommentColumn(Varien_Event_Observer $observer)
|
6 |
{
|
7 |
$block = $observer->getBlock();
|
8 |
|
9 |
if (!$block instanceof Mage_Adminhtml_Block_Widget_Grid) {
|
10 |
return;
|
11 |
}
|
12 |
switch ($block->getId()) {
|
13 |
case 'sales_order_grid':
|
14 |
if (Mage::getStoreConfig('alekseon_customerComment/general/orders_grid')) {
|
15 |
$this->_addCustomerCommentComment($block, 'status');
|
16 |
}
|
17 |
break;
|
18 |
case 'customerGrid':
|
19 |
if (Mage::getStoreConfig('alekseon_customerComment/general/orders_grid')) {
|
20 |
$this->_addCustomerCommentComment($block, 'email');
|
21 |
}
|
22 |
break;
|
23 |
}
|
24 |
}
|
25 |
|
26 |
protected function _addCustomerCommentComment($block, $afterColumn)
|
27 |
{
|
28 |
$block->addColumnAfter('test', array(
|
29 |
'header' => Mage::helper('alekseon_customerComment')->__('Customer comment'),
|
30 |
'width' => '50px',
|
31 |
'renderer' => 'alekseon_customerComment/adminhtml_grid_renderer_customerComment',
|
32 |
'frame_callback' => array($this, 'decorateCustomerComment'),
|
33 |
'filter' => false,
|
34 |
'sortable' => false,
|
35 |
), $afterColumn);
|
36 |
}
|
37 |
|
38 |
public function decorateCustomerComment($value, $row, $column, $isExport)
|
39 |
{
|
40 |
$customerCommentTypes = Mage::helper('alekseon_customerComment')->getCustomerCommentTypes();
|
41 |
if (isset($customerCommentTypes[$value])) {
|
42 |
$class = $customerCommentTypes[$value]['grid_class'];
|
43 |
$value = $customerCommentTypes[$value]['label'];
|
44 |
if ($isExport) {
|
45 |
$cell = $value;
|
46 |
} else {
|
47 |
$cell = '<span class="' . $class . '"><span>' . $value . '</span></span>';
|
48 |
}
|
49 |
return $cell;
|
50 |
} else {
|
51 |
return $value;
|
52 |
}
|
53 |
}
|
1 |
+
<?php
|
2 |
* @author Marcin Frymark
|
3 |
* @email contact@alekseon.com
|
4 |
* @company Alekseon
|
5 |
* @website www.alekseon.com
|
6 |
*/
|
7 |
public function addCustomerCommentColumn(Varien_Event_Observer $observer)
|
8 |
{
|
9 |
$block = $observer->getBlock();
|
10 |
|
11 |
if (!$block instanceof Mage_Adminhtml_Block_Widget_Grid) {
|
12 |
return;
|
13 |
}
|
14 |
switch ($block->getId()) {
|
15 |
case 'sales_order_grid':
|
16 |
if (Mage::getStoreConfig('alekseon_customerComment/general/orders_grid')) {
|
17 |
$this->_addCustomerCommentComment($block, 'status');
|
18 |
}
|
19 |
break;
|
20 |
case 'customerGrid':
|
21 |
if (Mage::getStoreConfig('alekseon_customerComment/general/orders_grid')) {
|
22 |
$this->_addCustomerCommentComment($block, 'email');
|
23 |
}
|
24 |
break;
|
25 |
}
|
26 |
}
|
27 |
|
28 |
protected function _addCustomerCommentComment($block, $afterColumn)
|
29 |
{
|
30 |
$block->addColumnAfter('test', array(
|
31 |
'header' => Mage::helper('alekseon_customerComment')->__('Customer comment'),
|
32 |
'width' => '50px',
|
33 |
'renderer' => 'alekseon_customerComment/adminhtml_grid_renderer_customerComment',
|
34 |
'frame_callback' => array($this, 'decorateCustomerComment'),
|
35 |
'filter' => false,
|
36 |
'sortable' => false,
|
37 |
), $afterColumn);
|
38 |
}
|
39 |
|
40 |
public function decorateCustomerComment($value, $row, $column, $isExport)
|
41 |
{
|
42 |
$customerCommentTypes = Mage::helper('alekseon_customerComment')->getCustomerCommentTypes();
|
43 |
if (isset($customerCommentTypes[$value])) {
|
44 |
$class = $customerCommentTypes[$value]['grid_class'];
|
45 |
$value = $customerCommentTypes[$value]['label'];
|
46 |
if ($isExport) {
|
47 |
$cell = $value;
|
48 |
} else {
|
49 |
$cell = '<span class="' . $class . '"><span>' . $value . '</span></span>';
|
50 |
}
|
51 |
return $cell;
|
52 |
} else {
|
53 |
return $value;
|
54 |
}
|
55 |
}
|
app/code/community/Alekseon/CustomerComment/Model/Resource/Comment.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Marcin Frymark
|
4 |
+
* @email contact@alekseon.com
|
5 |
+
* @company Alekseon
|
6 |
+
* @website www.alekseon.com
|
7 |
+
*/
|
8 |
+
class Alekseon_CustomerComment_Model_Resource_Comment extends Mage_Core_Model_Resource_Db_Abstract
|
9 |
+
{
|
10 |
+
protected function _construct()
|
11 |
+
{
|
12 |
+
$this->_init('alekseon_customerComment/comment', 'id');
|
13 |
+
}
|
14 |
+
|
15 |
+
}
|
app/code/community/Alekseon/CustomerComment/Model/Resource/Comment/Collection.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Marcin Frymark
|
4 |
+
* @email contact@alekseon.com
|
5 |
+
* @company Alekseon
|
6 |
+
* @website www.alekseon.com
|
7 |
+
*/
|
8 |
+
class Alekseon_CustomerComment_Model_Resource_Comment_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
9 |
+
{
|
10 |
+
protected function _construct()
|
11 |
+
{
|
12 |
+
$this->_init('alekseon_customerComment/comment');
|
13 |
+
}
|
14 |
+
}
|
app/code/community/Alekseon/CustomerComment/controllers/Adminhtml/CustomerCommentController.php
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Marcin Frymark
|
4 |
+
* @email contact@alekseon.com
|
5 |
+
* @company Alekseon
|
6 |
+
* @website www.alekseon.com
|
7 |
+
*/
|
8 |
+
class Alekseon_CustomerComment_Adminhtml_CustomerCommentController extends Mage_Adminhtml_Controller_Action
|
9 |
+
{
|
10 |
+
protected function _getComment()
|
11 |
+
{
|
12 |
+
$customerEmail = false;
|
13 |
+
if ($customerId = $this->getRequest()->getParam('customer_id', false)) {
|
14 |
+
$customerEmail = Mage::getModel('customer/customer')->load($customerId)->getEmail();
|
15 |
+
} elseif ($orderId = $this->getRequest()->getParam('order_id', false)) {
|
16 |
+
$customerEmail = Mage::getModel('sales/order')->load($orderId)->getCustomerEmail();
|
17 |
+
}
|
18 |
+
if (!$customerEmail) {
|
19 |
+
Mage::throwException($this->__('Cannot save comment for empty email address.'));
|
20 |
+
}
|
21 |
+
$comment = Mage::getModel('alekseon_customerComment/comment')
|
22 |
+
->getCollection()
|
23 |
+
->addFieldToFilter('customer_email', $customerEmail)
|
24 |
+
->getFirstItem();
|
25 |
+
|
26 |
+
if (!$comment->getId()) {
|
27 |
+
$comment->setCustomerEmail($customerEmail);
|
28 |
+
}
|
29 |
+
|
30 |
+
return $comment;
|
31 |
+
}
|
32 |
+
|
33 |
+
protected function _getCustomerCommentHtml($comment = null)
|
34 |
+
{
|
35 |
+
$this->loadLayout();
|
36 |
+
$customerCommentBlock = $this->getLayout()->getBlock('customer_comment');
|
37 |
+
$customerCommentBlock->setComment($comment);
|
38 |
+
|
39 |
+
if (!$customerCommentBlock) {
|
40 |
+
Mage::throwException($this->__('Customer Comment block has not be founded.'));
|
41 |
+
}
|
42 |
+
|
43 |
+
return $customerCommentBlock->toHtml();
|
44 |
+
}
|
45 |
+
|
46 |
+
public function saveAction()
|
47 |
+
{
|
48 |
+
$result = array();
|
49 |
+
try {
|
50 |
+
$comment = $this->_getComment();
|
51 |
+
|
52 |
+
$commentType = $this->getRequest()->getParam('type', 0);
|
53 |
+
$commentText = $this->getRequest()->getParam('comment', '');
|
54 |
+
$commentText = trim($commentText);
|
55 |
+
|
56 |
+
$comment->setType($commentType);
|
57 |
+
$comment->setComment($commentText);
|
58 |
+
$comment->save();
|
59 |
+
$result['commentBlockHtml'] = $this->_getCustomerCommentHtml($comment);
|
60 |
+
} catch(Exception $e) {
|
61 |
+
$result['errorMsg'] = $e->getMessage();
|
62 |
+
}
|
63 |
+
|
64 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
65 |
+
}
|
66 |
+
|
67 |
+
public function deleteAction()
|
68 |
+
{
|
69 |
+
$result = array();
|
70 |
+
try {
|
71 |
+
$comment = $this->_getComment();
|
72 |
+
$comment->delete();
|
73 |
+
$result['commentBlockHtml'] = $this->_getCustomerCommentHtml();
|
74 |
+
} catch(Exception $e) {
|
75 |
+
$result['errorMsg'] = $e->getMessage();
|
76 |
+
}
|
77 |
+
|
78 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
79 |
+
}
|
80 |
+
}
|
app/code/community/Alekseon/CustomerComment/etc/adminhtml.xml
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @author Marcin Frymark
|
5 |
+
* @email contact@alekseon.com
|
6 |
+
* @company Alekseon
|
7 |
+
* @website www.alekseon.com
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<acl>
|
12 |
+
<resources>
|
13 |
+
<admin>
|
14 |
+
<children>
|
15 |
+
<system>
|
16 |
+
<children>
|
17 |
+
<config>
|
18 |
+
<children>
|
19 |
+
<alekseon_adminNotification translate="title" module="alekseon_customerComment">
|
20 |
+
<title>Alekseon Notifications</title>
|
21 |
+
<sort_order>10</sort_order>
|
22 |
+
</alekseon_adminNotification>
|
23 |
+
<alekseon_customerComment translate="title" module="alekseon_customerComment">
|
24 |
+
<title>Customer Comment</title>
|
25 |
+
<sort_order>40</sort_order>
|
26 |
+
</alekseon_customerComment>
|
27 |
+
</children>
|
28 |
+
</config>
|
29 |
+
</children>
|
30 |
+
</system>
|
31 |
+
</children>
|
32 |
+
</admin>
|
33 |
+
</resources>
|
34 |
+
</acl>
|
35 |
+
</config>
|
app/code/community/Alekseon/CustomerComment/etc/config.xml
ADDED
@@ -0,0 +1 @@
|
|
|
|
0 |
* @author Marcin Frymark
|
1 |
* @email contact@alekseon.com
|
2 |
* @company Alekseon
|
3 |
* @website www.alekseon.com
|
4 |
*/
|
5 |
-
->
|
6 |
<modules>
|
7 |
<Alekseon_CustomerComment>
|
8 |
<version>0.1.0</version>
|
9 |
</Alekseon_CustomerComment>
|
10 |
</modules>
|
11 |
<global>
|
12 |
<models>
|
13 |
<alekseon_customerComment>
|
14 |
<class>Alekseon_CustomerComment_Model</class>
|
15 |
<resourceModel>alekseon_customercomment_resource</resourceModel>
|
16 |
</alekseon_customerComment>
|
17 |
<alekseon_customercomment_resource>
|
18 |
<class>Alekseon_CustomerComment_Model_Resource</class>
|
19 |
<comment>
|
20 |
<table>alekseon_customercomment_comment</table>
|
21 |
</comment>
|
22 |
</entities>
|
23 |
</alekseon_customercomment_resource>
|
24 |
</models>
|
25 |
<blocks>
|
26 |
<alekseon_customerComment>
|
27 |
<class>Alekseon_CustomerComment_Block</class>
|
28 |
</alekseon_customerComment>
|
29 |
<adminhtml>
|
30 |
<rewrite>
|
31 |
<sales_order_view_info>Alekseon_CustomerComment_Block_Adminhtml_Sales_Order_View_Info</sales_order_view_info>
|
32 |
</rewrite>
|
33 |
</adminhtml>
|
34 |
</blocks>
|
35 |
<helpers>
|
36 |
<alekseon_customerComment>
|
37 |
<class>Alekseon_CustomerComment_Helper</class>
|
38 |
</alekseon_customerComment>
|
39 |
</helpers>
|
40 |
<resources>
|
41 |
<alekseon_customercomment_setup>
|
42 |
<setup>
|
43 |
<module>Alekseon_CustomerComment</module>
|
44 |
<class>Mage_Core_Model_Resource_Setup</class>
|
45 |
</setup>
|
46 |
</alekseon_customercomment_setup>
|
47 |
</resources>
|
48 |
</global>
|
49 |
<adminhtml>
|
50 |
<layout>
|
51 |
<updates>
|
52 |
<alekseon_customerComment>
|
53 |
<file>alekseon/customerComment.xml</file>
|
54 |
</alekseon_customerComment>
|
55 |
</updates>
|
56 |
</layout>
|
57 |
<events>
|
58 |
<core_block_abstract_to_html_before>
|
59 |
<observers>
|
60 |
<alekseon_customerComment>
|
61 |
<class>alekseon_customerComment/observer</class>
|
62 |
<method>addCustomerCommentColumn</method>
|
63 |
</alekseon_customerComment>
|
64 |
</observers>
|
65 |
</core_block_abstract_to_html_before>
|
66 |
<controller_action_predispatch>
|
67 |
<observers>
|
68 |
<alekseon_adminNotification>
|
69 |
<class>alekseon_customerComment/alekseonAdminNotification_observer</class>
|
70 |
<method>preDispatch</method>
|
71 |
</alekseon_adminNotification>
|
72 |
</observers>
|
73 |
</controller_action_predispatch>
|
74 |
</events>
|
75 |
</adminhtml>
|
76 |
<admin>
|
77 |
<routers>
|
78 |
<adminhtml>
|
79 |
<args>
|
80 |
<modules>
|
81 |
<alekseon_customerComment before="Mage_Adminhtml">Alekseon_CustomerComment_Adminhtml</alekseon_customerComment>
|
82 |
</modules>
|
83 |
</args>
|
84 |
</adminhtml>
|
85 |
</routers>
|
86 |
</admin>
|
87 |
<default>
|
88 |
<alekseon_adminNotification>
|
89 |
<general>
|
90 |
<enabled>1</enabled>
|
91 |
<frequency>12</frequency>
|
92 |
</general>
|
93 |
</alekseon_adminNotification>
|
94 |
</default>
|
1 |
+
<?xml version="1.0"?>
|
2 |
* @author Marcin Frymark
|
3 |
* @email contact@alekseon.com
|
4 |
* @company Alekseon
|
5 |
* @website www.alekseon.com
|
6 |
*/
|
|
|
7 |
<modules>
|
8 |
<Alekseon_CustomerComment>
|
9 |
<version>0.1.0</version>
|
10 |
</Alekseon_CustomerComment>
|
11 |
</modules>
|
12 |
<global>
|
13 |
<models>
|
14 |
<alekseon_customerComment>
|
15 |
<class>Alekseon_CustomerComment_Model</class>
|
16 |
<resourceModel>alekseon_customercomment_resource</resourceModel>
|
17 |
</alekseon_customerComment>
|
18 |
<alekseon_customercomment_resource>
|
19 |
<class>Alekseon_CustomerComment_Model_Resource</class>
|
20 |
<comment>
|
21 |
<table>alekseon_customercomment_comment</table>
|
22 |
</comment>
|
23 |
</entities>
|
24 |
</alekseon_customercomment_resource>
|
25 |
</models>
|
26 |
<blocks>
|
27 |
<alekseon_customerComment>
|
28 |
<class>Alekseon_CustomerComment_Block</class>
|
29 |
</alekseon_customerComment>
|
30 |
<adminhtml>
|
31 |
<rewrite>
|
32 |
<sales_order_view_info>Alekseon_CustomerComment_Block_Adminhtml_Sales_Order_View_Info</sales_order_view_info>
|
33 |
</rewrite>
|
34 |
</adminhtml>
|
35 |
</blocks>
|
36 |
<helpers>
|
37 |
<alekseon_customerComment>
|
38 |
<class>Alekseon_CustomerComment_Helper</class>
|
39 |
</alekseon_customerComment>
|
40 |
</helpers>
|
41 |
<resources>
|
42 |
<alekseon_customercomment_setup>
|
43 |
<setup>
|
44 |
<module>Alekseon_CustomerComment</module>
|
45 |
<class>Mage_Core_Model_Resource_Setup</class>
|
46 |
</setup>
|
47 |
</alekseon_customercomment_setup>
|
48 |
</resources>
|
49 |
</global>
|
50 |
<adminhtml>
|
51 |
<layout>
|
52 |
<updates>
|
53 |
<alekseon_customerComment>
|
54 |
<file>alekseon/customerComment.xml</file>
|
55 |
</alekseon_customerComment>
|
56 |
</updates>
|
57 |
</layout>
|
58 |
<events>
|
59 |
<core_block_abstract_to_html_before>
|
60 |
<observers>
|
61 |
<alekseon_customerComment>
|
62 |
<class>alekseon_customerComment/observer</class>
|
63 |
<method>addCustomerCommentColumn</method>
|
64 |
</alekseon_customerComment>
|
65 |
</observers>
|
66 |
</core_block_abstract_to_html_before>
|
67 |
<controller_action_predispatch>
|
68 |
<observers>
|
69 |
<alekseon_adminNotification>
|
70 |
<class>alekseon_customerComment/alekseonAdminNotification_observer</class>
|
71 |
<method>preDispatch</method>
|
72 |
</alekseon_adminNotification>
|
73 |
</observers>
|
74 |
</controller_action_predispatch>
|
75 |
</events>
|
76 |
</adminhtml>
|
77 |
<admin>
|
78 |
<routers>
|
79 |
<adminhtml>
|
80 |
<args>
|
81 |
<modules>
|
82 |
<alekseon_customerComment before="Mage_Adminhtml">Alekseon_CustomerComment_Adminhtml</alekseon_customerComment>
|
83 |
</modules>
|
84 |
</args>
|
85 |
</adminhtml>
|
86 |
</routers>
|
87 |
</admin>
|
88 |
<default>
|
89 |
<alekseon_adminNotification>
|
90 |
<general>
|
91 |
<enabled>1</enabled>
|
92 |
<frequency>12</frequency>
|
93 |
</general>
|
94 |
</alekseon_adminNotification>
|
95 |
</default>
|
app/code/community/Alekseon/CustomerComment/etc/system.xml
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @author Marcin Frymark
|
5 |
+
* @email contact@alekseon.com
|
6 |
+
* @company Alekseon
|
7 |
+
* @website www.alekseon.com
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<tabs>
|
12 |
+
<alekseon>
|
13 |
+
<label>Alekseon</label>
|
14 |
+
<sort_order>450</sort_order>
|
15 |
+
</alekseon>
|
16 |
+
</tabs>
|
17 |
+
<sections>
|
18 |
+
<alekseon_adminNotification translate="label" module="alekseon_customerComment">
|
19 |
+
<label>Alekseon Notifications</label>
|
20 |
+
<tab>alekseon</tab>
|
21 |
+
<frontend_type>text</frontend_type>
|
22 |
+
<sort_order>10</sort_order>
|
23 |
+
<show_in_default>1</show_in_default>
|
24 |
+
<show_in_website>0</show_in_website>
|
25 |
+
<show_in_store>0</show_in_store>
|
26 |
+
<groups>
|
27 |
+
<hint>
|
28 |
+
<frontend_model>alekseon_customerComment/adminhtml_system_config_form_field_alekseonLogo</frontend_model>
|
29 |
+
<sort_order>0</sort_order>
|
30 |
+
<show_in_default>1</show_in_default>
|
31 |
+
<show_in_website>1</show_in_website>
|
32 |
+
<show_in_store>1</show_in_store>
|
33 |
+
</hint>
|
34 |
+
<general translate="label">
|
35 |
+
<label>General Options</label>
|
36 |
+
<frontend_type>text</frontend_type>
|
37 |
+
<sort_order>10</sort_order>
|
38 |
+
<show_in_default>1</show_in_default>
|
39 |
+
<show_in_website>0</show_in_website>
|
40 |
+
<show_in_store>0</show_in_store>
|
41 |
+
<fields>
|
42 |
+
<enabled translate="label">
|
43 |
+
<label>Enabled</label>
|
44 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
45 |
+
<frontend_type>select</frontend_type>
|
46 |
+
<sort_order>10</sort_order>
|
47 |
+
<show_in_default>1</show_in_default>
|
48 |
+
<show_in_website>0</show_in_website>
|
49 |
+
<show_in_store>0</show_in_store>
|
50 |
+
</enabled>
|
51 |
+
<frequency translate="label">
|
52 |
+
<label>Update Frequency</label>
|
53 |
+
<frontend_type>select</frontend_type>
|
54 |
+
<source_model>adminhtml/system_config_source_notification_frequency</source_model>
|
55 |
+
<sort_order>20</sort_order>
|
56 |
+
<show_in_default>1</show_in_default>
|
57 |
+
<show_in_website>0</show_in_website>
|
58 |
+
<show_in_store>0</show_in_store>
|
59 |
+
</frequency>
|
60 |
+
<last_update translate="label">
|
61 |
+
<label>Last Update</label>
|
62 |
+
<frontend_type>label</frontend_type>
|
63 |
+
<frontend_model>alekseon_customerComment/adminhtml_system_config_form_field_alekseonNotification</frontend_model>
|
64 |
+
<sort_order>30</sort_order>
|
65 |
+
<show_in_default>1</show_in_default>
|
66 |
+
<show_in_website>0</show_in_website>
|
67 |
+
<show_in_store>0</show_in_store>
|
68 |
+
</last_update>
|
69 |
+
</fields>
|
70 |
+
</general>
|
71 |
+
</groups>
|
72 |
+
</alekseon_adminNotification>
|
73 |
+
<alekseon_customerComment translate="label" module="alekseon_customerComment">
|
74 |
+
<label>Customer Comment</label>
|
75 |
+
<tab>alekseon</tab>
|
76 |
+
<frontend_type>text</frontend_type>
|
77 |
+
<sort_order>30</sort_order>
|
78 |
+
<show_in_default>1</show_in_default>
|
79 |
+
<show_in_website>1</show_in_website>
|
80 |
+
<show_in_store>1</show_in_store>
|
81 |
+
<groups>
|
82 |
+
<hint>
|
83 |
+
<frontend_model>alekseon_customerComment/adminhtml_system_config_form_field_alekseonLogo</frontend_model>
|
84 |
+
<sort_order>0</sort_order>
|
85 |
+
<show_in_default>1</show_in_default>
|
86 |
+
<show_in_website>1</show_in_website>
|
87 |
+
<show_in_store>1</show_in_store>
|
88 |
+
</hint>
|
89 |
+
<general translate="label">
|
90 |
+
<label>Customer Comment Settings</label>
|
91 |
+
<frontend_type>text</frontend_type>
|
92 |
+
<sort_order>10</sort_order>
|
93 |
+
<show_in_default>1</show_in_default>
|
94 |
+
<show_in_website>1</show_in_website>
|
95 |
+
<show_in_store>1</show_in_store>
|
96 |
+
<fields>
|
97 |
+
<orders_grid translate="label comment">
|
98 |
+
<label>Customer Comment column on orders grid</label>
|
99 |
+
<frontend_type>select</frontend_type>
|
100 |
+
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
101 |
+
<sort_order>10</sort_order>
|
102 |
+
<show_in_default>1</show_in_default>
|
103 |
+
<show_in_website>0</show_in_website>
|
104 |
+
<show_in_store>0</show_in_store>
|
105 |
+
</orders_grid>
|
106 |
+
<customers_grid translate="label comment">
|
107 |
+
<label>Customer Comment column on customers grid</label>
|
108 |
+
<frontend_type>select</frontend_type>
|
109 |
+
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
110 |
+
<sort_order>20</sort_order>
|
111 |
+
<show_in_default>1</show_in_default>
|
112 |
+
<show_in_website>0</show_in_website>
|
113 |
+
<show_in_store>0</show_in_store>
|
114 |
+
</customers_grid>
|
115 |
+
</fields>
|
116 |
+
</general>
|
117 |
+
</groups>
|
118 |
+
</alekseon_customerComment>
|
119 |
+
</sections>
|
120 |
+
</config>
|
app/code/community/Alekseon/CustomerComment/sql/alekseon_customercomment_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Marcin Frymark
|
4 |
+
* @email contact@alekseon.com
|
5 |
+
* @company Alekseon
|
6 |
+
* @website www.alekseon.com
|
7 |
+
*/
|
8 |
+
|
9 |
+
$installer = $this;
|
10 |
+
$installer->startSetup();
|
11 |
+
$installer->run("
|
12 |
+
|
13 |
+
CREATE TABLE {$this->getTable('alekseon_customerComment/comment')} (
|
14 |
+
`id` int(10) unsigned NOT NULL auto_increment,
|
15 |
+
`type` smallint(5) unsigned NOT NULL default '0',
|
16 |
+
`customer_email` varchar(255),
|
17 |
+
`comment` text NOT NULL default '',
|
18 |
+
PRIMARY KEY (`id`)
|
19 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
20 |
+
|
21 |
+
");
|
22 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/alekseon/customerComment.xml
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @author Marcin Frymark
|
5 |
+
* @email contact@alekseon.com
|
6 |
+
* @company Alekseon
|
7 |
+
* @website www.alekseon.com
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<layout>
|
11 |
+
<adminhtml_sales_order_view>
|
12 |
+
<reference name="head">
|
13 |
+
<action method="addItem"><type>skin_js</type><name>js/alekseon/customerComment.js</name></action>
|
14 |
+
</reference>
|
15 |
+
<block type="adminhtml/template" name="customer_comment_container" template="alekseon/customerComment/comment/container.phtml">
|
16 |
+
<block type="alekseon_customerComment/adminhtml_comment" name="customer_comment" template="alekseon/customerComment/comment.phtml"></block>
|
17 |
+
</block>
|
18 |
+
</adminhtml_sales_order_view>
|
19 |
+
|
20 |
+
<adminhtml_customer_edit>
|
21 |
+
<reference name="head">
|
22 |
+
<action method="addItem"><type>skin_js</type><name>js/alekseon/customerComment.js</name></action>
|
23 |
+
</reference>
|
24 |
+
<reference name="customer_edit_tab_view">
|
25 |
+
<block type="adminhtml/template" name="customer_comment_tab" template="alekseon/customerComment/customertab.phtml" before="-">
|
26 |
+
<block type="adminhtml/template" name="customer_comment_container" template="alekseon/customerComment/comment/container.phtml">
|
27 |
+
<block type="alekseon_customerComment/adminhtml_comment" name="customer_comment" template="alekseon/customerComment/comment.phtml"></block>
|
28 |
+
</block>
|
29 |
+
</block>
|
30 |
+
</reference>
|
31 |
+
</adminhtml_customer_edit>
|
32 |
+
|
33 |
+
<adminhtml_customercomment_save>
|
34 |
+
<block type="alekseon_customerComment/adminhtml_comment" name="customer_comment" template="alekseon/customerComment/comment.phtml"></block>
|
35 |
+
</adminhtml_customercomment_save>
|
36 |
+
|
37 |
+
<adminhtml_customercomment_delete>
|
38 |
+
<block type="alekseon_customerComment/adminhtml_comment" name="customer_comment" template="alekseon/customerComment/comment.phtml"></block>
|
39 |
+
</adminhtml_customercomment_delete>
|
40 |
+
</layout>
|
app/design/adminhtml/default/default/template/alekseon/customerComment/comment.phtml
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Marcin Frymark
|
4 |
+
* @email contact@alekseon.com
|
5 |
+
* @company Alekseon
|
6 |
+
* @website www.alekseon.com
|
7 |
+
*/
|
8 |
+
?>
|
9 |
+
<?php if (!$this->getCustomerComment()->getId()): ?>
|
10 |
+
<ul>
|
11 |
+
<li id="customer_comment">
|
12 |
+
<button type="button" class="add" onclick="customerComment.editComment()">
|
13 |
+
<span><?php echo $this->__('Add Comment') ?></span>
|
14 |
+
</button>
|
15 |
+
</li>
|
16 |
+
</ul>
|
17 |
+
<?php endif ?>
|
18 |
+
<ul class="messages">
|
19 |
+
<?php if ($this->getCustomerComment()->getId()): ?>
|
20 |
+
<li id="customer_comment" class="<?php echo $this->getCommentTypeClass() ?>">
|
21 |
+
<?php echo nl2br($this->getCustomerComment()->getComment()) ?>
|
22 |
+
<div id="edit_button">
|
23 |
+
<button type="button" onclick="customerComment.editComment()">
|
24 |
+
<span><?php echo $this->__('Edit Comment') ?></span>
|
25 |
+
</button>
|
26 |
+
</div>
|
27 |
+
</li>
|
28 |
+
<?php endif ?>
|
29 |
+
<li id="customer_comment_edit" class="<?php echo $this->getCommentTypeClass() ?>" style="display: none">
|
30 |
+
<select name="type" onChange="customerComment.changeCommentType(this)">
|
31 |
+
<?php foreach($this->getCustomerCommentTypes() as $commentId => $commentType): ?>
|
32 |
+
<option value="<?php echo $commentId ?>" typeclass="<?php echo $commentType['class'] ?>" <?php if ($commentId == $this->getCurrentCommentType()) { echo 'selected'; } ?>>
|
33 |
+
<?php echo $commentType['label'] ?>
|
34 |
+
</option>
|
35 |
+
<?php endforeach ?>
|
36 |
+
</select>
|
37 |
+
<br />
|
38 |
+
<textarea name="comment"><?php echo $this->getCustomerComment()->getComment() ?></textarea>
|
39 |
+
<br />
|
40 |
+
<button type="button" class="back" onclick="customerComment.cancelEdition()">
|
41 |
+
<span><?php echo $this->__('Back') ?></span>
|
42 |
+
</button>
|
43 |
+
<button type="button" class="save" onclick="customerComment.saveComment()">
|
44 |
+
<span><?php echo $this->__('Save') ?></span>
|
45 |
+
</button>
|
46 |
+
<?php if ($this->getCustomerComment()->getId()): ?>
|
47 |
+
<button type="button" class="delete" onclick="customerComment.deleteComment()">
|
48 |
+
<span><?php echo $this->__('Delete') ?></span>
|
49 |
+
</button>
|
50 |
+
<?php endif ?>
|
51 |
+
</li>
|
52 |
+
</ul>
|
app/design/adminhtml/default/default/template/alekseon/customerComment/comment/container.phtml
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Marcin Frymark
|
4 |
+
* @email contact@alekseon.com
|
5 |
+
* @company Alekseon
|
6 |
+
* @website www.alekseon.com
|
7 |
+
*/
|
8 |
+
?>
|
9 |
+
<div id="customer_comment_container">
|
10 |
+
<?php echo $this->getChildHtml('customer_comment') ?>
|
11 |
+
</div>
|
12 |
+
<script type="text/javascript">
|
13 |
+
//<![CDATA[
|
14 |
+
var customerComment = new CustomerComment(
|
15 |
+
'<?php echo $this->getChild('customer_comment')->getSaveUrl() ?>',
|
16 |
+
'<?php echo $this->getChild('customer_comment')->getDeleteUrl() ?>',
|
17 |
+
$('customer_comment_container'),
|
18 |
+
'<?php echo $this->__('Are you sure ?') ?>'
|
19 |
+
);
|
20 |
+
//]]>
|
21 |
+
</script>
|
app/design/adminhtml/default/default/template/alekseon/customerComment/customertab.phtml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Marcin Frymark
|
4 |
+
* @email contact@alekseon.com
|
5 |
+
* @company Alekseon
|
6 |
+
* @website www.alekseon.com
|
7 |
+
*/
|
8 |
+
?>
|
9 |
+
<div class="entry-edit">
|
10 |
+
<div class="entry-edit-head"><h4 class="icon-head"><?php echo Mage::helper('alekseon_customerComment')->__('Customer Comment') ?></h4></div>
|
11 |
+
<fieldset>
|
12 |
+
<table class="form-list">
|
13 |
+
<tr>
|
14 |
+
<td class="value">
|
15 |
+
<?php echo $this->getChildHtml('customer_comment_container') ?>
|
16 |
+
</td>
|
17 |
+
</tr>
|
18 |
+
</table>
|
19 |
+
</fieldset>
|
20 |
+
</div>
|
app/etc/modules/Alekseon_CustomerComment.xml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @author Marcin Frymark
|
5 |
+
* @email contact@alekseon.com
|
6 |
+
* @company Alekseon
|
7 |
+
* @website www.alekseon.com
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<modules>
|
12 |
+
<Alekseon_CustomerComment>
|
13 |
+
<active>true</active>
|
14 |
+
<codePool>community</codePool>
|
15 |
+
</Alekseon_CustomerComment>
|
16 |
+
</modules>
|
17 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>customer_comment</name>
|
4 |
+
<version>0.1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Add comment to customer.</summary>
|
10 |
+
<description>Add comment to customer.</description>
|
11 |
+
<notes>Add comment to customer.</notes>
|
12 |
+
<authors><author><name>Marcin Frymark</name><user>Alekseon</user><email>contact@alekseon.com</email></author></authors>
|
13 |
+
<date>2014-06-29</date>
|
14 |
+
<time>19:23:02</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Alekseon"><dir name="CustomerComment"><dir><dir name="Block"><dir name="Adminhtml"><file name="Comment.php" hash="b58ed1194f0bf5ff858a1309ec38eaf6"/><dir name="Grid"><dir name="Renderer"><file name="CustomerComment.php" hash="13ad5cbb17bf2fb74d2a7694b0e3c277"/></dir></dir><dir name="Sales"><dir name="Order"><dir name="View"><file name="Info.php" hash="0bb337cba751e21b86c7153d9e1303a8"/></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="AlekseonLogo.php" hash="999a8a8f5786e4fee1725b6bc27f991b"/><file name="AlekseonNotification.php" hash="1b9f50d4ab652bd75973fb8a1ac9000c"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="61c1609a341b88034b7627215db3a1d0"/></dir><dir name="Model"><dir name="AlekseonAdminNotification"><file name="Feed.php" hash="6db32c87090834f230648b08e404eef1"/><file name="Observer.php" hash="65f49d079f0b25cd1621e4a238214255"/></dir><file name="Comment.php" hash="16afdff4844fd8d016b4187cde41bb5b"/><file name="Observer.php" hash="3fb2d307300a8bec762d7a2aa864e575"/><dir name="Resource"><dir name="Comment"><file name="Collection.php" hash="8f47c6f30902eedd16393b0e8028cf8c"/></dir><file name="Comment.php" hash="623673fbd0228d540b0cf8f30e783503"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="CustomerCommentController.php" hash="5d1c65317153d400ffb01ad8b706f6b4"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="924ba1e49d203bcf698c3f8ddd610ae4"/><file name="config.xml" hash="3d6de258a051a477ef0b0c9b118ebe88"/><file name="system.xml" hash="d20c23d676f2df5dd8c556a61d216890"/></dir><dir name="sql"><dir name="alekseon_customercomment_setup"><file name="mysql4-install-0.1.0.php" hash="ee1a373950ca5e7410f2775cd15f6502"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Alekseon_CustomerComment.xml" hash="a8072b3313fae6b8f663764c4983475e"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="alekseon"><dir name="customerComment"><dir name="comment"><file name="container.phtml" hash="daf5924647619435bbddcd50600dbbe5"/></dir><file name="comment.phtml" hash="7232c8ee1d36adcbfaf7fff8cdb292da"/><file name="customertab.phtml" hash="2a4132a21be5e342a687c7398590a65b"/></dir></dir></dir><dir name="layout"><dir name="alekseon"><file name="customerComment.xml" hash="18aac54b44fa1ca398f5dfc26e262b55"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="js"><dir name="alekseon"><file name="customerComment.js" hash="43e6cba9cad38d3a173b79ff6b1ce75f"/></dir></dir></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|
skin/adminhtml/default/default/js/alekseon/customerComment.js
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* @author Marcin Frymark
|
3 |
+
* @email contact@alekseon.com
|
4 |
+
* @company Alekseon
|
5 |
+
* @website www.alekseon.com
|
6 |
+
*/
|
7 |
+
var CustomerComment = Class.create();
|
8 |
+
CustomerComment.prototype = {
|
9 |
+
|
10 |
+
initialize: function(saveUrl, deleteUrl, customerCommentContainer, deleteConfirmationMessage) {
|
11 |
+
this.onSave = this.saveSuccess.bindAsEventListener(this);
|
12 |
+
this.onFailure = this.saveFailure.bindAsEventListener(this);
|
13 |
+
this.form = $('customer_comment_edit');
|
14 |
+
this.saveUrl = saveUrl;
|
15 |
+
this.deleteUrl = deleteUrl;
|
16 |
+
this.customerCommentContainer = customerCommentContainer;
|
17 |
+
this.deleteConfirmationMessage = deleteConfirmationMessage;
|
18 |
+
},
|
19 |
+
|
20 |
+
editComment: function() {
|
21 |
+
$('customer_comment').hide();
|
22 |
+
$('customer_comment_edit').show();
|
23 |
+
},
|
24 |
+
|
25 |
+
changeCommentType: function(select) {
|
26 |
+
var newType = select.options[select.selectedIndex].getAttribute('typeclass');
|
27 |
+
$('customer_comment_edit').setAttribute('class', '');
|
28 |
+
$('customer_comment_edit').addClassName(newType);
|
29 |
+
},
|
30 |
+
|
31 |
+
cancelEdition: function() {
|
32 |
+
$('customer_comment_edit').hide();
|
33 |
+
$('customer_comment').show();
|
34 |
+
},
|
35 |
+
|
36 |
+
saveComment: function() {
|
37 |
+
var request = new Ajax.Request(
|
38 |
+
this.saveUrl,
|
39 |
+
{
|
40 |
+
loaderArea: true,
|
41 |
+
method: 'post',
|
42 |
+
onComplete: '',
|
43 |
+
onSuccess: this.onSave,
|
44 |
+
onFailure: this.onFailure,
|
45 |
+
evalScripts: true,
|
46 |
+
parameters: Form.serialize(this.form)
|
47 |
+
}
|
48 |
+
);
|
49 |
+
},
|
50 |
+
|
51 |
+
deleteComment: function() {
|
52 |
+
var confirmation = confirm(this.deleteConfirmationMessage);
|
53 |
+
|
54 |
+
if (confirmation) {
|
55 |
+
var request = new Ajax.Request(
|
56 |
+
this.deleteUrl,
|
57 |
+
{
|
58 |
+
loaderArea: true,
|
59 |
+
method: 'post',
|
60 |
+
onComplete: '',
|
61 |
+
onSuccess: this.onSave,
|
62 |
+
onFailure: this.onFailure,
|
63 |
+
evalScripts: true,
|
64 |
+
parameters: Form.serialize(this.form)
|
65 |
+
}
|
66 |
+
);
|
67 |
+
}
|
68 |
+
},
|
69 |
+
|
70 |
+
saveSuccess: function(transport) {
|
71 |
+
var response = false;
|
72 |
+
var commentBlockHtml = false;
|
73 |
+
|
74 |
+
if (transport.responseText) {
|
75 |
+
response = eval('(' + transport.responseText + ')');
|
76 |
+
commentBlockHtml = response.commentBlockHtml;
|
77 |
+
}
|
78 |
+
|
79 |
+
if (commentBlockHtml) {
|
80 |
+
this.customerCommentContainer.innerHTML = commentBlockHtml;
|
81 |
+
this.form = $('customer_comment_edit');
|
82 |
+
} else {
|
83 |
+
alert(response.errorMsg);
|
84 |
+
}
|
85 |
+
},
|
86 |
+
|
87 |
+
saveFailure: function(transport){
|
88 |
+
alert(this.failureMsg);
|
89 |
+
}
|
90 |
+
}
|