Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I am looking for a way for our admin users on a Drupal Commerce site to look up customer profiles from previous orders, and upon looking at a specific customer profile, provide a button that allows then to create an order for that customer. This use case is for a call center.

So far, I have tried using Button Field to call a rule component but I have having problems writing the rule.

Looking up previous orders and creating a new order with information for the shipping profile attached would also be a viable alternative.

Any suggestions regarding approach or use of modules would be welcome.

Thanks!

share|improve this question

1 Answer 1

Things like this, is much easier to accomplish with a bit of custom code. You could add a form on the order view page, with the order as the context. This can be done by using hook_commerce_order_view.

All you really need to do, in the submit handler would be something like this.

$old_order //
$new_order = commerce_order_new();
$new_order->uid = $old_order->uid;
$new_order->commerce_shipping_profile = $old_order->commerce_shipping_profile;
commerce_order_save($new_order);
$form_state['redirect'] = 'admin/commerce/order/' . $new_order->order_id . '/edit';

The code above is from memory, should be in a form submit handler and is written from memory, but should work, if I remembered correctly. As you can see, it's pretty simple to accomplish.

share|improve this answer
    
thanks for the reply, our team will try it out shortly and post our results –  Stan Ascher Dec 20 '12 at 14:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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