Question

I know that, Magento has it's own way of generating order ids for orders placed through it.

Instead of the default way, I want to set product sku as the prefix for order-ids and keep order increment id as it is.

Is there any way to achieve this in Magento?

Was it helpful?

Solution

No, the order ID is an integer value. Example:

  • order_id = 1
  • increment_id = "1000000001"

It might be possible the other way around, though. You can create your own increment model for orders to define arbitrary logic for the increment id.

You will need to implement Mage_Eav_Model_Entity_Increment_Interface with the method getNextId().

It is not intended to access the actual order data at this point, but since it is called during order creation, you should be able to call Mage::registry('current_order') and look through the order items and their SKU.

Further reading: Magento Tutorial: How to Use Increment Models to Generate IDs (or SKUs)

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top