Order Status Uploads - CV3

From NewHaven Software Wiki

(Difference between revisions)
Jump to: navigation, search
(Data passed to CV3 via web service)
Line 19: Line 19:
*Order shipped on 9/23/2014  
*Order shipped on 9/23/2014  
*Recipient #1 shipped via UPS Ground with tracking number 123  
*Recipient #1 shipped via UPS Ground with tracking number 123  
-
*Recipient #2 shipped via FedEx 2nd Day Air with tracking number 456  
+
*Recipient #2 shipped via FedEx 2-Day with tracking number 456  
{| border="1"
{| border="1"
Line 34: Line 34:
<pre>
<pre>
[order] => Array (
[order] => Array (
-
   [status] => Shipped 9/23/2012
+
   [status] => Shipped 9/23/2014
-
   [tracking] => UPS: 789 ; UPS: 456 ; UPS: 123
+
   [tracking] => UPS: 789 ; FedEx: 456
   [order] => Array (
   [order] => Array (
     [recipID] => Array (
     [recipID] => Array (
-
       [ship_name] => Number
+
       [ship_name] => John
-
       [ship_lastname] => Three
+
       [ship_lastname] => Public
       ...
       ...
-
       [ship_method_name] => UPS Next Day Air
+
       [ship_method_name] => Fedex 2-day
       ...
       ...
       [detail_ship] => 30.00
       [detail_ship] => 30.00
Line 49: Line 49:
</pre>
</pre>
===Website display===
===Website display===
-
Current Status: Shipped 9/23/2012
+
Current Status: Shipped 9/23/2014
'''Tracking information for this order:'''
'''Tracking information for this order:'''
Line 55: Line 55:
&nbsp;&nbsp;&nbsp;&nbsp;UPS - [http://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=789 789]
&nbsp;&nbsp;&nbsp;&nbsp;UPS - [http://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=789 789]
-
&nbsp;&nbsp;&nbsp;&nbsp;UPS - [http://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=456 456]
+
&nbsp;&nbsp;&nbsp;&nbsp;Fedex - [http://www.fedex.com/Tracking?action=track&tracknumbers=456 456]
-
 
+
-
&nbsp;&nbsp;&nbsp;&nbsp;UPS - [http://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=123 123]
+

Revision as of 17:13, 22 June 2015

Contents

CMS

As part of the web service communications between CMS and CommerceV3 (CV3), CMS's eCMS Module uploads status (and tracking number where applicable) for orders that have been set as shipped and have not yet had their status uploaded.

CMS uploads three types of statuses:

  • Shipped {date}
    • If all packages are shipped
  • Processing
    • all new orders imported into CMS
    • Orders that are backordered
    • Orders with no packages
  • Processing : Last Shipment {date}
    • This status will be set for orders that have more than one package and at least one (but not all) packages are shipped

Data passed to CV3 via web service

Example for illustration:

  • Order shipped on 9/23/2014
  • Recipient #1 shipped via UPS Ground with tracking number 123
  • Recipient #2 shipped via FedEx 2-Day with tracking number 456
Status Tracking
Shipped 9/23/2014 UPS: 123 ; FedEx: 456

Formatting the data for site display

CV3 array data in member_orderdetail.tpl

[order] => Array (
  [status] => Shipped 9/23/2014
  [tracking] => UPS: 789 ; FedEx: 456
  [order] => Array (
    [recipID] => Array (
      [ship_name] => John
      [ship_lastname] => Public
      ...
      [ship_method_name] => Fedex 2-day
      ...
      [detail_ship] => 30.00
    )
  )
)

Website display

Current Status: Shipped 9/23/2014

Tracking information for this order:

    UPS - 789

    Fedex - 456


Template modifications

member_orderdetail.tpl

  <input type="hidden" id="memberordertrack" value="{$order.tracking}" />

Used to put the $order.tracking value in the template so it can be accessed by Javascript.

      Current Status: {$order.status|lower|capitalize}<br>
{if $order.tracking != ''}
      <span id="memberOrderTracking">
        <b>Tracking information for this order:</b><br>
      </span>
{/if}

Used to display $order.status as uploaded by CMS, and include a tag for the tracking info if there is any in the PHP arrays. The Javascript function below to populate the info only runs if the span is present.

In js_bottom.js <syntaxhighlight lang="javascript"> //Parse uploaded order status tracking numbers. Mike::NHS::09252012 function parseOrderTracking() {

   var trackdata = document.getElementById('memberordertrack').value,
       tracks = [],
       baseURL = {
           'ups'   :   'http://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=',
           'fedex' :   'http://www.fedex.com/Tracking?action=track&tracknumbers=',
           'usps'  :   'https://tools.usps.com/go/TrackConfirmAction_input?qtc_tLabels1='
       },
       i = 0,
       t = ,
       track = [],
       trackURL = ,
       trackSpan = jQuery('#memberOrderTracking'),
       output = ;
   
   // Split the tracking string.
   tracks = trackdata.split(' ; ');
   
   // Parse the string and output tracking URLs if a tracking number is present
   jQuery.each(tracks, function(i, t) {
       track = t.split(': ');
       if (track.length === 2) {
           trackURL = baseURL[track[0].toLowerCase()] + track[1];
           output = '    ' + track[0] + ' - <a href="' + trackURL + '" target="_blank">' + track[1] + '</a>
'; trackSpan.append(output); } else { // No tracking number for the shipment, so we display nothing for this line. } });

}

$(document).ready(function() { </syntaxhighlight> ... <syntaxhighlight lang="javascript">

   // Only run parseOrderTracking if on member_orderdetail and tracking info is present
   if (jQuery('#memberOrderTracking').length !== 0) {
       parseOrderTracking();
   }

</syntaxhighlight> ... <syntaxhighlight lang="javascript"> }); // end of document.ready </syntaxhighlight>

Personal tools