Mage2CatalogProductEntityDecimal: Value is too lon

Hi,
When trying to migrate products we are getting the following error:
[error] [ub_data_migration] Mage2CatalogProductEntityDecimal: Value is too long (maximum is 12 characters).
Thanks,
Dene
 
 

3 answers

Profile photo of Mall Staff 184060.00 $tone January 20, 2017
Public

Hi samturners,

[error] [ub_data_migration] Mage2CatalogProductEntityDecimal: Value is too long (maximum is 12 characters).

That because your Magento 1 database has some bad data with new rules of Magento2 in table catalog_product_entity_decimal table.
To handle that, let’s open the php file at the path: pub/ub-tool/protected/controllers/Step5Controller.php
and find to the code lines:

$model2->value = $model->value;
if ($table == 'catalog_product_entity_int') {

and replace it by code lines:

$model2->value = $model->value;
if ($table == 'catalog_product_entity_decimal') {
if (strlen($model2->value) > 12) {
$model2->value = substr($model2->value, 0, 12);
}
} else if ($table == 'catalog_product_entity_int') {

and reset the step #5 and re-start data migration in this step.
And contact me if you need further assistance.
Regards,
Mall.

#1
Profile photo of samturners 0.00 $tone January 20, 2017
Public

Hi Mall,
That worked thanks but we now have a new error when running Migrate Others:
[error] [ub_data_migration] Mage2TaxOrderAggregatedCreated: Order Status cannot be blank.
Regards,
Dene

#2
Profile photo of Mall Staff 184060.00 $tone January 20, 2017
Public

Hi

[error] [ub_data_migration] Mage2TaxOrderAggregatedCreated: Order Status cannot be blank.

That come from you have bad data in the table.
To handle that, let’s open the php file at: pub/ub-tool/protected/controllers/Step8Controller.php
and find to the code lines:

private function _migrateTaxOrderAggregated($models, $modelClass, $mappingStores)
{
foreach ($models as $model) {
$storeId2 = isset($mappingStores[$model->store_id]) ? $mappingStores[$model->store_id] : null;
$con = "period = '{$model->period}' AND order_status = '{$model->order_status}'";
$con .= " AND code = '{$model->code}' AND percent = {$model->percent}";
if (!is_null($storeId2)) {
$con .= " AND store_id = {$storeId2}";
} else {
$con .= " AND store_id IS NULL";
}
$model2 = $modelClass::model()->find($con);
if (!$model2) {
$model2 = new $modelClass();
foreach ($model2->attributes as $key => $value) {
if (isset($model->$key)) {
$model2->$key = $model->$key;
}
}
$model2->id = null;
$model2->store_id = $storeId2;
//save
if (!$model2->save()) {
$this->errors[] = get_class($model2) . ": " . UBMigrate::getStringErrors($model2->getErrors());
} else {
//for trace in CLI only
if ($this->isCLI) {
echo ".";
}
}
}
}

return true;
}

and replace it by code lines:

private function _migrateTaxOrderAggregated($models, $modelClass, $mappingStores)
{
foreach ($models as $model) {
if ($model->order_status) {
$storeId2 = isset($mappingStores[$model->store_id]) ? $mappingStores[$model->store_id] : null;
$con = "period = '{$model->period}' AND order_status = '{$model->order_status}'";
$con .= " AND code = '{$model->code}' AND percent = {$model->percent}";
if (!is_null($storeId2)) {
$con .= " AND store_id = {$storeId2}";
} else {
$con .= " AND store_id IS NULL";
}
$model2 = $modelClass::model()->find($con);
if (!$model2) {
$model2 = new $modelClass();
foreach ($model2->attributes as $key => $value) {
if (isset($model->$key)) {
$model2->$key = $model->$key;
}
}
$model2->id = null;
$model2->store_id = $storeId2;
//save
if (!$model2->save()) {
$this->errors[] = get_class($model2) . ": " . UBMigrate::getStringErrors($model2->getErrors());
} else {
//for trace in CLI only
if ($this->isCLI) {
echo ".";
}
}
}
}
}

return true;
}

And reset data migration in the step #8 and restart data migration in this step.
And tell me know how it goes.
Regards,
Mall.

#3

Please login or Register to Submit Answer

Written By

Comments