Page 1 of 1

s08e03 - Comments on Invoice SUPPORT / QUESTIONS

Posted: Wed Jul 31, 2024 8:29 am
by 14Steve14
Addon:
This addon gets all the comments of the Order and prints them on the Invoice Page.

Download:
viewtopic.php?f=28&t=587




--


We have been using this module for along time now on our 1.0.8.11 store with no problems.

Now we have updated the site to 1.0.9.0 we are now seeing other order information shown on the bottom of the invoices which shows payment details that are also saved into the order comments table from payment modules including Paypal and Stripe.

Is there a way to get this module to correctly show just the comments left by customers during the checkout process and not all the other stuff put there by payment modules.

We are using the version of the module that came with a pro 1.0.8.21 Phoenix version.

Re: s08e03 - Comments on Invoice

Posted: Wed Jul 31, 2024 8:55 am
by burt
This hook simply gets all the comments of an order and blats them out onto the page.

There is nothing in the orders_status_history that tells us what/who wrote a comment.
That might be a nice upgrade for some future version of Phoenix.

EG, a new column;
Author:
which could be one of (eg);
admin [shopowner added]
customer [customer added as part of checkout process]
system [eg a payment module added]

There is, already existing, a public_flag. You could amend this line:

Code: Select all

$comment_query = $GLOBALS['db']->query(sprintf(<<<'EOSQL'
SELECT os.*, osh.*
 FROM orders_status os INNER JOIN orders_status_history osh ON osh.orders_status_id = os.orders_status_id
 WHERE osh.orders_id = %d AND os.language_id = %d
 ORDER BY osh.date_added
EOSQL
    , (int)$_GET['oID'], (int)$_SESSION['languages_id']));
    
to (eg) this:

Code: Select all

$comment_query = $GLOBALS['db']->query(sprintf(<<<'EOSQL'
SELECT os.*, osh.*
 FROM orders_status os INNER JOIN orders_status_history osh ON osh.orders_status_id = os.orders_status_id
 WHERE osh.orders_id = %d AND os.language_id = %d
 AND os.public_flag = 1
 ORDER BY osh.date_added
EOSQL
    , (int)$_GET['oID'], (int)$_SESSION['languages_id']));
Which may (or may not) be useful.

Re: s08e03 - Comments on Invoice

Posted: Wed Jul 31, 2024 9:01 am
by burt
Do note that this line:

$print = ($statuses['public_flag'] == 1) ? ' ' : ' d-print-none ';

already does the above, when the invoice is printed (or at least it should do).

When looking at the invoice, you'll see all the comments.
When the invoice is printed, it will only print public_flag = 1 comments.

Re: s08e03 - Comments on Invoice

Posted: Wed Jul 31, 2024 11:10 am
by 14Steve14
burt wrote: Wed Jul 31, 2024 9:01 am Do note that this line:

$print = ($statuses['public_flag'] == 1) ? ' ' : ' d-print-none ';

already does the above, when the invoice is printed (or at least it should do).

When looking at the invoice, you'll see all the comments.
When the invoice is printed, it will only print public_flag = 1 comments.
Thanks Gary.

I have just grabbed a fresh copy of the file from the pro version for 1.0.8.20 and uploaded that hook file and all seems to be working fine. I didn't bother comparing the files but something in the old file that I had must have changed as what we could see on the invoice preview was printing on the invoice.

A separate column for the order comments left by a customer would be good as when we have to send out duplicate invoices to some people we cannot get it not to show all the payment data, and canned comments data. We have to spend time converting the invoice to an image and then we can remove the text by colouring over the top.