Download & Extend

Who Bought What - Adding "Order Comments" to .CSV Export

Project:Who Bought What|Ubercart
Version:6.x-2.0
Component:Code
Category:feature request
Priority:normal
Assigned:Cayenne
Status:active

Issue Summary

I am using Who Bought What for exporting product results. It works great, but I would like it to also add any Order Comments made by the admin. Is there a code snippet that i could add that would add this feature?

My example: my products are event registrations. When customers order the event registration, we are also shipping a book to them. I want to be able to mark on their orders that a book has been shipped. That way, when I export the product orders, it shows who in the 'order pool' has already been sent a book.

I appreciate your help!

Comments

#1

Assigned to:Anonymous» Cayenne

Hmmm. should be very easy. you want admin comment or the comment when placed with the order?

#2

Right now I would like the admin comment. But both would be great. Admin comment should definitely get the priority.

I appreciate any help you can provide.

#3

Hi Cayenne, have you given any more thought to this issue? I'll start digging in deeper too. Thanks!

#4

Okay, it looks like a bit of work. The order comments and admin comments are in two separate tables, so we will have to JOIN them on Order_id

So, after line 69 add
" JOIN $uc_order_admin_comments ON $uc_order_products.order_id = $uc_order_admin_comments.order_id " .

and at the end of the header array add
array('data' => t('AdCom'),    'field' => 'AdCom',    'sql_field' => "uc_order_admin_comments.message"), 

Finally, to express it, you'll want something down around line 163, like adding at the end

$temparray[]=  $customer['AdCom'];

What I think, however is that every order has an admin comment or more (not dealt with here) and that in any case the comments are too long for convenient display.

What do you think?

#5

I'm currently looking into order-last-comment - I think going after the latest order comment will bypass the issue of each order already having an admin comment.

I've been tweaking some of the code to make it work, but to no avail.

We'll get it.

#6

yeah. sorry i have not been free to really execute this. I have been swamped with the actual administration of the events I originally built this for....

Soon...

#7

Ok - this is the mySQL search that spits out the info I want --> However - I just want .message coming from order_comments, affixing itself to the order_products info...

SELECT * FROM uc_order_comments JOIN uc_order_products ON uc_order_comments.order_id = uc_order_products.order_id

This might be even better... reversing the order.

SELECT * FROM uc_order_products LEFT OUTER JOIN uc_order_comments ON uc_order_products.order_id = uc_order_comments.order_id

Now -- just need to determine what changes within the module coding.

#8

And getting even more extreme ... this query meshes all three tables.

SELECT * FROM uc_order_comments, uc_order_products, uc_orders WHERE uc_order_comments.order_id = uc_order_products.order_id AND uc_order_products.order_id = uc_orders.order_id;

#11

I am extremely interested if you were able to get this to work. My client is requesting billing shipping info and comments be appended to this report.

#12

Hi Mod.

I just got a long-delayed security patch installed, which frees me now to look at this.

Let me ask this. Are you using the shipping module? That lets you track that as well. Advancing the product status from pending to completed, for example, can serve the purpose.

In the meantime, one of my earlier priorities will be allowing the use of a view to pick the product and also adding a configuration screen.

Presumably there, we will be able to pick options like comments....

#13

We are not using the shipping module, as my client deals in mostly digital goods. I mis-typed and should have wrote "Billing Info". He needs to provide a listing of purchases by product/vendor to each vendor on a regular basis, and this module seems to provide the needed CSV export plus extra functionality that I can manually hack in, such as the delivery/billing address info and (hopefully) the comments. One request I would tack on is the ability to have the State and Country be translated into their actual name versus the ID code that is used internally by the database. This is not a deal-breaker, as I can hack together an Excel macro that does the translation, but if the CSV export provided the actual names, it would save me some work. :)

#14

Hello, any progress here, or others have any success patching additional fields into the report?

#15

Okay, i have working on my own site the billing and shipping addresses. Converting country codes should be trivial.

I am still a little stumped by the comments thing. Yes, adding the latest comment might work, but I fear it might be misleading.

#16

Perhaps I'm using the term "comments" incorrectly. My client is looking to include the "order comments" field (from the bottom of the checkout screen) so that he can see if a customer left special delivery instructions, etc.