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
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.
Thanks mall,
But we change the code but stil giving error:
Mage2StockItem: Max Sale Qty is too long (maximum is 12 characters).
its in step 5 of migrating products.
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.
tanks import is working perfect now.
Hi there,
Please get back to us here if you need further assistance.
Best Regards,
Sarah
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?
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);
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.
getting next error:
Mage2CatalogProductBundleOption: Parent Id cannot be blank.
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.