How do i access the order comments in an invoice template? when i print_r the $order object, the comments are not a part of it.
Yeah, at this point you'll have to load them using uc_order_comments_load($order_id).
Thanks, what's the reason for returning an array? as far as i can tell there's only 1 order comments field.
The array is b/c there can be an unlimited number of comments on the order. You can poll through the list. If the customer left a comment, it'd be the first one.
I wrote something like this :
I was getting dashes printed out for the comments being added for order status changes, so added an if statement to ignore printing out these.
<? $myArray = uc_order_comments_load($order->order_id); ?>
<? if ($myArray[0]->message) { ?>
<ul>
<? foreach($myArray as $customerComment) { ?>
<? if ($customerComment->message != '-') { ?>
<li><? print $customerComment->message; ?></li>
<? } ?>
<? } ?>
</ul>
<? } else { ?>
There are no comments for this order.
<? } ?>Alternatively to just print out the first :
<? $myArray = uc_order_comments_load($order->order_id); ?>
<? print $myArray[0]->message; ?>
<? } ?>Is there any way to differentiate comments submitted by the customer and comments submitted by an admin? We'd like to just provide our comments to the customer on the invoice and can't seem to find a way to do so. BTW, I'm speaking of "Order Comments" not "Admin Comments"
Also, any reason why UC creates a comment with a dash every time the order is updated?
Thanks - and another fist-bump to Ryan for a great system.
Holling
Ryan Anyone: In the invoice template is there a just that simple way to get the order ballance into a variable? It is not stored in the $order nor in another var. The only way I know so far is the token.
To answer my own question, based on a thorough reading of this thread...the goal was to list Order Comments, but not the one from the customer (which will always be the first one), AND, not showing any empty ones (that appear as dashes), I cobbled together the following code:
<?php
$comments = uc_order_comments_load($order->order_id);
if ($comments) {
$n = 1;
foreach ($comments as $c) {
if ($n > 1) {
$date = format_date($c->created);
$uid = $c->uid;
$msg = $c->message;
if ($msg != '-') {
print "<tr><td>$date <br /><strong>Note:</strong> $msg</td></tr>\n";
}
}
$n++;
}
}
?>Hope this helps some folks trying to figure this out.
Cheers - Holling
Hi!
I wanted to make a thread to ask a question, but maybe it is better placed here.
I had the problem that there is no order-comments in the invoices, as the thread-starter too.
i needed the comments in the "printable invoice" (customer.itpl.php), because that is the one wich i use for archiving and correspondence. i figured out that i can simply use [order-comments] to fetch the comment. first i thought about getting it with some more complicated code-snippet as mentioned above, but for me the [order-comments] is fine. i get the comment, that was all that i wanted.
but now i recognized that there is no order-date too. is there a way to fetch the date?
[order-date] won't work. =(
MfG
Cream
* [order-date-created] works as i found out, but then it gets me "12/09/2009 - 12:41 "
(US-date-format) is there a way to change that to european format (09.12.2009 ...)
In the shop settings i allready changed the date-format to the european style, but in the invoice it still gives me the us-formate.
* [order-date-created] works as i found out, but then it gets me "12/09/2009 - 12:41 "
(US-date-format) is there a way to change that to european format (09.12.2009 ...)
In the shop settings i allready changed the date-format to the european style, but in the invoice it still gives me the us-formate.
Ubercart uses your Drupal site date settings for the order-date-created and order-date-modified tokens. Make sure you have your "Short date format" set properly at admin/settings/date-time
Damn...thank you. I thought i had that configured right, but infact only the longest date/time was configured. It workes perfectly now. Thanks alot! =)
About this "commands" for the data of an order ([order-name], [order-date-created], etc),
is there anywhere a list of all these commands?
Because, for example the [order-adress] will give me the whole adress, but within one line without seperators. i tried to fetch name, street, etc as single, but without succes. In the order-module-file i found some of these commands wich were used, but i wonder if there are more commands. So is there a list of all commands available?
MfG
Cream
[order-name], [order-date-created] etc. are called "tokens" in Drupal. They are defined by the Token module, and the list of all tokens defined by all enabled modules is shown in the help page for the Token module at admin/store/help/tokens. You can usually see a link to a list of all available tokens just below the input area where they can be used. For example, at admin/store/settings/checkout/edit/messages, some of the textareas have links below them that say "Uses order and global tokens". Clicking on that link will show you all the tokens that may be used inside that textarea.
Ah, that are tokens. I allways wondered. =)
i found the list of all tokens now.
I did not look there because i was editing in the files directly. Sadly there seems to be no way to seperate the adress in name, country, etc.... (in the invoice all adress-data in a single line can sometimes be confusing if the adress is a bit strange. )
greets
cream
Hey guys,
Im trying to make the customer order comments appear on the printable invoice, so when I print them they show up.
I tried adding the 2 sets of code above to my "customer.itlp.php" template, but they are not showing up. Its also giving me an error.
Is that were you are suppose to add the code? Am i adding the code in the right place? What is the easiest code to include in the customer.itlp.php file to make the comments show?
Thanks!
OK - I kind of answered by own question. Its pretty simple:
all you need to do is update customer.tpl.php with:
[order-comments]
thats it. It will show the customers order comments wherever you place it in the php document.
I have a uc_order_customer.tpl.php file where I have tried to place [order-comments] but it is not working. Is there another folder I should be seeking?
I have found a lot of useful information from this platform. I must say that sharing your thoughts with one another is an easy way to relax yourself in the daily hectic routines. Each time a description of the change, there are always lots of talk about it anywhere. These are not exempt. I mean one must be up to date with the day to day change in the environment and in the technology as well. In my personal opinion, the world is turning into a global village and now you can get a lot of required information by just a click while sitting where ever you are.
HP0-J53|HP0-Y33|HP2-E38|HP2-Z09|HP2-Z18|JN0-360|70-177|1z0-058|


