3 replies [Last post]
PaulW's picture
Offline
Joined: 05/23/2008
Juice: 148
Was this information Helpful?

Drupal 5.12
Ubercart 1.16
Website Payment Pro (WPP) LIVE (not sandbox)

I know this has been kicked around, but I don't really see a solution to my exact scenario:

After credit card payment is made, Order History list for the customer (.../user/##/orders) shows the order status as "Completed". However, the Order History detail (.../user/##/order/195) shows the order status as "Pending" in Order Comments.

The Order History list for the admin (.../admin/store/orders) shows the order status as "Completed". However the Order history detail (.../admin/store/orders/195), shows the order status as "Pending" in Order Comments. [same as above.]

The Watchdog record for this order (with debug set on) shows in the array: "[payment_status] => Completed".

Looking at the data, I find:
uc_orders.order_status = "completed"
uc_payment_paypal_ipn.status = "Completed"

So, how do I get the Order Comments field to display "Completed" rather than "Pending"?

Thanks in advance for the help.

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: "Pending" in order history list and "Completed" in order com

Hmm... on the orders, the comments are showing the status of the order when that comment was made. I suppose what you're looking for would require entering an empty order comment (like a -) every time the status is updated so the current status is always reflected in the comments.

PaulW's picture
Offline
Joined: 05/23/2008
Juice: 148
Re: Re: "Pending" in order history list and "Completed" in order

If I understand you correctly, the order_status in uc_order_comments is set when the comment is initiated (at time of order) and remains static, i.e. unchanged.

I have a couple of workflows defined, in part:

Update order status on partial payment
- Invoked on event: A payment gets entered for an order
- Balance is greater than $0.00.
Update order status on full payment
- Invoked on event: A payment gets entered for an order
- Balance is less than or equal to $0.00.

I'm thinking of adding the following PHP code to each:

<?php
$sql
= "SELECT order_status FROM {uc_orders} WHERE uid = [order:order-uid] AND order_id = [order:order-id]";
$newstatus = db_result(db_query($sql));
db_query("UPDATE {uc_order_comments} SET order_status = %s WHERE order_id = %d", $newstatus, [order:order-id]);
?>

Do you think that will keep the order_status synchronized when payment is applied?

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: Re: "Pending" in order history list and "Completed" in o

Well, the problem is this is going to update the status reflect on every comment. The comments are really supposed to show a history of changes, which is why they store the status at the time of. Instead of the code you listed, I'd just go for something like:

<?php
  uc_order_comment_save
($order->order_id, 0, '-', 'order', $order->order_status);
?>