0

Magento 1.9 dupe entry for UNQ_OZSS_SALES_FLAT_ORDER_INCREMENT_ID (cannot create new order)

In the past we had a store with store id = 23, orders start with 23xxxxxxxxx for increment id

This store was deleted long ago

NOw we created a new store, somehow it got store id = 23

Only the problem is that we cannot create orders because order 230000001 until 2300000022 already exist in sales_flat. Actually 16 orders exist, with some increment_ids missing (e.g. 2300000007 and 2300000010 do not exist)

question: How can we solve this issue? set some increment counter to continue @ 2300000023 or to delete the old orders (if so how)?

Order saving error: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '2300000010' for key 'UNQ_OZSS_SALES_FLAT_ORDER_INCREMENT_ID', query was: INSERT INTO sales_flat_order (coupon_code, protect_code, shipping_description, is_virtual, store_id, customer_id, base_discount_amount, base_grand_total, base_shipping_amount, base_shipping_tax_amount, base_postnl_cod_fee, base_postnl_cod_fee_tax, base_subtotal, base_tax_amount, base_to_global_rate, base_to_order_rate, discount_amount, grand_total, shipping_amount, shipping_tax_amount, postnl_cod_fee, postnl_cod_fee_tax, store_to_base_rate, store_to_order_rate, subtotal, tax_amount, total_qty_ordered, customer_is_guest, customer_note_notify, customer_group_id, quote_id, base_shipping_discount_amount, base_subtotal_incl_tax, shipping_discount_amount, subtotal_incl_tax, weight, customer_dob, increment_id, applied_rule_ids, base_currency_code, customer_email, customer_firstname, customer_lastname, customer_middlename, customer_prefix, customer_suffix, customer_taxvat, discount_description, global_currency_code, order_currency_code, remote_ip, shipping_method, store_currency_code, store_name, x_forwarded_for, customer_note, created_at, updated_at, total_item_count, customer_gender, hidden_tax_amount, base_hidden_tax_amount, shipping_hidden_tax_amount, base_shipping_hidden_tax_amnt, shipping_incl_tax, base_shipping_incl_tax, gift_message_id, gua_client_id, payment_fee_amount, base_payment_fee_amount, payment_installment_fee_amount, base_payment_installment_fee_amount, gua_ua, payment_fee_tax, base_payment_fee_tax, payment_percentage_fee, base_payment_percentage_fee, mailchimp_campaign_id, mailchimp_abandonedcart_flag, mailchimp_landing_page, mollie_mpm_payment_fee, base_mollie_mpm_payment_fee, mollie_mpm_payment_fee_tax, base_mollie_mpm_payment_fee_tax) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, '2021-01-13 08:45:10', '2021-01-13 08:45:10', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

Update: clicked create new order, back, create new order, back until we reached 230000025 that was not used. Success: order creation works. Only now we cannot invoice, because the error is "unable to save invoice"

Help appreciated ;)

enter image description here

1 Answer 1

0

Our resolution is to go to table 'eav_entity_store' check for 4 entities here for your new store id, invoice, credit, shipment, order. Set the starting id

We updated all to starting id 2300000025 (that was free for all entities), save

Then create order, invoice, shipment etc and all worked again

Hope it helps others

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.