Magento2: Undefined variables during product save

Created on 8 Aug 2018  ·  40Comments  ·  Source: magento/magento2

The issue reporting template does not provide guides for missing keys specifically. I have attempted to fit in the missing isset() checks I have noticed

Preconditions

  1. Magento CE 2.2.5

Steps to reproduce

  1. Create Configurable Product
  2. Before saving the parent product, make sure that at least one configuration has a SKU that is longer than allowed.
  3. Save and the validation will complain about the length exceeding 64 characters
  4. Correct the SKU and make sure the length is shorter than the limit of 64 characters
  5. Save the product. The error is now reproduced.

Expected result

Expected product to be created and indexed properly.

Actual result

Error 1

The Magento error report was displayed with the mention of an undefined variable product in the save.php:
{ "0":"Notice: Undefined variable: product in \/MASKED_DIR/2018-08-06_12-56-07\/htdocs\/vendor\/magento\/module-catalog\/Controller\/Adminhtml\/Product\/Save.php on line 156", "1":"#0 \/MASKED_DIR/2018-08-06_12-56-07\/htdocs\/vendor\/magento\/module-catalog\/Controller\/Adminhtml\/Product\/Save.php(156): Magento\\Framework\\App\\ErrorHandler->handler(8, 'Undefined varia...', '\/opt\/vaimo\/depl...', 156, Array)\n#1 \/MASKED_DIR/2018-08-06_12-56-07\/htdocs\/vendor\/magento\/framework\/App\/Action\/Action.php(107): Magento\\Catalog\\Controller\\Adminhtml\\Product\\Save->execute()\n#2 \/MASKED_DIR/2018-08-06_12-56-07\/htdocs\/vendor\/magento\/module-backend\/App\/AbstractAction.php(229): Magento\\Framework\\App\\Action\\Action->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n#3 \/MASKED_DIR/2018-08-06_12-56-07\/htdocs\/vendor\/magento\/framework\/Interception\/Interceptor.php(58): Magento\\Backend\\App\\AbstractAction->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n#4 \/MASKED_DIR/2018-08-06_12-56-07\/htdocs\/vendor\/magento\/framework\/Interception\/Interceptor.php(138): Magento\\Catalog\\Controller\\Adminhtml\\Product\\Save\\Interceptor->___callParent('dispatch', Array)\n#5 \/MASKED_DIR/2018-08-06_12-56-07\/htdocs\/vendor\/magento\/module-backend\/App\/Action\/Plugin\/Authentication.php(143): Magento\\Catalog\\Controller\\Adminhtml\\Product\\Save\\Interceptor->Magento\\Framework\\Interception\\{closure}(Object(Magento\\Framework\\App\\Request\\Http))\n#6 \/MASKED_DIR/2018-08-06_12-56-07\/htdocs\/vendor\/magento\/framework\/Interception\/Interceptor.php(135): Magento\\Backend\\App\\Action\\Plugin\\Authentication->aroundDispatch(Object(Magento\\Catalog\\Controller\\Adminhtml\\Product\\Save\\Interceptor), Object(Closure), Object(Magento\\Framework\\App\\Request\\Http))\n#7 \/MASKED_DIR/2018-08-06_12-56-07\/htdocs\/vendor\/magento\/framework\/Interception\/Interceptor.php(153): Magento\\Catalog\\Controller\\Adminhtml\\Product\\Save\\Interceptor->Magento\\Framework\\Interception\\{closure}(Object(Magento\\Framework\\App\\Request\\Http))\n#8 \/MASKED_DIR/2018-08-06_12-56-07\/htdocs\/generated\/code\/Magento\/Catalog\/Controller\/Adminhtml\/Product\/Save\/Interceptor.php(26): Magento\\Catalog\\Controller\\Adminhtml\\Product\\Save\\Interceptor->___callPlugins('dispatch', Array, NULL)\n#9 \/MASKED_DIR/2018-08-06_12-56-07\/htdocs\/vendor\/magento\/framework\/App\/FrontController.php(55): Magento\\Catalog\\Controller\\Adminhtml\\Product\\Save\\Interceptor->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n#10 \/MASKED_DIR/2018-08-06_12-56-07\/htdocs\/vendor\/magento\/framework\/Interception\/Interceptor.php(58): Magento\\Framework\\App\\FrontController->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n#11 \/MASKED_DIR/2018-08-06_12-56-07\/htdocs\/vendor\/magento\/framework\/Interception\/Interceptor.php(138): Magento\\Framework\\App\\FrontController\\Interceptor->___callParent('dispatch', Array)\n#12 \/MASKED_DIR/2018-08-06_12-56-07\/htdocs\/vendor\/magento\/framework\/Interception\/Interceptor.php(153): Magento\\Framework\\App\\FrontController\\Interceptor->Magento\\Framework\\Interception\\{closure}(Object(Magento\\Framework\\App\\Request\\Http))\n#13 \/MASKED_DIR/2018-08-06_12-56-07\/htdocs\/generated\/code\/Magento\/Framework\/App\/FrontController\/Interceptor.php(26): Magento\\Framework\\App\\FrontController\\Interceptor->___callPlugins('dispatch', Array, Array)\n#14 \/MASKED_DIR/2018-08-06_12-56-07\/htdocs\/vendor\/magento\/framework\/App\/Http.php(135): Magento\\Framework\\App\\FrontController\\Interceptor->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n#15 \/MASKED_DIR/2018-08-06_12-56-07\/htdocs\/vendor\/magento\/framework\/Interception\/Interceptor.php(58): Magento\\Framework\\App\\Http->launch()\n#16 \/MASKED_DIR/2018-08-06_12-56-07\/htdocs\/vendor\/magento\/framework\/Interception\/Interceptor.php(138): Magento\\Framework\\App\\Http\\Interceptor->___callParent('launch', Array)\n#17 \/MASKED_DIR/2018-08-06_12-56-07\/htdocs\/vendor\/magento\/framework\/Interception\/Interceptor.php(153): Magento\\Framework\\App\\Http\\Interceptor->Magento\\Framework\\Interception\\{closure}()\n#18 \/MASKED_DIR/2018-08-06_12-56-07\/htdocs\/generated\/code\/Magento\/Framework\/App\/Http\/Interceptor.php(26): Magento\\Framework\\App\\Http\\Interceptor->___callPlugins('launch', Array, Array)\n#19 \/MASKED_DIR/2018-08-06_12-56-07\/htdocs\/vendor\/magento\/framework\/App\/Bootstrap.php(256): Magento\\Framework\\App\\Http\\Interceptor->launch()\n#20 \/MASKED_DIR/2018-08-06_12-56-07\/htdocs\/pub\/index.php(37): Magento\\Framework\\App\\Bootstrap->run(Object(Magento\\Framework\\App\\Http\\Interceptor))\n#21 {main}", "url":"\/MASKED\/catalog\/product\/save\/id\/301\/type\/simple\/store\/0\/set\/14\/key\/f7cca584661b838238aa1d82c6acbfd44a4217a38fe0ec2ea7ba1ec8d529b0ef\/back\/edit", "script_name":"\/index.php" }

I looked the save.php through, and the $product variable is declared within try and thus not available in the catch.

Error 2

Happens in the getVariationMatrix() function of Configurable.php. Apparently the $item does not contain the index newProduct and throws a notice.
Notice: Undefined index: newProduct in /MASKED/2018-08-06_12-56-07/htdocs/vendor/magento/module-configurable-product/Controller/Adminhtml/Product/Initialization/Helper/Plugin/Configurable.php on line 161

As to why the products were not created, we havent exactly located the issue. We just found these small errors along the way.

Catalog ConfigurableProduct Clear Description Confirmed Format is valid Ready for Work Reproduced on 2.2.x Reproduced on 2.3.x

Most helpful comment

@magento-engcom-team , @michaelrachlitz I could not pinpoint it exactly. My knowledge of the UI Components is not good enough and the code is poorly documented on this part which it makes tough to understand.

What I did find out was that after clicking the Save button when you have an error message visible (not necessarily the SKU of the configurable product, can also be the price of the simple product) the dataRecord in the getChildItems method of app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js is messed up. This causes a JS error (_dataRecord.slice is not a function_).

I could not find the relation the save button and this data record by plowing through this related code.

All 40 comments

Hi @michaelrachlitz. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • [ ] Summary of the issue
  • [ ] Information on your environment
  • [ ] Steps to reproduce
  • [ ] Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento-engcom-team give me {$VERSION} instance

