Cdr_OrderComment - Version 0.0.6

Version Notes

Added a config option for the Order Comment title

Download this release

Release Info

Developer Cdr
Extension Cdr_OrderComment
Version 0.0.6
Comparing to
See all releases


Code changes from version 0.0.5 to 0.0.6

app/code/community/Cdr/OrderComment/Block/Checkout/Onepage/Review/Commentfield.php CHANGED
@@ -1,31 +1,30 @@
1
  <?php
2
 
3
-
4
  class Cdr_OrderComment_Block_Checkout_Onepage_Review_Commentfield extends Mage_Core_Block_Template
5
  {
6
 
7
  public function getMaxCommentSize()
8
  {
9
- if ($this->limitTextArea())
10
- {
11
- return Mage::getStoreConfig('ordercomment/settings/limit');
12
  }
13
  return '';
14
  }
15
-
16
  public function limitTextArea()
17
  {
18
  $limit = Mage::getStoreConfig('ordercomment/settings/limit');
19
  return (is_numeric($limit) && $limit > 0);
20
  }
21
-
22
- public function isActive($type = 'default')
23
  {
24
- $active = Mage::getStoreConfigFlag('ordercomment/settings/active');
25
- if($active) {
26
- $active = (Mage::getStoreConfigFlag('opc/global/status') && $type == 'iwd') ||
27
- (!Mage::getStoreConfigFlag('opc/global/status') && $type != 'iwd');
28
- }
29
- return $active;
30
  }
 
 
 
 
 
 
31
  }
1
  <?php
2
 
 
3
  class Cdr_OrderComment_Block_Checkout_Onepage_Review_Commentfield extends Mage_Core_Block_Template
4
  {
5
 
6
  public function getMaxCommentSize()
7
  {
8
+ if ($this->limitTextArea()) {
9
+ return Mage::getStoreConfig('ordercomment/settings/limit');
 
10
  }
11
  return '';
12
  }
13
+
14
  public function limitTextArea()
15
  {
16
  $limit = Mage::getStoreConfig('ordercomment/settings/limit');
17
  return (is_numeric($limit) && $limit > 0);
18
  }
19
+
20
+ public function isActive()
21
  {
22
+ return Mage::getStoreConfigFlag('ordercomment/settings/active');
 
 
 
 
 
23
  }
24
+
25
+ public function getCommentHeader()
26
+ {
27
+ return Mage::getStoreConfigFlag('ordercomment/settings/commentheader') ?: 'Order Comment';
28
+ }
29
+
30
  }
app/code/community/Cdr/OrderComment/Model/Observer.php CHANGED
@@ -11,7 +11,7 @@ class Cdr_OrderComment_Model_Observer
11
  public function saveOrderComment($observer)
