Question

We are integrating Magento with an existing system. Our existing system already has order numbers. There has been a lot of confusion since Magento has its own order numbers, and our existing system has different order numbers, so we're trying to get the order numbers to match up.

I have an observer set up for sales_order_place_after where I get the order number from our existing system. It doesn't seem to work to $order->setIncrementId($our_existing_order_id) I don't know if this is really all that good of an idea anyways..

Really, the end goal we want is for the order #s in email receipts that are sent out to match the order #s in our existing systems. Is there a better way to make that happen?

Was it helpful?

Solution

What I would recommend is to create a new field in sales_flat_order to store this id then update the different template as needed to display this number. This way you will have a clean upgrade path in the future

OTHER TIPS

One solution would be to create your own eav entity model. If you look in the eav_entity_type table in the column increment_model you see there is a class path there. Replace those with your own custom model, for example [module]/entity_increment_erp

class [Namespace]_[Model]_Model_Entity_Increment_Erp extends Mage_Eav_Model_Entity_Increment_Abstract
{
    public function getNextId()
    {
        /**
        * your custom code to generate the increment ID, 
        * as long as it is unique
        */

        return $id;
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top