I have a custom shipping quote module which adds freight costs to the orders admin comments:

$order_id = intval($_SESSION['cart_order']);
uc_order_comment_save($order_id, 0, t($shippingquote_text), 'admin');

This works correctly when the user goes through the checkout process.

Problem: How do i find the order id when the admin is manually editing a users order?

For example: admin is on admin/store/orders/3845/edit and clicks get shipping quote button - which fires freight quote module

Want: comment is saved to order 3845 w shipping quote details.

My answer below is valid for Ubercart 7.36 as the page doesn't use Ajax.
UberCart 7.38 Uses Ajax, and the same variable isn't available. Still looking for an answer

  • My answer below is valid for Ubercart 7.36 as it doesnt use Ajax.
    – Crab
    Jul 7 '15 at 2:16

I found the answer after posting the question: (Valid for Ubercart 7.36)

if (in_array('administrator', $user->roles)) {
dpm (" do fancy stuff");

$order_id = $_SESSION['ucga_order_id'];
 uc_order_comment_save($order_id, 0, t($admin_text), 'admin');

dpm ("end admin fancy");


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.