Error at step 7

CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘2’ for key ‘PRIMARY’. The SQL statement executed was: INSERT INTO `salesrule` (`uses_per_customer`, `is_active`, `stop_rules_processing`, `is_advanced`, `sort_order`, `discount_amount`, `discount_step`, `apply_to_shipping`, `times_used`, `is_rss`, `coupon_type`, `use_auto_generation`, `uses_per_coupon`, `simple_free_shipping`, `rule_id`, `name`, `from_date`, `conditions_serialized`, `actions_serialized`, `simple_action`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5, :yp6, :yp7, :yp8, :yp9, :yp10, :yp11, :yp12, :yp13, :yp14, :yp15, :yp16, :yp17, :yp18, :yp19)

5 answers

Profile photo of Mall Staff 184060.00 $tone January 4, 2018
Public

Hi there,

CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘2’ for key ‘PRIMARY’. The SQL statement executed was: INSERT INTO `salesrule` (`

Seem your database has some sample data and you have checked ‘KEEP ORIGINAL IDS’ option in settings in step #7 of our tool.
If your database has sample data, you can’t check ‘KEEP ORIGINAL IDS’ option in the step #7.
Regards,
Mall.

#1
Profile photo of rosemaria 120.00 $tone January 4, 2018
Public

ok, done. But now migration stops :
 

CDbCommand failed to execute the SQL statement: SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect string value: ‘\xC4’ for column ‘postcode’ at row 1. The SQL statement executed was: INSERT INTO `quote_address` (`quote_id`, `updated_at`, `save_in_address_book`, `same_as_billing`, `collect_shipping_rates`, `weight`, `subtotal`, `base_subtotal`, `subtotal_with_discount`, `base_subtotal_with_discount`, `tax_amount`, `base_tax_amount`, `shipping_amount`, `base_shipping_amount`, `discount_amount`, `base_discount_amount`, `grand_total`, `base_grand_total`, `free_shipping`, `created_at`, `address_type`, `email`, `firstname`, `lastname`, `street`, `city`, `postcode`, `country_id`, `telephone`, `fax`, `shipping_tax_amount`, `base_shipping_tax_amount`, `applied_taxes`, `subtotal_incl_tax`, `shipping_incl_tax`, `base_shipping_incl_tax`, `base_cod_fee`, `cod_fee`, `base_cod_tax_amount`, `cod_tax_amount`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5, :yp6, :yp7, :yp8, :yp9, :yp10, :yp11, :yp12, :yp13, :yp14, :yp15, :yp16, :yp17, :yp18, :yp19, :yp20, :yp21, :yp22, :yp23, :yp24, :yp25, :yp26, :yp27, :yp28, :yp29, :yp30, :yp31, :yp32, :yp33, :yp34, :yp35, :yp36, :yp37, :yp38, :yp39)

#2
Profile photo of Mall Staff 184060.00 $tone January 4, 2018
Public

Hi there,

CDbCommand failed to execute the SQL statement: SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect string value: ‘\xC4’ for column ‘postcode’ at row 1.

As you see, that issue because your database has at least one records has bad data in the value of the sales_flat_quote_address.postcode field (\xC4)
To handle for that, you could try with steps as followings:
+ Open the php file at path: pub/ub-tool/protected/controllers/Step7Controller.php
and find to the code line:

if (in_array($key, array('region', 'city')) AND strlen($val) > 40) {

and replace it by code line:

if ($key == 'postcode') { $val = addslashes($val); }

Once done, let continue with data migration in the step #7 and tell me know how it goes then.
Regards,
Mall.

#3
Profile photo of rosemaria 120.00 $tone January 4, 2018
Public

Ok, but now:

Mage2SalesQuoteAddress: Postcode is too long (maximum is 20 characters).

I checked in db
SELECT * FROM sales_flat_order_address WHERE LENGTH(postcode) > 19;
And there are no records longer than 19

#4
Profile photo of Mall Staff 184060.00 $tone January 5, 2018
Public

Hi there,

Mage2SalesQuoteAddress: Postcode is too long (maximum is 20 characters).

With that issue, you have to look in the table named ‘sales_flat_quote_address’ by use SQL command:

SELECT * FROM sales_flat_quote_address WHERE LENGTH(postcode) > 19;

Regards,
Mall.

#5

Please login or Register to Submit Answer

Written By

Comments