Add multishop overwrite confirmation when editing categories in all-shops context#65
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c8ae972b47
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| $('#multishop-overwrite-confirm-all').on('click', function () { | ||
| isSubmitting = true; | ||
| $action.val('overwrite_all'); | ||
| $form.submit(); | ||
| }); |
There was a problem hiding this comment.
Preserve clicked submit action when confirming overwrite
When the modal confirmation triggers, the handler calls $form.submit() programmatically, which does not include the originally clicked submit button name/value. As a result, if the user clicked "Save and stay" or "Save and back to parent" the POST no longer contains submitAddCategoryAndStay (or similar), so the controller treats it as a normal save and redirects differently. This regression only happens when the overwrite modal is shown; consider capturing the clicked submit button (or adding a hidden field) and re‑submitting that action along with multishop_overwrite_action.
Useful? React with 👍 / 👎.
Motivation
Description
AdminCategoriesControllerCoreby introducingMULTISHOP_OVERWRITE_ACTION_*constants, amultishopOverwriteDataholder, and an override ofprocessUpdate()that detects per-shop differences viagetMultishopOverwriteDifferences()and shows the form again when differences exist.shouldCheckMultishopOverwrite(),getMultishopTextFields(),getAssociatedShopIds(),getMultishopCategoryLangValues(),restoreNonEmptyMultishopValues()andisMultishopValueEmpty()to identify changed text fields and to support theoverwrite_emptybehavior which preserves non-empty shop-specific values.multishop_overwritein the controller so the form layer can render UI, and add a hiddenmultishop_overwrite_actionfield plus a Bootstrap modal and JS inadmin-dev/themes/default/template/helpers/form/form.tplthat intercepts submits and offers the merchant three choices:Save for all shops,Save only empty values, orCancel.overwrite_emptyis chosen the controller saves the posted values and then restores previously non-empty per-shop values so only empty fields are filled from the all-shops submission.Testing
Codex Task