12
  {
13
  if (Mage::getStoreConfigFlag('ordercomment/settings/active')) {
14
- $comment = trim(Mage::app()->getRequest()->getPost('cdr_ordercomment') ?: Mage::app()->getRequest()->getPost('customer_comment'));
15
  if (!empty($comment)) {
16
  $limit = (int) Mage::getStoreConfig('ordercomment/settings/limit');
17
  if (is_integer($limit) && $limit > 0 && strlen($comment) > $limit)
11
  public function saveOrderComment($observer)
12
  {
13
  if (Mage::getStoreConfigFlag('ordercomment/settings/active')) {
14
+ $comment = trim(Mage::app()->getRequest()->getPost('cdr_ordercomment') ?: Mage::app()->getRequest()->getPost('customer_comment')).'cdr';
15
  if (!empty($comment)) {
16
  $limit = (int) Mage::getStoreConfig('ordercomment/settings/limit');
17
  if (is_integer($limit) && $limit > 0 && strlen($comment) > $limit)
app/code/community/Cdr/OrderComment/etc/config.xml CHANGED
@@ -66,4 +66,11 @@
66
  </checkout_type_multishipping_create_orders_single>
67
  </events>
68
  </frontend>
 
 
 
 
 
 
 
69
  </config>
66
  </checkout_type_multishipping_create_orders_single>
67
  </events>
68
  </frontend>
69
+ <default>
70
+ <ordercomment>
71
+ <settings>
72
+ <commentheader>Order Comment</commentheader>
73
+ </settings>
74
+ </ordercomment>
75
+ </default>
76
  </config>
app/code/community/Cdr/OrderComment/etc/system.xml CHANGED
@@ -33,6 +33,17 @@
33
  <show_in_website>1</show_in_website>
34
  <show_in_store>1</show_in_store>
35
  </active>
 
 
 
 
 
 
 
 
 
 
 
36
  <limit translate="label">
37
  <label>Character Limit</label>
38
  <frontend_type>text</frontend_type>
33
  <show_in_website>1</show_in_website>
34
  <show_in_store>1</show_in_store>
35
  </active>
36
+ <commentheader translate="label">
37
+ <label>Comment Box Header</label>
38
+ <frontend_type>text</frontend_type>
39
+ <sort_order>5</sort_order>
40
+ <show_in_default>1</show_in_default>
41
+ <show_in_website>1</show_in_website>
42
+ <show_in_store>1</show_in_store>
43
+ <depends>
44
+ <active>1</active>
45
+ </depends>
46
+ </commentheader>
47
  <limit translate="label">
48
  <label>Character Limit</label>
49
  <frontend_type>text</frontend_type>
app/design/frontend/base/default/template/cdr/ordercomment/onepage/review/commentfield.phtml CHANGED
@@ -9,7 +9,7 @@
9
  <fieldset>
10
  <ul>
11
  <li class="wide">
12
- <label for="cdr_ordercomment"><?php echo $this->__('Order Comment') ?></label>
13
  <div class="input-box">
14
  <textarea id="cdr_ordercomment" class="input-text validation-passed" name="cdr_ordercomment" title="<?php echo $this->__('CDR Order Comment') ?>" rows="5" cols="10" maxlength="<?php echo $this->getMaxCommentSize(); ?>"></textarea>
15
  <?php if ($this->limitTextArea()): ?>
9
  <fieldset>
10
  <ul>
11
  <li class="wide">
12
+ <label for="cdr_ordercomment"><?php echo $this->__($this->getCommentHeader()); ?></label>
13
  <div class="input-box">
14
  <textarea id="cdr_ordercomment" class="input-text validation-passed" name="cdr_ordercomment" title="<?php echo $this->__('CDR Order Comment') ?>" rows="5" cols="10" maxlength="<?php echo $this->getMaxCommentSize(); ?>"></textarea>
15
  <?php if ($this->limitTextArea()): ?>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Cdr_OrderComment</name>
4
- <version>0.0.5</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
7
  <channel>community</channel>
@@ -13,11 +13,11 @@ Now compatible with IWD one page checkout.&#xD;
13
  The admin orders grid can display the order comment with full filter and sorting capabilities without overriding the sales order grid block.&#xD;
14
  &#xD;
15
  This means that it will be compatible with any other module that alters the sales order grid</description>
16
- <notes>Now Compatible with IWD one page checkout module.</notes>
17
  <authors><author><name>Cdr_Software</name><user>PaulKetelle</user><email>paul@ketelle.co.uk</email></author></authors>
18
- <date>2014-11-29</date>
19
- <time>22:42:56</time>
20
- <contents><target name="magecommunity"><dir name="Cdr"><dir name="OrderComment"><dir name="Block"><dir name="Checkout"><dir name="Onepage"><dir name="Review"><file name="Commentfield.php" hash="172f5e0b4d62329ebd646a4fce2c03b7"/></dir></dir></dir><dir name="Sales"><dir name="Order"><dir name="View"><file name="Ordercomment.php" hash="4a5b4ca1950038facaacdd78382b22de"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="37da67c151f7da560e7d98084a883821"/></dir><dir name="Model"><file name="Observer.php" hash="e3f71bd4c7f01046c0bf82a6754469c4"/></dir><dir name="etc"><file name="adminhtml.xml" hash="0d103e251b0e2d2216ba4906bd6ab41c"/><file name="config.xml" hash="e54314bbede3afa6cf78f876c3c2d89f"/><file name="system.xml" hash="ab78872ea76a77c4ccf13e63c273051b"/></dir><dir name="sql"><dir name="ordercomment_setup"><file name="install-0.0.1.php" hash="e14626ce4cfb4962c1397792b6e27cb5"/><file name="upgrade-0.0.1-0.0.2.php" hash="cbff0ca491fb00179cc571965adc654e"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="cdr"><file name="cdr_ordercomment.xml" hash="c942565434f12bbeda313239f2ace124"/></dir></dir><dir name="template"><dir name="cdr"><dir name="ordercomment"><dir name="onepage"><dir name="iwd"><file name="comment.phtml" hash="7dff101d4cfca9c883a3edd60c6439d6"/></dir><dir name="review"><file name="commentfield.phtml" hash="c9c8caad19adb5f52679abdb706aa65c"/></dir></dir><dir name="sales"><dir name="order"><dir name="view"><file name="ordercomment.phtml" hash="5ff233b5996ab70d046c5bbf7c93fc5c"/></dir></dir></dir></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="cdr"><file name="cdr_ordercomment.xml" hash="491197634248ec0b6f9c78647259ecc8"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Cdr_OrderComment.xml" hash="9787f0ac2363120a6ed4432833d42428"/></dir></target></contents>
21
  <compatible/>
22
  <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
23
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Cdr_OrderComment</name>
4
+ <version>0.0.6</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
7
  <channel>community</channel>
13
  The admin orders grid can display the order comment with full filter and sorting capabilities without overriding the sales order grid block.&#xD;
14
  &#xD;
15
  This means that it will be compatible with any other module that alters the sales order grid</description>
16
+ <notes>Added a config option for the Order Comment title</notes>
17
  <authors><author><name>Cdr_Software</name><user>PaulKetelle</user><email>paul@ketelle.co.uk</email></author></authors>
18
+ <date>2015-02-05</date>
19
+ <time>14:49:08</time>
20
+ <contents><target name="magecommunity"><dir name="Cdr"><dir name="OrderComment"><dir name="Block"><dir name="Checkout"><dir name="Onepage"><dir name="Review"><file name="Commentfield.php" hash="1e1798a952ac8d4c285b43385d746421"/></dir></dir></dir><dir name="Sales"><dir name="Order"><dir name="View"><file name="Ordercomment.php" hash="4a5b4ca1950038facaacdd78382b22de"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="37da67c151f7da560e7d98084a883821"/></dir><dir name="Model"><file name="Observer.php" hash="2dd782662298d2147f0cee68b28ccb56"/></dir><dir name="etc"><file name="adminhtml.xml" hash="0d103e251b0e2d2216ba4906bd6ab41c"/><file name="config.xml" hash="f12efde779204b556903a0e1426bcc96"/><file name="system.xml" hash="9704077151b1bff42d90a849fbfe0832"/></dir><dir name="sql"><dir name="ordercomment_setup"><file name="install-0.0.1.php" hash="e14626ce4cfb4962c1397792b6e27cb5"/><file name="upgrade-0.0.1-0.0.2.php" hash="cbff0ca491fb00179cc571965adc654e"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="cdr"><file name="cdr_ordercomment.xml" hash="c942565434f12bbeda313239f2ace124"/></dir></dir><dir name="template"><dir name="cdr"><dir name="ordercomment"><dir name="onepage"><dir name="iwd"><file name="comment.phtml" hash="7dff101d4cfca9c883a3edd60c6439d6"/></dir><dir name="review"><file name="commentfield.phtml" hash="e799d0695245b42574b80f47b9ba3343"/></dir></dir><dir name="sales"><dir name="order"><dir name="view"><file name="ordercomment.phtml" hash="5ff233b5996ab70d046c5bbf7c93fc5c"/></dir></dir></dir></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="cdr"><file name="cdr_ordercomment.xml" hash="491197634248ec0b6f9c78647259ecc8"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Cdr_OrderComment.xml" hash="9787f0ac2363120a6ed4432833d42428"/></dir></target></contents>
21
  <compatible/>
22
  <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
23
  </package>