Error when migrating products

I am getting the following error when migrating products:
 

Mage2CatalogProductEntityVarchar: Value is too long (maximum is 255 characters)

I am migrating from V1.9.1.0 to V2.1.7 if that helps at all. So far I have imports steps 1, 2, 3, 4 and 6. However to move to 7 I need 5 apparently.
Any idea on the cause and how to fix it?
Also, ideally I would like to just migrate sales/customer data as I am going to integrate products and categories myself later. If need be I can import and delete these manually but if there is a way to skip these steps and just have sales and customers that would be appreciated.

  1. Profile photo of transparenttransparent 30.00 $tone January 18, 2018
    Hi Mall,Thanks for the reply. I've implemented these changes however I'm still getting the same error - even after re-compiling, clearing caches etc. Any ideas why? Thanks.
  2. Profile photo of transparenttransparent 30.00 $tone January 19, 2018
    Hi Mall,Thanks for the reply. This was actually a silly mistake on my part (forgot to save the file). Got it working now and the products seem to have imported fine. I'm having a new problem now when I import order. Here's the error:2018/01/18 11:10:00 [error] [ub_data_migration] CDbCommand failed to execute the SQL statement: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'firstname' 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`, `created_at`, `address_type`, `email`, `firstname`, `company`, `street`, `city`, `region`, `postcode`, `country_id`, `shipping_method`, `shipping_description`, `shipping_tax_amount`, `base_shipping_tax_amount`, `applied_taxes`, `shipping_discount_amount`, `base_shipping_discount_amount`, `subtotal_incl_tax`, `shipping_incl_tax`, `base_shipping_incl_tax`, `free_shipping`) 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) Any idea why this is happening, seem to get through quite a few 1000 orders then the error appears?
  3. Profile photo of transparenttransparent 30.00 $tone January 20, 2018
    Hi Mall,I've just ran that query on the Mage 1 db in MySQL and it returns an empty set implying there aren't any firstnames > 255. Tried re-running the migration step too with no such luck - same error.Any other ideas on how to get round this?
  4. Profile photo of transparenttransparent 30.00 $tone January 23, 2018
    Hey Mall, any thoughts on my last post?

4 answers

Profile photo of Mall Staff 178940.00 $tone January 16, 2018
Public

Hi there,

Mage2CatalogProductEntityVarchar: Value is too long (maximum is 255 characters)
Any idea on the cause and how to fix it?

That issue was because your database has some records that have bad data in the value of of the catalog_category_entity_varchar.value field.
To solve that, you could do steps as follows:
+ Open the php file at: pub/ub-tool/protected/controllers/Step5Controller.php
and find the lines:

} else if ($className2 == 'Mage2CatalogProductEntityVarchar' AND $attribute1->attribute_code == 'url_path') {
if (preg_match("/.html/i", $model2->value)) {
$model2->value = str_replace('.html', '', $model2->value);
}
}

and replace it with the following lines:

} else if ($className2 == 'Mage2CatalogProductEntityVarchar') {
if ($attribute1->attribute_code == 'url_path' && preg_match("/.html/i", $model2->value)) {
$model2->value = str_replace('.html', '', $model2->value);
}
//Tuning to handle for case: https://www.ubertheme.com/question/error-when-migrating-products/
if (strlen(trim($model2->value)) > 255) {
$model2->value = substr(trim($model2->value), 0, 12);
}
}

Once done, you can continue data migration in the step #5

Also, ideally I would like to just migrate sales/customer data as I am going to integrate products and categories myself later.

As the sales data sections have relationship with catalog data and customers data, the feature you mentioned was not supported by our tool. Anyway, you can disable or delete the un-used data after complete data migration.
Also please note that, you shouldn’t delete the migrated items if you wish to proceed delta migration with our tool later on.
Regards,
Mall.

#1
Profile photo of Mall Staff 178940.00 $tone January 18, 2018
Public

Hi there,

 I’ve implemented these changes however I’m still getting the same error -- even after re-compiling, clearing caches etc. Any ideas why?

So, that is strange. Let’s provide me the information about your working as followings:
+ Admin credentials and site URL
+ SSH credentials and web root path of your M2 instance.
I will check further in your instance and help you out.
Regards,
Mall.

#2
Profile photo of Mall Staff 178940.00 $tone January 19, 2018
Public

Hi there,

String data, right truncated: 1406 Data too long for column ‘firstname’ at row 1. The SQL statement executed was: INSERT INTO 

That issue because your M1’s database has bad data in the value of the sales_flat_quote_address.firstname field.
You could use below SQL to check again your records which has bad data:
Select * from sales_flat_quote_address Where LENGTH(firstname) > 255;
And then, re-correct your data manual.
Once done, you could continue with data migration with our tool.
Regards,
Mall.

#3
Profile photo of Mall Staff 178940.00 $tone January 23, 2018
Public

Hi there,

I’m having a new problem now when I import order. Here’s the error:2018/01/18 11:10:00 [error] [ub_data_migration] CDbCommand failed to execute the SQL statement: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column ‘firstname’ at row 1. The SQL statement executed was: INSERT INTO `quote_address` (`quote_id`, `updated_at`, `save_in_address_book`, 

You should consider to upgrade to Magento2.1.9 or later version now. Because that M1’s data will be accepts in Magento2.1.9 and later version of Magento2 database.
You could see more these screenshots: 
http://i.prntscr.com/d7JhWhcKS6SirmhYAUFeDQ.png
http://i.prntscr.com/1H9pdLjcRd_unXzJT_pTGA.png

Regards,
Mall.
 

#4

Please login or Register to Submit Answer

Written By

Comments