Mage2StockItem

Hi during importing multi store we have the follow errors:
Mage2StockItem: Qty is too long (maximum is 12 characters).
-- Max Sale Qty is too long (maximum is 12 characters).
How to fix this?
 
cheers,
 
marcel
 

11 answers

Profile photo of Mall Staff 184060.00 $tone June 7, 2017
Public

Hi there,

Mage2StockItem: Qty is too long (maximum is 12 characters).
— Max Sale Qty is too long (maximum is 12 characters).

That issue because your database has some bad data in the value of qty field in the table cataloginventory_stock_item
To solve that, let’s do steps as bellow:
-- Open the php file at path pub/ub-tool/protected/controllers/Step5Controller.php
and fine to the code line:

if (in_array($key, array('notify_stock_qty')) AND strlen($stockItem2->$key) > 12) {

and replace it by code line:

if (in_array($key, array('notify_stock_qty', 'qty')) AND strlen($stockItem2->$key) > 12) {

-- Once done, you can continue with data migration in the step #5.
Regards,
Mall.
 

#1
Profile photo of Mall Staff 184060.00 $tone June 7, 2017
Public

Hi there,

Mage2StockItem: Max Sale Qty is too long (maximum is 12 characters).

I am missing that case. Let’s do more steps as bellow:
— Open the php file at path pub/ub-tool/protected/controllers/Step5Controller.php
and fine to the code line:

if (in_array($key, array('notify_stock_qty', 'qty')) AND strlen($stockItem2->$key) > 12) {

and replace it by code line:

if (in_array($key, array('notify_stock_qty', 'qty', 'max_sale_qty')) AND strlen($stockItem2->$key) > 12) {

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

Regards,
Mall.

#4
Profile photo of mediameta 650.00 $tone February 27, 2018
Public

Hi Mall,
In the last version i get again: Mage2StockItem: Max Sale Qty is too long (maximum is 12 characters).
Step5Controller.php file gives 2 times the rule:
if (in_array($key, array(‘notify_stock_qty’)) AND $stockItem2->$key AND strlen($stockItem2->$key) > 12) {
$stockItem2->$key = substr($stockItem2->$key, 0, 12);
Do i have to change them both?

#7
Profile photo of mediameta 650.00 $tone February 27, 2018
Public

Correction. i see one with max_sale_qty and an else with 
if (in_array($key, array(‘notify_stock_qty’)) AND $stockItem2->$key AND strlen($stockItem2->$key) > 12) {
$stockItem2->$key = substr($stockItem2->$key, 0, 12);

#8
Profile photo of Mall Staff 184060.00 $tone February 27, 2018
Public

Hi Marcel,

Do i have to change them both?

Yes. As this circumstance occurs for your specific case only, please apply that tweak code to handle for your bad data. 
Regards,
Mall.

#9
Profile photo of Mall Staff 184060.00 $tone February 27, 2018
Public

Hi there,

getting next error:
Mage2CatalogProductBundleOption: Parent Id cannot be blank.

That because your M1’s database has at least one record which has bad data in field catalog_product_bundle_option.parent_id
To solve that issue you could try with steps as followings:
+ Step 1: Backup current M1’s database
+ Step 2: Clean some records which has bad data by run below SQL statement in your M1’s database:

DELETE FROM `catalog_product_bundle_option` WHERE `parent_id` IS NULL OR `parent_id` NOT IN (SELECT entity_id FROM catalog_product_entity);

+ Step 3: Once done, you could continue with data migration in the step #5 of our tool.
And tell me know how it goes.
Regards,
Mall.
 

#11

Please login or Register to Submit Answer

Written By

Comments