Skip to content

Status label is wrong in admin #9566

Closed
Closed
@darkogoles1

Description

@darkogoles1

Preconditions

  1. Magento version 2.1.3, 2.1.6

Steps to reproduce

  1. Create Order status labels for default frontend store: http://collabshot.com/show/MVB4Tl
  2. Original status labels (for admin store should be in this table: http://collabshot.com/show/21mPgT

Expected result

When an order is created in the frontend, order status should have e.g. "erp_uploaded" code.
Label in frontend should be Processing, as we added store specific label "Processing" to "sales_order_status_label" table

But label in admin store should be the original label from "sales_order_status" table, which is not the case.

Actual result

In the file: /vendor/magento/module-sales/Model/Order/Status.php:145, the method "getStoreLabel" is trying to fetch a label for current admin store, but always returns the label for "Default" frontend store (which is id=1 in my case).

The reason is because Magento is not loading ADMIN store id but always returns default store id, even inside adminhtml area:
http://collabshot.com/show/Q8KvAK

"$this->_storeManager->getStore($store);" always returns store id=1 instead of store id=0

This makes status labels usage useless either in the frontend, either in admin, this is how above sample statuses look like in admin:

So, finally, even the source model that is trying to fetch status label is showing Frontend label instead of original admin status label - all because of wrong store id (Default instead of admin) loaded in backend.

Best way to reproduce:

  1. Create order
  2. Open edit order page in admin and note "Order Status"
  3. Go to Admin: Stores>Settings>Order Status and edit row with status that has order
  4. Change label for Default Store View = "Processing on store view"
  5. Refresh order edit form

Expected result

Status = "Processing"

Actual result

Status = "Processing on store view"

Metadata

Metadata

Labels

Fixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releasebug report

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions