I need help please!

My client is working with a third party that updates programatically the status of orders with the SOAP API. When they do, Magento sends an email to inform customer that order has been shipped. Then they add the tracking number and nothing is sent to inform customer.

Their system uses the functions Create and addtrack in app/code/core/Mage/Sales/Model/Order/Shipment/Api.php

So I created a custom module to modify these functions. Unfortunately, nothing is happening. Customers just receive the shipment email without tracking number.

I've checked and my module devm2w_trackship is showing in Magento backend > system > configuration > advanced so i assume the declaration of the module is good. Edit-- here is my declaration in etc/modules/

<?xml version="1.0" ?>

Here is my config.xml in app/code/local/devm2w/trackship/

    <?xml version="1.0"?>

And here is my Api.php file in Model/Sales


class devm2w_trackship_Model_Sales_Order_Shipment_Api extends Mage_Sales_Model_Order_Shipment_Api

     public function create($orderIncrementId, $itemsQty = array(), $comment = null, $email = false,
        $includeComment = false
    ) {
        $order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);

          * Check order existing
        if (!$order->getId()) {

         * Check shipment create availability
        if (!$order->canShip()) {
             $this->_fault('data_invalid', Mage::helper('sales')->__('Cannot do shipment for order.'));

         /* @var $shipment Mage_Sales_Model_Order_Shipment */
        $shipment = $order->prepareShipment($itemsQty);
        if ($shipment) {
            $shipment->addComment($comment, $email && $includeComment);
            if ($email) {
            try {
                $transactionSave = Mage::getModel('core/resource_transaction')
               /* $shipment->sendEmail($email, ($includeComment ? $comment : '')); */
            } catch (Mage_Core_Exception $e) {
                $this->_fault('data_invalid', $e->getMessage());
            return $shipment->getIncrementId();
        return null;

     * Add tracking number to order
     * @param string $shipmentIncrementId
     * @param string $carrier
     * @param string $title
     * @param string $trackNumber
     * @return int
    public function addTrack($shipmentIncrementId, $carrier, $title, $trackNumber)
        $shipment = Mage::getModel('sales/order_shipment')->loadByIncrementId($shipmentIncrementId);

        /* @var $shipment Mage_Sales_Model_Order_Shipment */

        if (!$shipment->getId()) {

        $carriers = $this->_getCarriers($shipment);

        if (!isset($carriers[$carrier])) {
            $this->_fault('data_invalid', Mage::helper('sales')->__('Invalid carrier specified.'));

        $track = Mage::getModel('sales/order_shipment_track')


        try { 
        } catch (Mage_Core_Exception $e) { 
            $this->_fault(’data_invalid’, $e->getMessage()); 
        return $track->getId();


Please help,


  • I tried my code by copying it in the local folder and evrything works fine. do I have a conflict anywhere?
    – Antho Ny
    Mar 9, 2015 at 19:08

1 Answer 1


It sounds to me that you file in app/etc/modules/Your_Module.xml is pointing to the local codePool.

And beside that you have to use the MagentoFirstWordCasing so Magento bootstrap can load you models correctly.

Maybe you are developing on Windows, which is case insensitive and your production server is not.


  • Thanks Jeroen, I edited my question with my etc/modules file. Do you see anything weird? About First Case, I will try it, see if it changes anything.
    – Antho Ny
    Mar 12, 2015 at 15:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.