Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "Undefined variable: responseAjax" notice when trying to save a shipment package #12091

Merged
merged 1 commit into from
Nov 9, 2017
Merged

Fix "Undefined variable: responseAjax" notice when trying to save a shipment package #12091

merged 1 commit into from
Nov 9, 2017

Conversation

lazyguru
Copy link
Contributor

@lazyguru lazyguru commented Nov 7, 2017

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

  1. Create an order
  2. Click the "Ship" button when viewing the order in the admin
  3. Check the box for "Create Shipping Label"
  4. Click "Submit Shipment"
  5. Click "Add products to shipment"
  6. Select products to add and then click "Add selected products to package"
  7. Click "Save"
  8. View browser console to see that AJAX request has failed. Go to network tab and select request to see the exception thrown.

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

@okorshenko okorshenko self-assigned this Nov 8, 2017
@okorshenko okorshenko added this to the November 2017 milestone Nov 8, 2017
@okorshenko okorshenko merged commit 48a0415 into magento:2.2-develop Nov 9, 2017
okorshenko pushed a commit that referenced this pull request Nov 9, 2017
@lazyguru lazyguru deleted the fix-undefined-variable-responseAjax branch November 9, 2017 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants