3:29 PM
0
Khi gặp lỗi trong quá trình tạo order, shipping, invoice, creditmemo, có thể last increment id đã bị trùng lặp nên không thể tạo đối tượng trên, Lỗi này thường gặp khi migrate data order.

Cách sửa:

1. Bằng tay

Ví dụ với order:
- sales_flat_order: vào bảng này để xem increment_id lớn nhất tương ứng với store_id cần cập nhật.
- eav_entity_type: vào bảng này, xem entity_type_code là order, tìm entity_type_id tương ứng.
- eav_entity_store: vào bảng này, tìm entity_type_id của order (đã tìm ở bảng eav_entity_type) và store_id cần cập nhật, điền last id đã tìm ở bảng sales_flat_order vào cột increment_last_id.
* Với invoice (sales_flat_invoice), creditmemo (sales_flat_creditmemo), shipment (sales_flat_shipment) làm tương tư.

2. Bằng tool

- Download file này về: https://github.com/mage-websd/bug/blob/master/code/sales_increment_insert.php và https://github.com/mage-websd/bug/blob/master/code/sales_increment_update.php
- Cho vào thư mục shell của magento
- Bật terminal, đến đường dẫn của thư mục shell, chạy lệnh: php -f file.php.
- sales_increment_insert.php : thêm last increment id còn thiếu cho các store. Mở file, đến dòng 83, chỉnh sửa stores id, code: $this->_stores = array(2);
- sales_increment_update.php : cập nhật last increment id.

0 comments:

Post a Comment