where {$VERSION} is version tags (starting from 2.2.0+) or develop branches (2.2-develop +).
For more details, please, review the Magento Contributor Assistant documentation.

@michaelrachlitz do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • [ ] yes
  • [ ] no

@michaelrachlitz, thank you for your report.
We were not able to reproduce this issue by following the steps you provided. Please provide more detailed steps to reproduce or try to reproduce this issue on a clean installation or latest release.

I found the error on vanilla.

  1. Add configurations
  2. Before saving the parent product, make sure that at least one configuration has a SKU that is longer than allowed.
  3. Save and the validation will complain about the length exceeding 64 characters
  4. Korrekt the SKU and make sure the length is shorter than the limit of 64 characters
  5. Save the product. The error is now reproduced.

@magento-engcom-team give me 2.2.5 instance

Hi @michaelrachlitz. Thank you for your request. I'm working on Magento 2.2.5 instance for you

Hi @michaelrachlitz, here is your Magento instance.
Admin access: https://i-17436-2-2-5.engcom.dev.magento.com/admin
Login: admin Password: 123123q
Instance will be terminated in up to 3 hours.

Error reproduced in test instance:
`There has been an error processing your request
Exception printing is disabled by default for security reasons.

Error log record number: 306743500556`

@magento-engcom-team Error reproduced Yes 306743500556

@michaelrachlitz, thank you for your report.
We've acknowledged the issue and added to our backlog.

@michaelrachlitz I have digged into this, it only seems to break when you click the Save button when there is still an error message visible. Somewhere in the Knockout / Javscript the form values get messed up.
After that the values in PHP are not available anymore.

If you first solve the SKU (from your example), than focus on another field, the error message will disappear and if you than hit the Save button it will work.

I will try to pinpoint the actual issue and than try to solve it.

@magento-engcom-team , @michaelrachlitz I could not pinpoint it exactly. My knowledge of the UI Components is not good enough and the code is poorly documented on this part which it makes tough to understand.

What I did find out was that after clicking the Save button when you have an error message visible (not necessarily the SKU of the configurable product, can also be the price of the simple product) the dataRecord in the getChildItems method of app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js is messed up. This causes a JS error (_dataRecord.slice is not a function_).

I could not find the relation the save button and this data record by plowing through this related code.

Hello @magento-engcom-team,
I'm facing same issue with magento 2.2.5 version. when i try to add some child product in configurable product i get this error.

{"0":"Notice: Undefined variable: product in \/Applications\/MAMP\/htdocs\/mage22511\/vendor\/magento\/module-catalog\/Controller\/Adminhtml\/Product\/Save.php on line 150","1":"#0 \/Applications\/MAMP\/htdocs\/mage22511\/vendor\/magento\/module-catalog\/Controller\/Adminhtml\/Product\/Save.php(150): Magento\Framework\App\ErrorHandler->handler(8, 'Undefined varia...', '\/Applications\/M...', 150, Array)\n#1 \/Applications\/MAMP\/htdocs\/mage22511\/generated\/code\/Magento\/Catalog\/Controller\/Adminhtml\/Product\/Save\/Interceptor.php(24): Magento\Catalog\Controller\Adminhtml\Product\Save->execute()\n#2 \/Applications\/MAMP\/htdocs\/mage22511\/vendor\/magento\/framework\/App\/Action\/Action.php(107): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->execute()\n#3 \/Applications\/MAMP\/htdocs\/mage22511\/vendor\/magento\/module-backend\/App\/AbstractAction.php(229): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http))\n#4 \/Applications\/MAMP\/htdocs\/mage22511\/vendor\/magento\/framework\/Interception\/Interceptor.php(58): Magento\Backend\App\AbstractAction->dispatch(Object(Magento\Framework\App\Request\Http))\n#5 \/Applications\/MAMP\/htdocs\/mage22511\/vendor\/magento\/framework\/Interception\/Interceptor.php(138): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->___callParent('dispatch', Array)\n#6 \/Applications\/MAMP\/htdocs\/mage22511\/vendor\/magento\/module-backend\/App\/Action\/Plugin\/Authentication.php(143): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))\n#7 \/Applications\/MAMP\/htdocs\/mage22511\/vendor\/magento\/framework\/Interception\/Interceptor.php(135): Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch(Object(Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))\n#8 \/Applications\/MAMP\/htdocs\/mage22511\/vendor\/magento\/framework\/Interception\/Interceptor.php(153): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))\n#9 \/Applications\/MAMP\/htdocs\/mage22511\/generated\/code\/Magento\/Catalog\/Controller\/Adminhtml\/Product\/Save\/Interceptor.php(39): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->___callPlugins('dispatch', Array, NULL)\n#10 \/Applications\/MAMP\/htdocs\/mage22511\/vendor\/magento\/framework\/App\/FrontController.php(55): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))\n#11 \/Applications\/MAMP\/htdocs\/mage22511\/vendor\/magento\/framework\/Interception\/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))\n#12 \/Applications\/MAMP\/htdocs\/mage22511\/vendor\/magento\/framework\/Interception\/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)\n#13 \/Applications\/MAMP\/htdocs\/mage22511\/vendor\/magento\/framework\/Interception\/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))\n#14 \/Applications\/MAMP\/htdocs\/mage22511\/generated\/code\/Magento\/Framework\/App\/FrontController\/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, Array)\n#15 \/Applications\/MAMP\/htdocs\/mage22511\/vendor\/magento\/framework\/App\/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))\n#16 \/Applications\/MAMP\/htdocs\/mage22511\/generated\/code\/Magento\/Framework\/App\/Http\/Interceptor.php(24): Magento\Framework\App\Http->launch()\n#17 \/Applications\/MAMP\/htdocs\/mage22511\/vendor\/magento\/framework\/App\/Bootstrap.php(256): Magento\Framework\App\Http\Interceptor->launch()\n#18 \/Applications\/MAMP\/htdocs\/mage22511\/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))\n#19 {main}","url":"\/mage22511\/admin22511\/catalog\/product\/save\/id\/1\/type\/configurable\/store\/0\/set\/4\/key\/c142a7ce399de85075d99a0b5f9082219496c88ea27503ad7d227213f7c0cf0a\/back\/edit","script_name":"\/mage22511\/index.php"}

and when i try to click to browser back button then it shows this error.

https://www.dropbox.com/s/zysk4t83nkvybtx/Screenshot%202018-08-20%2011.34.48.png?dl=0

Can you suggest me any solution.

@mak0605 Don't press the save until you have altered your SKU's and you will be fine. Make sure all your SKU's is within the allowed number of characters.

@michaelrachlitz Can you please explain little more regrading SKU.
So far i didn't get any error which is relating with sku. if i try to add child product without any images at that time is works fine. so it issue with image. isn't? i tried to comment the code in vendor/magento/module-configurable-product/Model/Product/VariationHandler.php in method duplicateImagesForVariations($productsData)
comment this code if (isset($imagesForCopy[$imageId][0])) { // skip duplicate image for first product unset($imagesForCopy[$imageId][0]); }
then it works fine. So i think it's nothing to do with sku i guess. Can you tell me Now?

Thanks

Hi @magento-engcom-team

Same issue here with Magento 2.2.5 version

1 exception(s):
Exception #0 (Exception): Notice: Undefined variable: product in /var/www/html/vendor/magento/module-catalog/Controller/Adminhtml/Product/Save.php on line 156

Exception #0 (Exception): Notice: Undefined variable: product in /var/www/html/vendor/magento/module-catalog/Controller/Adminhtml/Product/Save.php on line 156

0 /var/www/html/vendor/magento/module-catalog/Controller/Adminhtml/Product/Save.php(156): Magento\Framework\App\ErrorHandler->handler(8, 'Undefined varia...', '/var/www/html/v...', 156, Array)

1 /var/www/html/generated/code/Magento/Catalog/Controller/Adminhtml/Product/Save/Interceptor.php(24): Magento\Catalog\Controller\Adminhtml\Product\Save->execute()

2 /var/www/html/vendor/magento/framework/App/Action/Action.php(107): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->execute()

3 /var/www/html/vendor/magento/module-backend/App/AbstractAction.php(229): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http))

4 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Backend\App\AbstractAction->dispatch(Object(Magento\Framework\App\Request\Http))

5 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->___callParent('dispatch', Array)

6 /var/www/html/vendor/magento/module-backend/App/Action/Plugin/Authentication.php(143): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->Magento\Framework\Interception{closure}(Object(Magento\Framework\App\Request\Http))

7 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(135): Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch(Object(Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))

8 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->Magento\Framework\Interception{closure}(Object(Magento\Framework\App\Request\Http))

9 /var/www/html/generated/code/Magento/Catalog/Controller/Adminhtml/Product/Save/Interceptor.php(39): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->___callPlugins('dispatch', Array, NULL)

10 /var/www/html/vendor/magento/framework/App/FrontController.php(55): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))

11 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))

12 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)

13 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception{closure}(Object(Magento\Framework\App\Request\Http))

14 /var/www/html/generated/code/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, Array)

15 /var/www/html/vendor/magento/framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))

16 /var/www/html/generated/code/Magento/Framework/App/Http/Interceptor.php(24): Magento\Framework\App\Http->launch()

17 /var/www/html/vendor/magento/framework/App/Bootstrap.php(256): Magento\Framework\App\Http\Interceptor->launch()

18 /var/www/html/pub/index.php(36): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))

19 {main}

I have the same problem after upgrade to 2.2.5, i have this problem because magento generate skus with more than 64 characters, maybe if i can cut the skus in 64 characters i don't have to face this problem.

I would like to work on this issue #mm18pl

@Yupik thank you for joining. Please accept team invitation here and self-assign the issue.

I would like to work on this issue with Yupik #mm18pl

@mkostrzycki thank you for joining. Please accept team invitation here and self-assign the issue.

Any update on this issue? I am facing the same error in Magento 2.2.6. I upgrade from 2.1.13 to this version and now I am facing this error while adding new products.
The issue coming here does not seem to be because of SKUs for more than 64 characters, because my SKUs are less than 10 characters, as can be seen in attached screenshot.

screen shot 2018-10-16 at 9 25 25 am

with the hint of @arnoudhgz I was able to analyze this issue futher.

the problem seems to be the configurable-matrix which is serializled wrong (missing fields/attributes)
/vendor/magento/module-configurable-product/view/adminhtml/web/js/variations/variations.js::serializeData()

I Fixed in my website!
Please check below process
Step 1:
set "const SKU_MAX_LENGTH = 255;" in the file module-catalog/Model/Product/Attribute/Backend/Sku.php
Step 2:
You need to change the into database as well. Go to table eav_attribute, search for sku at column attribute code then edit the resulted row.

Update the field frontend_class to null or validate-length maximum-length-255 according to your requirement.
Step 3:
You have to change field size at the database table.

ALTER TABLE catalog_product_entity CHANGE sku sku VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'SKU';

@A-1A this is not a solution for the actual problem. The issue also occurs with other fields than the SKU. And with your workaround it will still break at 256 characters

SQUASHTOBERFEST

Hi @maheshWebkul721. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if your want to validate it one more time, please, go though the following instruction:

  • [ ] 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
  • [ ] 2. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 3. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • [ ] 4. If the issue is not relevant or is not reproducible any more, feel free to close it.

Undefined variable: product, can not be reproduced, but i have found Undefined index: newProduct error, which i am going to fix.

@magento-engcom-team give me 2.3-develop instance

Hi @maheshWebkul721. Thank you for your request. I'm working on Magento 2.3-develop instance for you

Hi @maheshWebkul721, here is your Magento instance.
Admin access: http://ec2-34-228-235-121.compute-1.amazonaws.com/i-17436-2-3-develop//admin
Login: admin Password: 123123q
Instance will be terminated in up to 3 hours.

Yes, i can reproduce this error: Notice: Undefined index: newProduct in /var/www/html/deployer/instances/i-17436-2-3-develop/app/code/Magento/ConfigurableProduct/Controller/Adminhtml/Product/Initialization/Helper/Plugin/Configurable.php on line 161

I can reproduce this issue on 2.2.6.
The problem seems to be the serializeData: line 409 function in variations.js like @philippsander stated.

The second line:

delete this.source.data['configurable-matrix'];

gets called, even if there are JS errors (SKU too long) on the page. The next time you save the product, the matrix is empty. This causes the following PHP errors because the data is corupt.

Edit: Temporary fix would be to check for JS errors and keep the matrix if there is atleast one
$errors = $('.admin__field-error').length > 0;

Steps to reproduce

  1. Edit or add new configurable product
  2. Remove or let empty the name field
  3. Press Save (nothing happens on frontend but saveFormHandler and serializeData is triggered and that cause the error)
  4. Insert the name of product
  5. Press Save

A fast fix is to remove the "delete" statement.
Here you can find patch

So... solution to this issue?

Hi @routbiplab. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if your want to validate it one more time, please, go though the following instruction:

  • [ ] 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
  • [ ] 2. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 3. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • [ ] 4. If the issue is not relevant or is not reproducible any more, feel free to close it.

We are also having same issue
while doing
“edit configurations” then select “update all sku images”

{
"0":"Notice: Undefined variable: product in vendor/magento/module-catalog/Controller/Adminhtml/Product/Save.php on line 150",
"1":"#0 vendor/magento/module-catalog/Controller/Adminhtml/Product/Save.php(150): Magento\Framework\App\ErrorHandler->handler(8, 'Undefined varia...', '/opt/bitnami/ap...', 150, Array) #1 vendor/magento/framework/App/Action/Action.php(107): Magento\Catalog\Controller\Adminhtml\Product\Save->execute() #2 vendor/magento/module-backend/App/AbstractAction.php(235): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http)) #3 vendor/magento/framework/Interception/Interceptor.php(58): Magento\Backend\App\AbstractAction->dispatch(Object(Magento\Framework\App\Request\Http)) #4 vendor/magento/framework/Interception/Interceptor.php(138): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->___callParent('dispatch', Array) #5 vendor/magento/module-backend/App/Action/Plugin/Authentication.php(143): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->Magento\Framework\Interception{closure}(Object(Magento\Framework\App\Request\Http)) #6 vendor/magento/framework/Interception/Interceptor.php(135): Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch(Object(Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http)) #7 vendor/magento/framework/Interception/Interceptor.php(153): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->Magento\Framework\Interception{closure}(Object(Magento\Framework\App\Request\Http)) #8 generated/code/Magento/Catalog/Controller/Adminhtml/Product/Save/Interceptor.php(26): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->___callPlugins('dispatch', Array, NULL) #9 vendor/magento/framework/App/FrontController.php(55): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http)) #10 vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http)) #11 vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array) #12 vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception{closure}(Object(Magento\Framework\App\Request\Http)) #13 generated/code/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, Array) #14 vendor/magento/framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http)) #15 vendor/magento/framework/App/Bootstrap.php(257): Magento\Framework\App\Http->launch() #16 index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor)) #17 {main}",
"url":"/admin/catalog/product/save/id/1778/type/configurable/store/0/set/4/back/edit",
"script_name":"/index.php"
}

and when we press back
it shows this error in red

Unique constraint violation found

Hi @magento-engcom-team
I have the issue with bundle options Delete

  1. Create a bundle product with more options to get pagination.
  2. Select the First page of bundle options.
  3. Delete any one of the bundle options.

https://www.screencast.com/t/XVpEB42MGixU

Kindly guide me to fix the issue
Thanks

config test   Products   Inventory   Catalog   Magento Admin

i tried, Product saved sucessfully in magento 2.3, unable reproduce this issue in magento 2.3

I have this error in magento 2.3.1 and 2.2.6. To reproduce:

  1. Create a configurable product and fill all required fields. Also, put the product image.
  2. Create configurations based on some attribute
  3. Save
  4. Add to your attribute a few new options.
  5. Get to edit your product and then edit configurations.
  6. On the step "attribute values" uncheck some old options and check some new options.
  7. On the step "bulk images and price" select one image for all and upload, set prices for each option, set qty one for all
  8. generate configurations and try to save the product.
Was this page helpful?
0 / 5 - 0 ratings

Related issues

denis-g picture denis-g  ·  3Comments

andreaskoch picture andreaskoch  ·  3Comments

jzalenski picture jzalenski  ·  3Comments

kirashet666 picture kirashet666  ·  3Comments

salelsol picture salelsol  ·  3Comments