Zen Cart Logo
Forums / Managing Customers and Orders / Show ONLY customer comments on Invoice and Packing Slip

Show ONLY customer comments on Invoice and Packing Slip

Locked

Views: 4,520

Results 1 to 11 of 11
This thread is locked. New replies are disabled.
27 Aug 2009, 6:49 PM
#1
manutd98 avatar

manutd98

New Zenner

Join Date:
Nov 2008
Posts:
32
Plugin Contributions:
0

Show ONLY customer comments on Invoice and Packing Slip

How can I customize admin\packingslip.php and invoice.php to show only the customer comments in the comments section? When you turn these on in the admin:

Display Order Comments on Admin Invoice
Display Order Comments on Admin Packing

It places a table across the bottom of those documents with dates, check marks, and all the status updates of the orders, even if the Display Order Comments is set to "1".

All I want is for the customer comment from the order to appear on the admin invoice and admin packing. In our shop, we print the admin invoice and pull the products, so it helps to have any order comments right there on the sheet. The other stuff is not necessary.

Here is the relevant code

<?php if (ORDER_COMMENTS_PACKING_SLIP > 0) { ?>
      <tr>
        <td class="main"><table border="1" cellspacing="0" cellpadding="5">
          <tr>
            <td class="smallText" align="center"><strong><?php echo TABLE_HEADING_DATE_ADDED; ?></strong></td>
            <td class="smallText" align="center"><strong><?php echo TABLE_HEADING_CUSTOMER_NOTIFIED; ?></strong></td>
            <td class="smallText" align="center"><strong><?php echo TABLE_HEADING_STATUS; ?></strong></td>
            <td class="smallText" align="center"><strong><?php echo TABLE_HEADING_COMMENTS; ?></strong></td>
          </tr>
<?php
    $orders_history = $db->Execute("select orders_status_id, date_added, customer_notified, comments
                                    from " . TABLE_ORDERS_STATUS_HISTORY . "
                                    where orders_id = '" . zen_db_input($oID) . "'
                                    order by date_added");

    if ($orders_history->RecordCount() > 0) {
      $count_comments=0;
      while (!$orders_history->EOF) {
        $count_comments++;
        echo '          <tr>' . "\n" .
             '            <td class="smallText" align="center">' . zen_datetime_short($orders_history->fields['date_added']) . '</td>' . "\n" .
             '            <td class="smallText" align="center">';
        if ($orders_history->fields['customer_notified'] == '1') {
          echo zen_image(DIR_WS_ICONS . 'tick.gif', ICON_TICK) . "</td>\n";
        } else {
          echo zen_image(DIR_WS_ICONS . 'cross.gif', ICON_CROSS) . "</td>\n";
        }
        echo '            <td class="smallText">' . $orders_status_array[$orders_history->fields['orders_status_id']] . '</td>' . "\n";
        echo '            <td class="smallText">' . ($orders_history->fields['comments'] == '' ? TEXT_NONE : nl2br(zen_db_output($orders_history->fields['comments']))) . ' </td>' . "\n" .
             '          </tr>' . "\n";
        $orders_history->MoveNext();
        if (ORDER_COMMENTS_PACKING_SLIP == 1 && $count_comments >= 1) {
          break;
        }
      }
    } else {
        echo '          <tr>' . "\n" .
             '            <td class="smallText" colspan="5">' . TEXT_NO_ORDER_HISTORY . '</td>' . "\n" .
             '          </tr>' . "\n";
    }
?>
        </table></td>
      </tr>
<?php } // order comments ?>

</table>
28 Aug 2009, 4:48 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Show ONLY customer comments on Invoice and Packing Slip

You need to comment out or remove what you don't want to see ... something like this should work on the packingslip.php file:

<?php if (ORDER_COMMENTS_PACKING_SLIP > 0) { ?>
      <tr>
        <td class="main"><table border="0" cellspacing="0" cellpadding="5">
          <tr>
            <td class="smallText" align="center"><strong><?php //echo TABLE_HEADING_DATE_ADDED; ?></strong></td>
            <td class="smallText" align="center"><strong><?php //echo TABLE_HEADING_CUSTOMER_NOTIFIED; ?></strong></td>
            <td class="smallText" align="center"><strong><?php //echo TABLE_HEADING_STATUS; ?></strong></td>
            <td class="smallText" align="center"><strong><?php //echo TABLE_HEADING_COMMENTS; ?></strong></td>
          </tr>
<?php
    $orders_history = $db->Execute("select orders_status_id, date_added, customer_notified, comments
                                    from " . TABLE_ORDERS_STATUS_HISTORY . "
                                    where orders_id = '" . zen_db_input($oID) . "'
                                    order by date_added");

    if ($orders_history->RecordCount() > 0) {
      $count_comments=0;
      while (!$orders_history->EOF) {
        $count_comments++;
        //echo '          <tr>' . "\n" .
             '            <td class="smallText" align="center">' . zen_datetime_short($orders_history->fields['date_added']) . '</td>' . "\n" .
             '            <td class="smallText" align="center">';
        if ($orders_history->fields['customer_notified'] == '1') {
          //echo zen_image(DIR_WS_ICONS . 'tick.gif', ICON_TICK) . "</td>\n";
        } else {
          //echo zen_image(DIR_WS_ICONS . 'cross.gif', ICON_CROSS) . "</td>\n";
        }
        //echo '            <td class="smallText">' . $orders_status_array[$orders_history->fields['orders_status_id']] . '</td>' . "\n";
        echo '            <td class="smallText">' . ($orders_history->fields['comments'] == '' ? TEXT_NONE : nl2br(zen_db_output($orders_history->fields['comments']))) . ' </td>' . "\n" .
             '          </tr>' . "\n";
        $orders_history->MoveNext();
        if (ORDER_COMMENTS_PACKING_SLIP == 1 && $count_comments >= 1) {
          break;
        }
      }
    } else {
        //echo '          <tr>' . "\n" .
             '            <td class="smallText" colspan="5">' . TEXT_NO_ORDER_HISTORY . '</td>' . "\n" .
             '          </tr>' . "\n";
    }
?>
        </table></td>
      </tr>
<?php } // order comments ?>
28 Aug 2009, 7:01 PM
#3
manutd98 avatar

manutd98

New Zenner

Join Date:
Nov 2008
Posts:
32
Plugin Contributions:
0

Re: Show ONLY customer comments on Invoice and Packing Slip

Thanks, Ajeh :)

That worked great for me, I used the same concept on my invoice page as well.

I honestly wasn't sure what to comment out, the things I tried would break the php code. Now I see that if you comment out the "echo" parts it doesn't display those bits on the page. It makes sense and I think I have learned something today!

24 Oct 2009, 8:23 AM
#4
peco1 avatar

peco1

New Zenner

Join Date:
Jul 2009
Posts:
8
Plugin Contributions:
0

Re: Show ONLY customer comments on Invoice and Packing Slip

Thanks. I tried that and it works great. For Paypal and credit card customers, it only show something like this
"Credit Card payment. AUTH: xxxxxx. TransID: xxxxxxxxxx." and did not show customer's comment.

If I set these to "2"
Display Order Comments on Admin Invoice
Display Order Comments on Admin Packing
It will show everything.
How can I set it to show only customer's comments? Thanks.

24 Oct 2009, 1:52 PM
#5
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Show ONLY customer comments on Invoice and Packing Slip

Did you try using the one just for the Customer Comments:

Display Order Comments on Admin Invoice
Do you want to display the Order Comments on the Admin Invoice?
0= OFF
1= First Comment by Customer only
2= All Comments for the Order

Display Order Comments on Admin Packing Slip
Do you want to display the Order Comments on the Admin Packing Slip?
0= OFF
1= First Comment by Customer only
2= All Comments for the Order

25 Oct 2009, 12:01 AM
#6
peco1 avatar

peco1

New Zenner

Join Date:
Jul 2009
Posts:
8
Plugin Contributions:
0

Re: Show ONLY customer comments on Invoice and Packing Slip

yes I did. If I set to "1" it will show only credit card or paypal payment info.
btw, I'm using version 1.3.8a and installed some modules like: Admin profile, edit orders, min order amount, sms onsale, supertracker, and time zone offset. Not sure if they affected the files.

25 Oct 2009, 12:39 AM
#7
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Show ONLY customer comments on Invoice and Packing Slip

I do not know what those add ons will do ...

If you set the settings to 1 in a clean Zen Cart you will see only the Customer Comments on the Invoice and Packing slips ...

You might compare, from a clean Zen Cart, the files:
/admin/invoice.php
/admin/packingslip.php

and see if something has changed ...

25 Oct 2009, 10:33 AM
#8
peco1 avatar

peco1

New Zenner

Join Date:
Jul 2009
Posts:
8
Plugin Contributions:
0

Re: Show ONLY customer comments on Invoice and Packing Slip

Thanks for your advice. I'll try that.

25 Oct 2009, 11:18 AM
#9
peco1 avatar

peco1

New Zenner

Join Date:
Jul 2009
Posts:
8
Plugin Contributions:
0

Re: Show ONLY customer comments on Invoice and Packing Slip

I just open up /admin/invoice.php file and found out that the person who did for us changed a lot of things in there. The whole code that you posted earlier are not in the invoice.php also (only in the packing)
I'm not a programmer, could you please point to me which part of the code that i should pay attention at?

25 Oct 2009, 3:19 PM
#10
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Show ONLY customer comments on Invoice and Packing Slip

Look in the original files for the IF statements on the comments that start with:

<?php if (ORDER_COMMENTS_PACKING_SLIP > 0) { ?>
<?php if (ORDER_COMMENTS_INVOICE > 0) { ?>
27 Oct 2009, 6:04 AM
#11
peco1 avatar

peco1

New Zenner

Join Date:
Jul 2009
Posts:
8
Plugin Contributions:
0

Re: Show ONLY customer comments on Invoice and Packing Slip

Thanks a lot.
This is the code i got from the packing slip, which is only show the payment method if the customers pay by credit card or paypal. When I compared it with the original file that I backed up long time ago, they look the same.

<?php if (ORDER_COMMENTS_PACKING_SLIP > 0) { ?>
  <tr>
    <td class="main"><table border="1" cellspacing="0" cellpadding="5">
      <tr>
        <td class="smallText" align="center"><strong><?php echo TABLE_HEADING_DATE_ADDED; ?></strong></td>
        <td class="smallText" align="center"><strong><?php echo TABLE_HEADING_CUSTOMER_NOTIFIED; ?></strong></td>
        <td class="smallText" align="center"><strong><?php echo TABLE_HEADING_STATUS; ?></strong></td>
        <td class="smallText" align="center"><strong><?php echo TABLE_HEADING_COMMENTS; ?></strong></td>
      </tr>
<?php $orders_history = $db->Execute("select orders_status_id, date_added, customer_notified, comments from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . zen_db_input($oID) . "' order by date_added"); if ($orders_history->RecordCount() > 0) { $count_comments=0; while (!$orders_history->EOF) { $count_comments++; echo ' <tr>' . "\n" . ' <td class="smallText" align="center">' . zen_datetime_short($orders_history->fields['date_added']) . '</td>' . "\n" . ' <td class="smallText" align="center">'; if ($orders_history->fields['customer_notified'] == '1') { echo zen_image(DIR_WS_ICONS . 'tick.gif', ICON_TICK) . "</td>\n"; } else { echo zen_image(DIR_WS_ICONS . 'cross.gif', ICON_CROSS) . "</td>\n"; } echo ' <td class="smallText">' . $orders_status_array[$orders_history->fields['orders_status_id']] . '</td>' . "\n"; echo ' <td class="smallText">' . ($orders_history->fields['comments'] == '' ? TEXT_NONE : nl2br(zen_db_output($orders_history->fields['comments']))) . ' </td>' . "\n" . ' </tr>' . "\n"; $orders_history->MoveNext(); if (ORDER_COMMENTS_PACKING_SLIP == 1 && $count_comments >= 1) { break; } } } else { echo ' <tr>' . "\n" . ' <td class="smallText" colspan="5">' . TEXT_NO_ORDER_HISTORY . '</td>' . "\n" . ' </tr>' . "\n"; } ?>
    </table></td>
  </tr>
<?php }