Closed GioDeGruyter closed 1 year ago
Hi @GioDeGruyter. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:
@magento give me 2.4-develop instance
- upcoming 2.4.x release@magento I am working on this
Join Magento Community Engineering Slack and ask your questions in #github channel. :warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting. :clock10: You can find the schedule on the Magento Community Calendar page. :telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.
Hi @engcom-Dash. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
Area: XXXXX
label to the ticket, indicating the functional areas it may be related to.2.4-develop
branch@magento give me 2.4-develop instance
to deploy test instance on Magento infrastructure. 2.4-develop
branch, please, add the label Reproduced on 2.4.x
.@magento give me 2.4-develop instance
Hi @engcom-Dash. Thank you for your request. I'm working on Magento instance for you.
Hi @engcom-Dash, here is your Magento Instance: https://2ceca0a462e3e51cede05847dd3e46e2.instances-prod.magento-community.engineering Admin access: https://2ceca0a462e3e51cede05847dd3e46e2.instances-prod.magento-community.engineering/admin_4a1e Login: f9a184d1 Password: daf0fdc0edea
Hi @GioDeGruyter ,
Issue confirmed !
Verified the issue in 2.4-develop instance and the issue is reproducible,Hence we are confirming the issue.
Preconditions:
Magento Version 2.4-develop PHP Version 8.1 Multi store was created
Steps to reproduce:
Kindly Refer the below screenshots:
We are trying to Update the existing schedule(change the end date of the existing schedule and try to save it),But we getting the error which is attached in above screenshot also we are getting same system.log as per the description and system.log screenshots also attached.This is actual result,So we are confirming the issue in 2.4-develop instance.
Regards,
:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-8256 is successfully created for this GitHub issue.
:white_check_mark: Confirmed by @engcom-Dash. Thank you for verifying the issue.
Issue Available: @engcom-Dash, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.
Are there any updates revolving this issue?
Is there any update on this, or is there maybe already a patch available that we are able to apply to go around this?
@magento give me 2.4-develop instance
Hi @engcom-Dash. Thank you for your request. I'm working on Magento instance for you.
Hi @engcom-Dash, here is your Magento Instance: https://2ceca0a462e3e51cede05847dd3e46e2.instances-prod.magento-community.engineering Admin access: https://2ceca0a462e3e51cede05847dd3e46e2.instances-prod.magento-community.engineering/admin_a678 Login: 58a36755 Password: 0d0062a74fc4
@magento give me 2.4-develop commerce instance
Hi @engcom-Dash. Thank you for your request. I'm working on Magento instance for you.
Hi @engcom-Dash, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.
Hi @GioDeGruyter ,
I tried to reproduce the issue on the latest code base of 2.4-develop with multiple store views enabled, but was unable to do so. Here are the steps followed,
Navigate to Catalog > Categories in the admin section Change the scope to a specific store view Select any category Create a new scheduled change for the category for the specific store view Save the schedule and the category Update the existing schedule, change the end date of the existing schedule and try to save it
This issue is no longer reproducible,Hence we are closing this issue.
Let us know if we are missing anything!
Regards,
@engcom-Dash What is the upcoming release on the 2.4 develop branch? And is there a possibility we can patch this for our current version?
@magento-admin I am encountering an issue related to "Error when updating category scheduled changes for a specific store view" in Magento. Are there any relevant patches available to address this problem? The required version is 2.4.5-p1
@magento-admin Could we reopen this issue? Since this has clearly not been fixed yet.
@magento-admin I've tested on 2.4.6 enterprise clean environment but the issue is still there. Could you retest and reopen the issue?
@magento-admin Any updates on this? Could this be reopened as @bona-kim asked?
@magento-admin This seems to be issue as well on 2.4.5-p3, we get the same problem 'error: : Something went wrong while saving the Magento\Catalog\Api\Data\CategoryInterface.'
And then in logs: report.CRITICAL: Exception: Warning: Undefined array key "updated_in" in /app/vendor/magento/module-staging/Model/Operation/Update.php on line 174 in /app/vendor/magento/framework/App/ErrorHandler.php:62
After spending an hour digging into the code, I have identified the issue. It appears that the problem lies within the 'vendor/magento/module-staging/Model/Operation/Update.php' file
Override the 'vendor/magento/module-staging/Model/Operation/Update.php' file in your module
Add
$version = $this->versionInfoProvider->getVersionInfo(
$entity,
$this->resolveVersion(array_merge($entityData, $arguments))
);
$entityData['updated_in'] = $version->getUpdatedIn();
in processUpdate function
code should be.
private function processUpdate(
EntityMetadataInterface $metadata,
$entityType,
$entity,
$arguments
) {
if (isset($arguments['origin_in'])) {
$version = $this->versionInfoProvider->getVersionInfo(
$entity,
$this->resolveVersion(array_merge($entityData, $arguments))
);
$entityData['updated_in'] = $version->getUpdatedIn();
$needReschedule = $arguments['created_in'] != $arguments['origin_in']
|| $update->getRollbackId() != $entityData['updated_in'];
....
...
After spending an hour digging into the code, I have identified the issue. It appears that the problem lies within the 'vendor/magento/module-staging/Model/Operation/Update.php' file
Override the 'vendor/magento/module-staging/Model/Operation/Update.php' file in your module
Add
$version = $this->versionInfoProvider->getVersionInfo( $entity, $this->resolveVersion(array_merge($entityData, $arguments)) ); $entityData['updated_in'] = $version->getUpdatedIn();
in processUpdate function
code should be.
private function processUpdate( EntityMetadataInterface $metadata, $entityType, $entity, $arguments ) { if (isset($arguments['origin_in'])) { $version = $this->versionInfoProvider->getVersionInfo( $entity, $this->resolveVersion(array_merge($entityData, $arguments)) ); $entityData['updated_in'] = $version->getUpdatedIn(); $needReschedule = $arguments['created_in'] != $arguments['origin_in'] || $update->getRollbackId() != $entityData['updated_in']; .... ...
COuld you share the way how did you fix it? i did the same thing as you, but still getting that error, please.
We had the same issue @linetsoscar. We've resolved it by setting the updated_in data on the entity itself as well:
$entity->setData('updated_in', $version->getUpdatedIn());
This results into:
private function processUpdate(
EntityMetadataInterface $metadata,
$entityType,
$entity,
$arguments
) {
if (isset($arguments['origin_in'])) {
$version = $this->versionInfoProvider->getVersionInfo(
$entity,
$this->resolveVersion(array_merge($entityData, $arguments))
);
$entityData['updated_in'] = $version->getUpdatedIn();
$entity->setData('updated_in', $version->getUpdatedIn());
$needReschedule = $arguments['created_in'] != $arguments['origin_in']
|| $update->getRollbackId() != $entityData['updated_in'];
....
...
Thank u @GioDeGruyter but i still have the problem, it is not redirecting, the loading spinner doesnt disappear, but it is updating which is ok... isnt it happening in your case?
Here i have an image in order to show u that the spinner still showing, and i checked the logs and no errros reported.
duplicated on Adobe Commerce 2.4.6-p3 with for All Store View (store_id 0)
fix we come up
$version
fetching earlierupdated_in
does not exist against $entityData
updated_in
exists against $version
diff --git a/vendor/magento/module-staging/Model/Operation/Update.php b/vendor/magento/module-staging/Model/Operation/Update.php
index 76a8b5bf..cbe8bbf8 100644
--- a/vendor/magento/module-staging/Model/Operation/Update.php
+++ b/vendor/magento/module-staging/Model/Operation/Update.php
@@ -168,6 +168,14 @@ class Update implements UpdateInterface
}
$update = $this->updateRepository->get($arguments['created_in']);
+ $version = $this->versionInfoProvider->getVersionInfo(
+ $entity,
+ $this->resolveVersion(array_merge($entityData, $arguments))
+ );
+ if (!isset($entityData['updated_in']) && $version->getUpdatedIn()) {
+ $entityData['updated_in'] = $version->getUpdatedIn();
+ }
+
$needReschedule = false;
if (isset($arguments['origin_in'])) {
$needReschedule = $arguments['created_in'] != $arguments['origin_in']
@@ -178,10 +186,6 @@ class Update implements UpdateInterface
}
$identifier = $entityData[$metadata->getIdentifierField()];
- $version = $this->versionInfoProvider->getVersionInfo(
- $entity,
- $this->resolveVersion(array_merge($entityData, $arguments))
- );
if ($version->getRowId() != null) {
if ($update->getRollbackId()) {
$arguments['updated_in'] = $update->getRollbackId();
just dug a bit deeper, will testing https://experienceleague.adobe.com/docs/commerce-knowledge-base/kb/support-tools/patches/v1-1-35/acsd-51358-schedule-updates-are-missing.html?lang=en as a resolution to our problem
Preconditions and environment
Steps to reproduce
Expected result
The schedule is saved.
Actual result
The following error occurs:
Additional information
I was able to reproduce this issue on a clean 2.4.5-p1 installation with sample data.
The following log regarding the issue can be found in system.log:
[2023-03-14T20:52:30.453553+00:00] report.CRITICAL: Exception message: Warning: Undefined array key "updated_in" in /app/vendor/magento/module-staging/Model/Operation/Update.php on line 174
Release note
No response
Triage and priority