Magento – Magento Each New Invoice Increment Id Increment By 5

databaseeavinvoicemagento-1.8

I need to increment each new invoice id by 5, i have tried below code.

But changed all invoices, shipments, orders and credit memos.

I need each new invoice id increment by 5, shipments increment by 5 and credit memos increment by 3.

Also sales order increment by 1(normal).

How can i do this .?

Any one help me.

class Mage_Eav_Model_Entity_Increment_Numeric extends Mage_Eav_Model_Entity_Increment_Abstract    
{
   public function getNextId()
    {
        $last = $this->getLastId();

        if (strpos($last, $this->getPrefix()) === 0) {
            $last = (int)substr($last, strlen($this->getPrefix()));
        } else {
            $last = (int)$last;
        }

        $next = $last + 5;

        return $this->format($next);
    }
}

Best Answer

You can write the triggers for ID or you can write procedure to change the autoincrement id to set to +5 each time whenever a record is inserted. Make sure to alter parent-child relationships.

Related Topic