Tag: payment failed

Fixing Duplicate Entry Error From Custom Order Prefix

This is something we ran into during the testing of a new Magento website. We started getting “Payment Transaction Failed Reminder” emails from the system. The client reported that they would just be presented with an error message during checkout when they tried to place the order and it would just keep returning the error no matter how many times they tried to submit it.

Looking at the email sent by the system, the error message being returned was:

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘T000112’ for key 2

After investigating a bit, I found that someone else had already placed an order and taken that increment_id which is why this order was returning an error. This was a bit odd since Magento is supposed to be keeping track of these things and automatically ensure order numbers are never the same. Even looking at the sales_flat_quote table showed two entries with the same reserved_order_id which should not happen.
Continue reading