cancel
Showing results for 
Search instead for 
Did you mean: 

Trigger Send Tracking Information Email

Trigger Send Tracking Information Email

I am interfacing with Magento using SOAP PHP code.  I am using the API methods sales_order_shipment.create and sale_order_shipment.addTrack to upload shipping information from my client's ERP system.  I have been searching for a method to trigger the Send Shipping Information function.  I have been searching and have not been able to find a solution.  Is there an argument in the array that will trigger the email?


Below is a snpiet of my php code:

$filename = "\\php\\upload\\";
$filename .= $argv[2];
$filename .= '.txt';
$data = array();
if (($handle = fopen($filename,'r')) != FALSE)
{
    while (($row = fgetcsv($handle,100,'~')) != FALSE)
    {
        $filter = array(array(
           'sku'=>array('eq'=>$row[0])
        ));
        $result = $client->call($session, 'catalog_product.list', $filter);
        $row[0] = $result[0]["product_id"];
        $data = array_merge($data, $row);
    }
    fclose($handle);
    $result = $client->call($session, 'sales_order_shipment.create', array($argv[1], $data));
} else {
    $result = $client->call($session, 'sales_order_shipment.create', $argv[1]);
}

4 REPLIES

Re: Trigger Send Tracking Information Email

When you create shipment you can send email.

 

Method:

  • sales_order_shipment.create (SOAP V1)
  • salesOrderShipmentCreate (SOAP V2)

 

There are parameter to send the email:

 

Arguments:

Type Name Description
stringsessionIdSession ID
stringorderIncrementIdOrder increment ID
arrayitemsQtyArray of orderItemIdQty (optional)
stringcommentShipment comment (optional)
intemail Send email flag (optional)
intincludeComment

Include comment in email flag (optional_

 

You need to send this parameter to send email. However if you didnt add any tracking numbersthe email will not have tracking information.

 

By default once you create shipment you will be able to send tracking email only with comment with SOAP.

I had once similaer issue so for me was easier hust ot make extension with extended API which will have send tracking email options once it addded with API. 

 

Thank you

Re: Trigger Send Tracking Information Email

Thank you so much.  When I was reviewing the API documentation I did not see the last 2 additional arguments for that method.  I must have been blind.

Re: Trigger Send Tracking Information Email

Question:

 

Since you upload tracking information after you create a shipment using a different method, can you do the sales_order_shipment.create again to trigger the email?  Or will that create another shipment?  I think it will try to add another shipment but will fail because the order is satisfied and complete with the first create shipment method.

Re: Trigger Send Tracking Information Email

Actually I found the solution from StackOverflow.  There is a undocumented API method sale_order_shipment.sendInfo(sessionId, comment).  I was able to trigger the email after the tracking numbers were added.