2

The shipment functions seem to be flawed such that shipment.create can trigger an email, but the shipment template includes values that cannot be filled in because tracking numbers cannot be added until after the shipment is created. The workaround seems to be using shipment.addcomment and adjusting that template to include the track fields.

3

I had exactly the same problem and it seems that there is solution without extending the API!

The shipment API has an undocumented function called sendInfo. Thanks to cameronhimself for pointing this.

public function sendInfo($shipmentIncrementId, $comment = '')

So you need something like this (for SOAP V1)

    try { 
            $orderIncrementId = "Your ORDER ID";
            $itemarray = array('3' => '3', '4' => '5'); //your order items id's and qty to ship
            $comments = "some optional comments";
            $email = FALSE; //this is important! You do NOT want to sent the shipping email (email is sent with tracking number later)
            $includeComments = TRUE; //if you want to sent the comments with the email to customer

            $shipment = array($orderIncrementId, $itemarray, $comments, $email, $includeComments);

            $nship = $proxy->call($sessionId, 'sales_order_shipment.create', $shipment); //create the shippment. $nship is the new shipment id

            $proxy->call($sessionId, 'sales_order_shipment.addTrack', array('shipmentIncrementId' => $nship, 'carrier' => 'custom', 'title' => 'CARRIER TITLE', 'trackNumber' => 'YOURTARCKINGNUMBER')); //add the tracking number to shippment

            $proxy->call($sessionId, 'sales_order_shipment.sendInfo', array('shipmentIncrementId' => $nship)); //this is the fun part. Send the email of the shippment WITH the tracking number

        } catch (Exception $e) { 
            echo 'Shipment creation failed on order '. $orderIncrementId . ': ', $e->getMessage(); 
        }
2

You can extend Mage_Sales_Model_Order_Shipment_Api and add another function for this purpose:

  • add the tracking number to the shipment
  • send the shipping email (this can also be a parameter to the function)
  • We don't have the ability to modify the installed build of Magento. I was hoping there was some other method to invoke emails. – andyknas Jan 17 '14 at 16:59
  • then, bad luck. can't do much. – FlorinelChis Jan 17 '14 at 17:02

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.