5

Our site is sending shipment emails, but the email contains no tracking info. I've created a new template based off of the default one and added {{block type='core/template' area='frontend' template='email/order/shipment/track.phtml' shipment=$shipment order=$order}} but that part of the email is empty. When I click "Track Shipment" in the admin panel, it brings up the tracking number and a link to UPS,

We have a UPS API integrated to create shipments directly from Magento. It appears that the shipment email is being sent before the tracking number comes back. There is also a green status message that says "The shipment has been created." before any of the information like weight and dimensions are entered.

Looks like I get to dig through some code and move some things around.

What could I be missing? Any help would be great here.

  • Having same issue with Magento CE 1.7 – PartialOrder Sep 19 '13 at 13:57
9

Possibly a little late for this, but....

There's a thread on the Magento forums here: http://www.magentocommerce.com/boards/viewthread/9594/

If you look at the code for Mage_Sales_Model_Order_Shipment_Api, the confirmation email is being sent out as part of the create() function. Then, the tracking details are added later with a call to addTrack(), but by that time, the email is already sent.

The suggested solution is to edit the source and move the call to $shipment->sendEmail(), but I suspect that that isn't the most elegant solution - I suspect you'd be better off extending the class instead, and doing it that way.

  • 1
    Thanks, that is exactly what I ended up doing. I never came back here to update, but thanks for the answer – David Wilkins Dec 5 '13 at 18:41
  • 1
    we can make one copy of Mage_Sales_Model_Order_Shipment_Api in local pool, and customize it. – John Yin Feb 19 '15 at 4:45
  • This is gold, exactly what I needed. Thank you. – dchayka Nov 13 '15 at 21:50
0

That solution works for me, but be careful as another file extends the create() function. So you need to also comment the call to $shipment->sendEmail() in Sales/Order/Shipment/Api/V2.php

0

Another approach without editing/extending Magento core is to modify your API call to not send the shipping email in the first place when creating the order. Just send it after adding the tracking code:

  1. Call sales_order_shipment.create with $email = FALSE see Mage_Sales_Model_Order_Shipment_Api and Mage_Sales_Model_Order_Shipment_Api_V2

    public function create($orderIncrementId, $itemsQty = array(), $comment = null, $email = false, $includeComment = false)
    
  2. Add the tracking code by calling sales_order_shipment.addTrack

    public function addTrack($shipmentIncrementId, $carrier, $title, $trackNumber)
    
  3. Call the method sales_order_shipment.sendInfo to trigger the shipment email

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

Thats are actually better than modifying Magento default behavior. Good luck

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.