Closed aadmathijssen closed 3 years ago
Hi @aadmathijssen. Thank you for your report. To help us process this issue please make sure that you provided the following information:
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
@magento give me 2.4-develop instance
- upcoming 2.4.x release
For more details, please, review the Magento Contributor Assistant documentation.
Please, add a comment to assign the issue: @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, please join the Community Contributions Triage session to discuss the appropriate ticket.
:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel
:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel
@magento give me 2.4-develop instance
Hi @aadmathijssen. Thank you for your request. I'm working on Magento 2.4-develop instance for you
Hi @aadmathijssen, here is your Magento instance.
Admin access: https://i-29263-2-4-develop.instances.magento-community.engineering/admin_77c7
Login: 1856ed77
Password: c43a74371a5a
Instance will be terminated in up to 3 hours.
Hi @engcom-Alfa. 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:
[ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).Details
If the issue has a valid description, the label Issue: Format is valid
will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid
appears.
[ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description
label to the issue by yourself.
[ ] 3. Add Component: XXXXX
label(s) to the ticket, indicating the components it may be related to.
[ ] 4. Verify that the issue is reproducible on 2.4-develop
branchDetails
- Add the comment @magento give me 2.4-develop instance
to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.4-develop
branch, please, add the label Reproduced on 2.4.x
.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
[ ] 5. Add label Issue: Confirmed
once verification is complete.
[ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
:white_check_mark: Confirmed by @engcom-Alfa
Thank you for verifying the issue. Based on the provided information internal tickets MC-36262
were created
Issue Available: @engcom-Alfa, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.
Is there a temporary fix available for this issue? I need it urgently. If so, where can I find this? I'm not a programmer, so please keep it simple...... Thanks a lot!
Up, is there a fix for that?
I have tested a fix that I can suggest that would impact only one class but I'm not sure that it wouldn't have side effects on other parts of the website.
The idea would be to emulate the order's store using \Magento\Store\Model\App\Emulation::startEnvironmentEmulation
and \Magento\Store\Model\App\Emulation::stopEnvironmentEmulation
inside \Magento\Sales\Model\Order::getFrontendStatusLabel
like that:
/**
* Retrieve frontend label of order status
*
* @return string
* @since 102.0.1
*/
public function getFrontendStatusLabel()
{
$this->appEmulation->startEnvironmentEmulation($this->getStoreId(), Area::AREA_FRONTEND);
$frontendLabel = $this->getConfig()->getStatusFrontendLabel($this->getStatus());
$this->appEmulation->stopEnvironmentEmulation();
return $frontendLabel;
}
It seems to work locally but I haven't tested anything else than adding a comment to the order in the admin.
Here is a quickfix until the patch is made in the official release that you can apply in a custom module (think about replacing the "Vendor\Module" parts):
File etc/adminhtml/di.xml
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Sales\Model\Order">
<plugin sortOrder="1" name="bmSalesOrder" type="Vendor\Module\Plugin\Model\OrderPlugin" />
</type>
</config>
Plugin/Model/OrderPlugin.php
<?php
namespace Vendor\Module\Plugin\Model;
use Magento\Framework\App\Area;
use Magento\Sales\Model\Order;
use Magento\Store\Model\App\Emulation as AppEmulation;
class OrderPlugin
{
/**
* @var \Magento\Store\Model\App\Emulation
*/
private $appEmulation;
/**
* OrderPlugin constructor.
*
* @param \Magento\Store\Model\App\Emulation $appEmulation
*/
public function __construct(AppEmulation $appEmulation)
{
$this->appEmulation = $appEmulation;
}
/**
* Fix transactional emails retrieving order status without the translation.
* See https://github.com/magento/magento2/issues/29263
*
* @param \Magento\Sales\Model\Order $subject
* @param string $result
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*
* @return string
* @since 102.0.1
*/
public function afterGetFrontendStatusLabel(Order $subject, $result)
{
$this->appEmulation->startEnvironmentEmulation($subject->getStoreId(), Area::AREA_FRONTEND);
$frontendLabel = $subject->getConfig()->getStatusFrontendLabel($subject->getStatus());
$this->appEmulation->stopEnvironmentEmulation();
return $frontendLabel;
}
}
i'll try to make a pull request as soon as possible but even if it is accepted, it wouldn't be available until at least one of these versions I guess 2.4.2, 2.4.1-p1, 2.3.6-p1, so this is a quickfix until then.
Here is a quickfix until the patch is made in the official release that you can apply in a custom module (think about replacing the "Vendor\Module" parts):
i'll try to make a pull request as soon as possible but even if it is accepted, it wouldn't be available until at least one of these versions I guess 2.4.2, 2.4.1-p1, 2.3.6-p1, so this is a quickfix until then.
Thank you for your "quick-fix" @Axel29 I will ask our developer to add it, because I could not find the exact location (folder) where to put the replacements.
Here is a quickfix until the patch is made in the official release that you can apply in a custom module (think about replacing the "Vendor\Module" parts): i'll try to make a pull request as soon as possible but even if it is accepted, it wouldn't be available until at least one of these versions I guess 2.4.2, 2.4.1-p1, 2.3.6-p1, so this is a quickfix until then.
Thank you for your "quick-fix" @Axel29 I will ask our developer to add it, because I could not find the exact location (folder) where to put the replacements.
No problem, you can add it in app/code/[Vendor]/[Module]/
where [Vendor]/[Module]
is one of your modules.
Hi @aadmathijssen, @edenduong.
Thank you for your report and collaboration!
The related internal Jira ticket MC-36262
was closed as Fixed
.
The fix will be available with the upcoming 2.4.3
release.
Hi @magento-engcom-team @aadmathijssen @edenduong,
We currently use Magento ver. 2.4.3, which still has the problem. Please confirm if it is solved in Magento ver. 2.4.4 release?
Best regards, Williejan
Where can I find the commit for this fix?
After sending a sales update email from the admin for an order using a non-default store view, the resulting email contains the order status label for the default store view instead of the order status label for the store view in which the order is placed.
Preconditions (*)
Steps to reproduce (*)
In the admin:
In the frontend:
In the admin:
Expected result (*)
Actual result (*)
Screenshot of the resulting email:
Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.