s08e03 - Comments on Invoice SUPPORT / QUESTIONS

Open to all! Ask other shopowners for help.
Post Reply
14Steve14
Senior Contributor
Posts: 922
Joined: Fri Oct 25, 2019 7:01 pm
Phoenix Version: v1.0.9.1
Has thanked: 17 times
Been thanked: 103 times

s08e03 - Comments on Invoice SUPPORT / QUESTIONS

Post 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.

Tags:


Join The Code Co-op to get access to your library in the Code Co-op Forum
User avatar
burt
Core Team
Posts: 4551
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: s08e03 - Comments on Invoice

Post 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.
I am not here to build for you.
I am here to build with you. Let's help each other.
User avatar
burt
Core Team
Posts: 4551
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: s08e03 - Comments on Invoice

Post 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.
I am not here to build for you.
I am here to build with you. Let's help each other.
14Steve14
Senior Contributor
Posts: 922
Joined: Fri Oct 25, 2019 7:01 pm
Phoenix Version: v1.0.9.1
Has thanked: 17 times
Been thanked: 103 times

Re: s08e03 - Comments on Invoice

Post 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.


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply