Fix "Undefined variable: responseAjax" notice when trying to save a shipment package#12091
Merged
okorshenko merged 1 commit intomagento:2.2-developfrom Nov 9, 2017
lazyguru:fix-undefined-variable-responseAjax
Merged
Fix "Undefined variable: responseAjax" notice when trying to save a shipment package#12091okorshenko merged 1 commit intomagento:2.2-developfrom lazyguru:fix-undefined-variable-responseAjax
okorshenko merged 1 commit intomagento:2.2-developfrom
lazyguru:fix-undefined-variable-responseAjax
Conversation
okorshenko
pushed a commit
that referenced
this pull request
Nov 9, 2017
…ing to save a shipment package #12091
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When creating a shipping label and the post to /admin/order_shipment/save/order_id//?isAjax=true fails, the real error is obscured because of a NOTICE about responseAjax being undefined at line 168 of vendor/magento/module-shipping/Controller/Adminhtml/Order/Shipment/Save.php. There is no reason the responseAjax object needs to be defined inside the try/catch block. Moving this up before the try/catch will resolve the issue of it not being defined prior to an exception being thrown.
Manual testing scenarios
In my specific case, the following message was prevented from being displayed:
"We don't have enough information to create shipping labels. Please make sure your store information and settings are complete."
This message isn't relevant for this pull request but demonstrates what the expected result was