avstudnitz / AvS_ScopeHint2

Magento 2 module for displaying additional information in configuration
157 stars 33 forks source link

Cannot schedule new update for a product. #17

Closed jvanschie closed 4 years ago

jvanschie commented 4 years ago

Hi,

I do not know what the root cause is of this issue, but whenever I click on the "schedule new update" button, I am facing the message: "A technical problem with the server created an error. Try again to continue what you were doing. If the problem persists, try again later.".

This is the stacktrace I have found in my log file:

Fatal error: Uncaught Error: Call to a member function getId() on null in /app/vendor/avstudnitz/scopehint2/Plugin/ProductEavDataProviderPlugin.php:61 Stack trace: #0 /app/vendor/magento/framework/Interception/Interceptor.php(146): AvS\ScopeHint\Plugin\ProductEavDataProviderPlugin->afterSetupAttributeMeta(Object(Magento\CatalogStaging\Ui\DataProvider\Product\Form\Modifier\Eav\Interceptor), Array, Object(Magento\Catalog\Model\ResourceModel\Eav\Attribute\Interceptor), 'product-details', 0) #1 /app/vendor/magento/framework/Interception/Interceptor.php(153): Magento\CatalogStaging\Ui\DataProvider\Product\Form\Modifier\Eav\Interceptor->Magento\Framework\Interception{closure}(Object(Magento\Catalog\Model\ResourceModel\Eav\Attribute\Interceptor), 'product-details', 0) #2 /app/generated/code/Magento/CatalogStaging/Ui/DataProvider/Product/Form/Modifier/Eav/Interceptor.php(78): Magento\CatalogStaging\Ui\DataProvider\Product\Form\Modifier\Eav\Interceptor->___callPlugins('setupAttributeM...', Array, Array) #3 /app/vendor/magento/mod in /app/vendor/avstudnitz/scopehint2/Plugin/ProductEavDataProviderPlugin.php on line 61.

The issue is solved if I change this code:

if ($product->getId() === null) {
    return $result;
}

to:

if ($product === null || $product->getId() === null) {
    return $result;
}

I don't have a clue why the registry sometimes returns a null value for "current_product".

Can you help me out?

VincentMarmiesse commented 4 years ago

Hi,

I can confirm this issue on a Magento Commerce 2.3.2 B2B.

robbertstevens commented 4 years ago

Yes, I confirm this too.