Cdr_OrderComment - Version 0.0.4

Version Notes

Now Compatible with IWD one page checkout module.

Download this release

Release Info

Developer Cdr
Extension Cdr_OrderComment
Version 0.0.4
Comparing to
See all releases


Code changes from version 0.0.3 to 0.0.4

app/code/community/Cdr/OrderComment/Block/Checkout/Onepage/Review/Commentfield.php CHANGED
@@ -19,8 +19,13 @@ class Cdr_OrderComment_Block_Checkout_Onepage_Review_Commentfield extends Mage_C
19
  return (is_numeric($limit) && $limit > 0);
20
  }
21
 
22
- public function isActive()
23
  {
24
- return Mage::getStoreConfigFlag('ordercomment/settings/active');
 
 
 
 
 
25
  }
26
- }
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
+ }
app/code/community/Cdr/OrderComment/Model/Observer.php CHANGED
@@ -10,12 +10,8 @@ class Cdr_OrderComment_Model_Observer
10
  */
11
  public function saveOrderComment($observer)
12
  {
13
- Mage::log('save Order', null, 'filename.log');
14
- Mage::log('active = '.var_export(Mage::getStoreConfigFlag('ordercomment/settings/active'), true), null, 'filename.log');
15
  if (Mage::getStoreConfigFlag('ordercomment/settings/active')) {
16
- $comment = trim(Mage::app()->getRequest()->getPost('cdr_ordercomment'));
17
-
18
- Mage::log('Order Comment = '.$comment, null, 'filename.log');
19
  if (!empty($comment)) {
20
  $limit = (int) Mage::getStoreConfig('ordercomment/settings/limit');
21
  if (is_integer($limit) && $limit > 0 && strlen($comment) > $limit)
@@ -23,7 +19,6 @@ class Cdr_OrderComment_Model_Observer
23
 
24
  $order = $observer->getEvent()->getOrder();
25
  /* @var $order Mage_Sales_Model_Order */
26
-
27
  $order->setCdrOrderComment($comment);
28
  $order->setCustomerComment($comment);
29
  $order->setCustomerNoteNotify(true);
10
  */
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)
19
 
20
  $order = $observer->getEvent()->getOrder();
21
  /* @var $order Mage_Sales_Model_Order */
 
22
  $order->setCdrOrderComment($comment);
23
  $order->setCustomerComment($comment);
24
  $order->setCustomerNoteNotify(true);
app/design/frontend/base/default/layout/cdr/cdr_ordercomment.xml CHANGED
@@ -11,10 +11,19 @@
11
  <block type="ordercomment/checkout_onepage_review_commentfield" name="cdr_order_comment" template="cdr/ordercomment/onepage/review/commentfield.phtml" />
12
  </reference>
13
  </checkout_multishipping_overview>
 
 
 
 
 
 
 
 
 
14
 
15
  <sales_order_view>
16
  <reference name="my.account.wrapper">
17
  <block type="ordercomment/sales_order_view_ordercomment" name="cdr_ordercomment_info" after="sales.order.info" template="cdr/ordercomment/sales/order/view/ordercomment.phtml" />
18
  </reference>
19
  </sales_order_view>
20
- </layout>
11
  <block type="ordercomment/checkout_onepage_review_commentfield" name="cdr_order_comment" template="cdr/ordercomment/onepage/review/commentfield.phtml" />
12
  </reference>
13
  </checkout_multishipping_overview>
14
+
15
+
16
+ <opc_index_index translate="label">
17
+ <reference name="checkout.order.comment">
18
+ <action method="setTemplate">
19
+ <template>cdr/ordercomment/onepage/iwd/comment.phtml</template>
20
+ </action>
21
+ </reference>
22
+ </opc_index_index>
23
 
24
  <sales_order_view>
25
  <reference name="my.account.wrapper">
26
  <block type="ordercomment/sales_order_view_ordercomment" name="cdr_ordercomment_info" after="sales.order.info" template="cdr/ordercomment/sales/order/view/ordercomment.phtml" />
27
  </reference>
28
  </sales_order_view>
29
+ </layout>
app/design/frontend/base/default/template/cdr/ordercomment/onepage/iwd/comment.phtml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php /* @var $this Cdr_OrderComment_Block_Checkout_Onepage_Review_Commentfield */
2
+ $block = new Cdr_OrderComment_Block_Checkout_Onepage_Review_Commentfield();
3
+ ?>
4
+
5
+ <?php if ($block->isActive('iwd')) : ?>
6
+ <div class="comment-block">
7
+ <h3><?php echo $this->__('Comment')?><span class='expand_plus'></span></h3>
8
+ <div class="collapse-block hidden">
9
+ <form autocomplete="off" id="cdr_ordercomment-form">
10
+ <div class="comment">
11
+ <div class="comment-form">
12
+ <div class="input-box">
13
+ <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 $block->getMaxCommentSize(); ?>"></textarea>
14
+ <?php if ($block->limitTextArea()): ?>
15
+ <span id="cdr_ordercomment-max-len"><?php echo $block->getMaxCommentSize(); ?></span> <?php echo $this->__('Chars Remaining'); ?>
16
+ <?php endif; ?>
17
+ </div>
18
+ </div>
19
+ </div>
20
+ </form>
21
+ <script>
22
+ <?php if ($block->limitTextArea()): ?>
23
+ $('cdr_ordercomment').observe('keyup', function(event) {
24
+ var max = <?php echo $block->getMaxCommentSize(); ?>;
25
+ var current = event.element().value.length;
26
+ $('cdr_ordercomment-max-len').innerHTML = (max - current);
27
+ });
28
+ <?php endif; ?>
29
+ </script>
30
+ </div>
31
+ </div>
32
+ <?php endif; ?>
33
+
package.xml CHANGED
@@ -1,24 +1,23 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Cdr_OrderComment</name>
4
- <version>0.0.3</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Customers can add an Order Comment at time of checkout.</summary>
10
  <description>Order Comment can be added to the order by the customer at the time of checkout for both onepage checkout and checkout with multiple addresses.&#xD;
 
11
  &#xD;
12
- The admin orders grid can display the order comment with full filter and sorting capabilities without overriding the sales order grid block. &#xD;
13
- This means that it will be compatible with any other module that alters the sales order grid.</description>
14
- <notes>Added Order Comments to Onepage Checkout &amp; Multi-shipping Checkout.&#xD;
15
  &#xD;
16
- Order comment is displayed within the Orders Grid and orders comment history&#xD;
17
- </notes>
18
  <authors><author><name>Cdr_Software</name><user>PaulKetelle</user><email>paul@ketelle.co.uk</email></author></authors>
19
- <date>2014-03-04</date>
20
- <time>17:58:55</time>
21
- <contents><target name="mageetc"><dir name="modules"><file name="Cdr_OrderComment.xml" hash="9787f0ac2363120a6ed4432833d42428"/></dir></target><target name="magecommunity"><dir name="Cdr"><dir name="OrderComment"><dir><dir name="Block"><dir name="Checkout"><dir name="Onepage"><dir name="Review"><file name="Commentfield.php" hash="d7e95f809fb5bae7e0586fad2d69b9ab"/></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="88f8537ae1cb6a4b8493991672f6b6e7"/></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></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="fb262c270f7dcbe901e6b2a95bc6df85"/></dir></dir><dir name="template"><dir name="cdr"><dir name="ordercomment"><dir><dir name="onepage"><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><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></contents>
22
  <compatible/>
23
  <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
24
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Cdr_OrderComment</name>
4
+ <version>0.0.4</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Customers can add an Order Comment at time of checkout.</summary>
10
  <description>Order Comment can be added to the order by the customer at the time of checkout for both onepage checkout and checkout with multiple addresses.&#xD;
11
+ Now compatible with IWD one page checkout.&#xD;
12
  &#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-27</date>
19
+ <time>14:03:11</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="2dd782662298d2147f0cee68b28ccb56"/></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>