Discussions

Adding comment to an excisting order

I've set up a commerce site with a couple of contrib modules: shipping, paypal & ogone. For shipping my customer would like to use FedEX and he wants to add a tracking number to the order overview so his customers can track it on the FedEX website.

Could anyone give me some tips on how to do this.

thx

Posted: Aug 12, 2011

Comments

snowfox on September 16, 2011

I was able to figure this out thanks to the IRC chat room (Thanks bojanz!).

  1. Create Tracking field as custom field
    • Store » Configuration » Order settings » Manage Fields
    • Create field, make it a text field, save
  2. Assign Tracking number to Order
    • Store » Orders » Edit an order
    • Paste in FedEx number
  3. Update customer via email of new tracking number
    • This really depends on your site settings, so I won't go into detail.

bhans on December 30, 2012

Anyone have an idea on how to add a link, including the tracking number, to open the shippers tracking page?
I have the URL's, I just can't quite figure out how get the tracking number from the text field to include it in the URL in the link field.
Or, is there a better/another way to do it.

tars16 on March 22, 2013

For anyone that might be interested, here is my solution:

Building out #3 via rules I configured a rule:

Event: After saving an existing commerce order

Conditions:
Data Comparison: commerce-order:type equals Order
AND
NOT Data value is empty - commerce-order:field-tracking-number (check the negate checkbox)
AND
Data Comparison: commerce-order:status equals Completed
AND
NOT Data Comparison: commerce-order:status equals commerce-order-unchanged:status (check the negate checkbox)

Actions:
Send Email - to address: [commerce-order:owner:mail] use [commerce-order:field-tracking-number] as your tracking # in the body.

The machine name of my field is: field_tracking_number (for the second condition)

The above solution will send an email to the order owner's email address when the order status is set to completed and a tracking number is present.

In my case I also added an additional Boolean field called "field_tracking_email_sent" to indicate to my admins that an email had already been sent. This field is a single on/off checkbox. I added a condition to check it was empty and added an action to set the value when the rule is triggered.

With this approach, the admin can uncheck the box, set the order to pending and then reset the order to completed to have the tracking # sent again.