0

I have to get order status and order title from $order variable. I can get order status by $order->order_status. But I can't able to get order title. So how to get order title value from $order variable programmatically.

I am using the below hook :

  function hook_uc_order($op, $order, $arg2) {
     if ($op == 'update') {
       if (($order->order_status == 'payment_received') && ($order->title == 'My Product')) {
         // Do something with the $order object.
       }
    }
  }

Here $order->order_status is working individually but $order->title is not working. How to get Order Title?

Looking forward for this answer.

4
  • Orders don't have a title... – Clive Mar 27 '17 at 21:01
  • Thanks. So how to get order name or specific product name here? – Selva Mar 27 '17 at 21:13
  • You might need to consider using the devel module and check the variable order by placing this code dsm ( $order ) inside your hook_uc_order. it will display all the variables you need when you load the relevant php page for your custom code. it's really helpful when you are developing a custom module. this is the method in ubecart API to get the product list. [ubecart drupal 7 - uc_order_get_product_list ](api.ubercart.me/api/drupal/…) – danuddara Mar 28 '17 at 1:43
  • dsm($order) is drupal way of dumping the content. it's like var_dump($order) in PHP. more developer friendly interface. – danuddara Mar 28 '17 at 1:49
0

You can get the order title from this method.

   uc_order_page_title($order)

check out all the methods you need for ubecart. ubecart drupal 7 API

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.