1

I am unable to save a configurable product. This is the error I am getting:

Notice: Undefined variable: product in /domains/devportal.flavourwarehouse.co.uk/http/vendor/magento/module-catalog/Controller/Adminhtml/Product/Save.php on line 156

Saving simple products seems to work as expected.

Working on Magento ver. 2.2.6 with products migrated from Magento ver. 1.9.

If you need more information, please let me know.

UPDATE:

In the exception logs, I got:

[2019-01-29 11:28:18] main.CRITICAL: Warning: array_filter() expects parameter 1 to be array, string given in /domains/mydomain.com/http/vendor/magento/module-configurable-product/Controller/Adminhtml/Product/Initialization/Helper/Plugin/Configurable.php on line 145 {"exception":"[object] (Exception(code: 0): Warning: array_filter() expects parameter 1 to be array, string given in /domains/mydomain.com/http/vendor/magento/module-configurable-product/Controller/Adminhtml/Product/Initialization/Helper/Plugin/Configurable.php on line 145 at /domains/mydomain.com/http/vendor/magento/framework/App/ErrorHandler.php:61)"} []

2

Seems like a Magento core bug: if the $product initialization on line 101 throws an Exception:

$product = $this->initializationHelper->initialize(
    $this->productBuilder->build($this->getRequest())
);

the $product variable will be not set in the catch section. Try to debug which kind of exception was thrown and this will give you an answer how to avoid it.

PS: exception could be found in the Magento error log.

  • as per your answer, this is what is triggered after tying to save the product. Any ideas how to solve the problem? – Greg Jan 29 at 14:22
  • @BareFeet What inside the $associatedProductIds on line 131 in vendor/magento/module-configurable-product/Controller/Adminhtml/Product/Initialization/Helper/Plugin/Configurable.php? – Siarhey Uchukhlebau Jan 29 at 15:42
  • The variable was empty, I managed to find the core problem; my custom theme had a "required" attribute that was breaking the site. Thank you kindly for your support. You directed my in the correct way. – Greg Jan 30 at 11:59
  • @BareFeet I was glad to help you :) – Siarhey Uchukhlebau Jan 30 at 13:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.