From e12cf68ec6fa411b8d141ea01d5a77e958fdf08f Mon Sep 17 00:00:00 2001
From: Alexander Paliarush <apaliarush@ebay.com>
Date: Tue, 14 Jul 2015 12:32:38 -0500
Subject: [PATCH] MAGETWO-38049: Wrong Reset Password link in a Welcome email
 when customer was created on backend

---
 .../view/frontend/email/account_new.html      |  6 ++---
 .../email/account_new_confirmation.html       |  6 ++---
 .../frontend/email/account_new_confirmed.html |  6 ++---
 .../view/frontend/email/password_new.html     |  4 +--
 .../email/password_reset_confirmation.html    |  4 +--
 .../Magento/Email/Model/AbstractTemplate.php  | 25 +++++++++++++++++++
 .../Magento/Email/Model/BackendTemplate.php   |  3 +++
 app/code/Magento/Email/Model/Template.php     |  7 ++++--
 app/code/Magento/Email/etc/di.xml             | 10 ++++++++
 .../Magento/Newsletter/Model/Template.php     |  3 +++
 .../view/frontend/email/creditmemo_new.html   |  4 +--
 .../frontend/email/creditmemo_update.html     |  4 +--
 .../view/frontend/email/invoice_new.html      |  4 +--
 .../view/frontend/email/invoice_update.html   |  4 +--
 .../Sales/view/frontend/email/order_new.html  |  2 +-
 .../view/frontend/email/order_update.html     |  4 +--
 .../view/frontend/email/shipment_new.html     |  4 +--
 .../view/frontend/email/shipment_update.html  |  4 +--
 18 files changed, 74 insertions(+), 30 deletions(-)

diff --git a/app/code/Magento/Customer/view/frontend/email/account_new.html b/app/code/Magento/Customer/view/frontend/email/account_new.html
index f5c2706ae39..d64121a198e 100644
--- a/app/code/Magento/Customer/view/frontend/email/account_new.html
+++ b/app/code/Magento/Customer/view/frontend/email/account_new.html
@@ -6,7 +6,7 @@
 -->
 <!--@subject Welcome to {{var store.getFrontendName()}} @-->
 <!--@vars {
-"var store.getUrl('customer/account/')":"Customer Account URL",
+"var this.getUrl($store, 'customer/account/')":"Customer Account URL",
 "var customer.email":"Customer Email",
 "var customer.name":"Customer Name"
 } @-->
@@ -19,7 +19,7 @@
     {{trans
         'To sign in to our site, use these credentials during checkout or on the <a href="%customer_url">My Account</a> page:'
 
-        customer_url=$store.getUrl('customer/account/')
+        customer_url=$this.getUrl($store, 'customer/account/')
     |raw}}
 </p>
 <ul>
@@ -30,7 +30,7 @@
     {{trans
         'Forgot your account password? Click <a href="%reset_url">here</a> to reset it.'
 
-        reset_url="$store.getUrl('customer/account/createPassword/', [_query:[id:$customer.id, token:$customer.rp_token]])"
+        reset_url="$this.getUrl($store, 'customer/account/createPassword/', [_query:[id:$customer.id, token:$customer.rp_token]])"
     |raw}}
 </p>
 <p>{{trans "When you sign in to your account, you will be able to:"}}</p>
diff --git a/app/code/Magento/Customer/view/frontend/email/account_new_confirmation.html b/app/code/Magento/Customer/view/frontend/email/account_new_confirmation.html
index 7c018b1f1f2..01747e59add 100644
--- a/app/code/Magento/Customer/view/frontend/email/account_new_confirmation.html
+++ b/app/code/Magento/Customer/view/frontend/email/account_new_confirmation.html
@@ -6,8 +6,8 @@
 -->
 <!--@subject Please confirm your {{var store.getFrontendName()}} account @-->
 <!--@vars {
-"var store.getUrl('customer/account/confirm/', [_query:[id:$customer.id, key:$customer.confirmation, back_url:$back_url]])":"Account Confirmation URL",
-"var store.getUrl('customer/account/')":"Customer Account URL",
+"var this.getUrl($store, 'customer/account/confirm/', [_query:[id:$customer.id, key:$customer.confirmation, back_url:$back_url]])":"Account Confirmation URL",
+"var this.getUrl($store, 'customer/account/')":"Customer Account URL",
 "var customer.email":"Customer Email",
 "var customer.name":"Customer Name"
 } @-->
@@ -23,7 +23,7 @@
             <table class="inner-wrapper" border="0" cellspacing="0" cellpadding="0" align="center">
                 <tr>
                     <td align="center">
-                        <a href="{{var store.getUrl('customer/account/confirm/', [_query:[id:$customer.id, key:$customer.confirmation, back_url:$back_url]])}}" target="_blank">{{trans "Confirm Your Account"}}</a>
+                        <a href="{{var this.getUrl($store, 'customer/account/confirm/', [_query:[id:$customer.id, key:$customer.confirmation, back_url:$back_url]])}}" target="_blank">{{trans "Confirm Your Account"}}</a>
                     </td>
                 </tr>
             </table>
diff --git a/app/code/Magento/Customer/view/frontend/email/account_new_confirmed.html b/app/code/Magento/Customer/view/frontend/email/account_new_confirmed.html
index 0d800973e81..9ba8b14f1a7 100644
--- a/app/code/Magento/Customer/view/frontend/email/account_new_confirmed.html
+++ b/app/code/Magento/Customer/view/frontend/email/account_new_confirmed.html
@@ -6,7 +6,7 @@
 -->
 <!--@subject Welcome to {{var store.getFrontendName()}} @-->
 <!--@vars {
-"var store.getUrl('customer/account/')":"Customer Account URL",
+"var this.getUrl($store, 'customer/account/')":"Customer Account URL",
 "var customer.email":"Customer Email",
 "var customer.name":"Customer Name"
 } @-->
@@ -18,7 +18,7 @@
     {{trans
         'To sign in to our site, use these credentials during checkout or on the <a href="%customer_url">My Account</a> page:'
 
-        customer_url=$store.getUrl('customer/account/')
+        customer_url=$this.getUrl($store, 'customer/account/')
     |raw}}
 </p>
 <ul>
@@ -29,7 +29,7 @@
     {{trans
         'Forgot your account password? Click <a href="%reset_url">here</a> to reset it.'
 
-        reset_url="$store.getUrl('customer/account/createPassword/', [_query:[id:$customer.id, token:$customer.rp_token]])"
+        reset_url="$this.getUrl($store, 'customer/account/createPassword/', [_query:[id:$customer.id, token:$customer.rp_token]])"
     |raw}}
 </p>
 <p>{{trans "When you sign in to your account, you will be able to:"}}</p>
diff --git a/app/code/Magento/Customer/view/frontend/email/password_new.html b/app/code/Magento/Customer/view/frontend/email/password_new.html
index fe0b0c9cc51..ad9e9cfab50 100644
--- a/app/code/Magento/Customer/view/frontend/email/password_new.html
+++ b/app/code/Magento/Customer/view/frontend/email/password_new.html
@@ -6,7 +6,7 @@
 -->
 <!--@subject Reset your {{var store.getFrontendName()}} password @-->
 <!--@vars {
-"var store.getUrl('customer/account/')":"Customer Account URL",
+"var this.getUrl(store, 'customer/account/')":"Customer Account URL",
 "var customer.name":"Customer Name"
 } @-->
 {{template config_path="design/email/header_template"}}
@@ -21,7 +21,7 @@
             <table class="inner-wrapper" border="0" cellspacing="0" cellpadding="0" align="center">
                 <tr>
                     <td align="center">
-                        <a href="{{var store.getUrl('customer/account/createPassword', [_query:[id:$customer.id, token:$customer.rp_token]])}}" target="_blank">{{trans "Reset Password"}}</a>
+                        <a href="{{var this.getUrl($store, 'customer/account/createPassword', [_query:[id:$customer.id, token:$customer.rp_token]])}}" target="_blank">{{trans "Reset Password"}}</a>
                     </td>
                 </tr>
             </table>
diff --git a/app/code/Magento/Customer/view/frontend/email/password_reset_confirmation.html b/app/code/Magento/Customer/view/frontend/email/password_reset_confirmation.html
index d6f7a607bdd..28c6dacc08e 100644
--- a/app/code/Magento/Customer/view/frontend/email/password_reset_confirmation.html
+++ b/app/code/Magento/Customer/view/frontend/email/password_reset_confirmation.html
@@ -7,7 +7,7 @@
 <!--@subject Reset your {{var store.getFrontendName()}} password @-->
 <!--@vars {
 "var customer.name":"Customer Name",
-"var store.getUrl('customer/account/createPassword/', [_query:[id:$customer.id, token:$customer.rp_token]])":"Reset Password URL"
+"var this.getUrl($store, 'customer/account/createPassword/', [_query:[id:$customer.id, token:$customer.rp_token]])":"Reset Password URL"
 } @-->
 {{template config_path="design/email/header_template"}}
 
@@ -21,7 +21,7 @@
             <table class="inner-wrapper" border="0" cellspacing="0" cellpadding="0" align="center">
                 <tr>
                     <td align="center">
-                        <a href="{{var store.getUrl('customer/account/createPassword/', [_query:[id:$customer.id, token:$customer.rp_token]])}}" target="_blank">{{trans "Reset Password"}}</a>
+                        <a href="{{var this.getUrl($store, 'customer/account/createPassword/', [_query:[id:$customer.id, token:$customer.rp_token]])}}" target="_blank">{{trans "Reset Password"}}</a>
                     </td>
                 </tr>
             </table>
diff --git a/app/code/Magento/Email/Model/AbstractTemplate.php b/app/code/Magento/Email/Model/AbstractTemplate.php
index 1b438eaa913..85c545e1c97 100644
--- a/app/code/Magento/Email/Model/AbstractTemplate.php
+++ b/app/code/Magento/Email/Model/AbstractTemplate.php
@@ -146,6 +146,11 @@ abstract class AbstractTemplate extends AbstractModel implements TemplateTypesIn
      */
     protected $emailConfig;
 
+    /**
+     * @var \Magento\Framework\UrlInterface
+     */
+    private $urlModel;
+
     /**
      * @param \Magento\Framework\Model\Context $context
      * @param \Magento\Framework\View\DesignInterface $design
@@ -157,6 +162,7 @@ abstract class AbstractTemplate extends AbstractModel implements TemplateTypesIn
      * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
      * @param Template\Config $emailConfig
      * @param \Magento\Email\Model\TemplateFactory $templateFactory
+     * @param \Magento\Framework\Url $urlModel
      * @param array $data
      *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
@@ -172,6 +178,7 @@ abstract class AbstractTemplate extends AbstractModel implements TemplateTypesIn
         \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
         Template\Config $emailConfig,
         TemplateFactory $templateFactory,
+        \Magento\Framework\UrlInterface $urlModel,
         array $data = []
     ) {
         $this->design = $design;
@@ -184,6 +191,7 @@ abstract class AbstractTemplate extends AbstractModel implements TemplateTypesIn
         $this->scopeConfig = $scopeConfig;
         $this->emailConfig = $emailConfig;
         $this->templateFactory = $templateFactory;
+        $this->urlModel = $urlModel;
         parent::__construct($context, $registry, null, null, $data);
     }
 
@@ -716,4 +724,21 @@ abstract class AbstractTemplate extends AbstractModel implements TemplateTypesIn
      * @return int|string
      */
     abstract public function getType();
+
+    /**
+     * Generate URL for the specified store.
+     *
+     * @param \Magento\Store\Model\Store $store
+     * @param string $route
+     * @param array $params
+     * @return string
+     */
+    public function getUrl(\Magento\Store\Model\Store $store, $route = '', $params = [])
+    {
+        $url = $this->urlModel->setScope($store);
+        if ($this->storeManager->getStore()->getId() != $store->getId()) {
+            $params['_scope_to_url'] = true;
+        }
+        return $url->getUrl($route, $params);
+    }
 }
diff --git a/app/code/Magento/Email/Model/BackendTemplate.php b/app/code/Magento/Email/Model/BackendTemplate.php
index a89fe65fa75..dd5341f4fde 100644
--- a/app/code/Magento/Email/Model/BackendTemplate.php
+++ b/app/code/Magento/Email/Model/BackendTemplate.php
@@ -30,6 +30,7 @@ class BackendTemplate extends Template
      * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
      * @param \Magento\Email\Model\Template\Config $emailConfig
      * @param \Magento\Email\Model\TemplateFactory $templateFactory
+     * @param \Magento\Framework\UrlInterface $urlModel
      * @param \Magento\Email\Model\Template\FilterFactory $filterFactory
      * @param \Magento\Config\Model\Config\Structure $structure
      * @param array $data
@@ -47,6 +48,7 @@ class BackendTemplate extends Template
         \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
         \Magento\Email\Model\Template\Config $emailConfig,
         \Magento\Email\Model\TemplateFactory $templateFactory,
+        \Magento\Framework\UrlInterface $urlModel,
         \Magento\Email\Model\Template\FilterFactory $filterFactory,
         \Magento\Config\Model\Config\Structure $structure,
         array $data = []
@@ -63,6 +65,7 @@ class BackendTemplate extends Template
             $scopeConfig,
             $emailConfig,
             $templateFactory,
+            $urlModel,
             $filterFactory,
             $data
         );
diff --git a/app/code/Magento/Email/Model/Template.php b/app/code/Magento/Email/Model/Template.php
index cda315f41a5..883e957ea55 100644
--- a/app/code/Magento/Email/Model/Template.php
+++ b/app/code/Magento/Email/Model/Template.php
@@ -98,8 +98,6 @@ class Template extends AbstractTemplate implements \Magento\Framework\Mail\Templ
     protected $_sendingException = null;
 
     /**
-     * Constructor
-     *
      * Email filter factory
      *
      * @var \Magento\Email\Model\Template\FilterFactory
@@ -107,6 +105,8 @@ class Template extends AbstractTemplate implements \Magento\Framework\Mail\Templ
     private $filterFactory;
 
     /**
+     * Initialize dependencies
+     *
      * @param \Magento\Framework\Model\Context $context
      * @param \Magento\Framework\View\DesignInterface $design
      * @param \Magento\Framework\Registry $registry
@@ -117,6 +117,7 @@ class Template extends AbstractTemplate implements \Magento\Framework\Mail\Templ
      * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
      * @param Template\Config $emailConfig
      * @param \Magento\Email\Model\TemplateFactory $templateFactory
+     * @param \Magento\Framework\UrlInterface $urlModel
      * @param \Magento\Email\Model\Template\FilterFactory $filterFactory
      * @param array $data
      *
@@ -133,6 +134,7 @@ class Template extends AbstractTemplate implements \Magento\Framework\Mail\Templ
         \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
         \Magento\Email\Model\Template\Config $emailConfig,
         \Magento\Email\Model\TemplateFactory $templateFactory,
+        \Magento\Framework\UrlInterface $urlModel,
         \Magento\Email\Model\Template\FilterFactory $filterFactory,
         array $data = []
     ) {
@@ -148,6 +150,7 @@ class Template extends AbstractTemplate implements \Magento\Framework\Mail\Templ
             $scopeConfig,
             $emailConfig,
             $templateFactory,
+            $urlModel,
             $data
         );
     }
diff --git a/app/code/Magento/Email/etc/di.xml b/app/code/Magento/Email/etc/di.xml
index 6efcf948b59..4c27f5b4878 100644
--- a/app/code/Magento/Email/etc/di.xml
+++ b/app/code/Magento/Email/etc/di.xml
@@ -11,4 +11,14 @@
     <preference for="Magento\Framework\Mail\TransportInterface" type="Magento\Framework\Mail\Transport" />
     <preference for="Magento\Framework\Mail\MessageInterface" type="Magento\Framework\Mail\Message" />
     <preference for="Magento\Framework\Mail\Template\SenderResolverInterface" type="Magento\Email\Model\Template\SenderResolver" />
+    <type name="Magento\Email\Model\BackendTemplate">
+        <arguments>
+            <argument name="urlModel" xsi:type="object" shared="false">Magento\Backend\Model\Url</argument>
+        </arguments>
+    </type>
+    <type name="Magento\Email\Model\Template">
+        <arguments>
+            <argument name="urlModel" xsi:type="object" shared="false">Magento\Framework\Url</argument>
+        </arguments>
+    </type>
 </config>
diff --git a/app/code/Magento/Newsletter/Model/Template.php b/app/code/Magento/Newsletter/Model/Template.php
index d9f686853ac..1aee8771fd6 100644
--- a/app/code/Magento/Newsletter/Model/Template.php
+++ b/app/code/Magento/Newsletter/Model/Template.php
@@ -76,6 +76,7 @@ class Template extends \Magento\Email\Model\AbstractTemplate
      * @param \Magento\Email\Model\Template\Config $emailConfig
      * @param \Magento\Email\Model\TemplateFactory $templateFactory The template directive requires an email
      *        template model, not newsletter model, as templates overridden in backend are loaded from email table.
+     * @param \Magento\Framework\Url $urlModel
      * @param \Magento\Framework\App\RequestInterface $request
      * @param \Magento\Newsletter\Model\Template\FilterFactory $filterFactory,
      * @param array $data
@@ -92,6 +93,7 @@ class Template extends \Magento\Email\Model\AbstractTemplate
         \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
         \Magento\Email\Model\Template\Config $emailConfig,
         \Magento\Email\Model\TemplateFactory $templateFactory,
+        \Magento\Framework\UrlInterface $urlModel,
         \Magento\Framework\App\RequestInterface $request,
         \Magento\Newsletter\Model\Template\FilterFactory $filterFactory,
         array $data = []
@@ -107,6 +109,7 @@ class Template extends \Magento\Email\Model\AbstractTemplate
             $scopeConfig,
             $emailConfig,
             $templateFactory,
+            $urlModel,
             $data
         );
         $this->_storeManager = $storeManager;
diff --git a/app/code/Magento/Sales/view/frontend/email/creditmemo_new.html b/app/code/Magento/Sales/view/frontend/email/creditmemo_new.html
index 2b513aea62a..77e16e81b12 100644
--- a/app/code/Magento/Sales/view/frontend/email/creditmemo_new.html
+++ b/app/code/Magento/Sales/view/frontend/email/creditmemo_new.html
@@ -10,7 +10,7 @@
 "var comment":"Credit Memo Comment",
 "var creditmemo.increment_id":"Credit Memo Id",
 "layout handle=\"sales_email_order_creditmemo_items\" creditmemo=$creditmemo order=$order":"Credit Memo Items Grid",
-"var store.getUrl('customer/account/')":"Customer Account URL",
+"var this.getUrl($store, 'customer/account/')":"Customer Account URL",
 "var order.getCustomerName()":"Customer Name",
 "var order.increment_id":"Order Id",
 "var payment_html|raw":"Payment Details",
@@ -26,7 +26,7 @@
             <p class="greeting">{{trans "%name," name=$order.getCustomerName()}}</p>
             <p>
                 {{trans "Thank you for your order from %store_name." store_name=$store.getFrontendName()}}
-                {{trans 'You can check the status of your order by <a href="%account_url">logging into your account</a>.' account_url=$store.getUrl('customer/account/') |raw}}
+                {{trans 'You can check the status of your order by <a href="%account_url">logging into your account</a>.' account_url=$this.getUrl($store, 'customer/account/') |raw}}
                 {{trans 'If you have questions about your order, you can email us at <a href="mailto:%store_email">%store_email</a>' store_email=$store_email |raw}}{{depend store_phone}} {{trans 'or call us at <a href="tel:%store_phone">%store_phone</a>' store_phone=$store_phone |raw}}{{/depend}}.
                 {{depend store_hours}}
                     {{trans 'Our hours are <span class="no-link">%store_hours</span>.' store_hours=$store_hours |raw}}
diff --git a/app/code/Magento/Sales/view/frontend/email/creditmemo_update.html b/app/code/Magento/Sales/view/frontend/email/creditmemo_update.html
index aa97c943731..d0db9942fbf 100644
--- a/app/code/Magento/Sales/view/frontend/email/creditmemo_update.html
+++ b/app/code/Magento/Sales/view/frontend/email/creditmemo_update.html
@@ -8,7 +8,7 @@
 <!--@vars {
 "var comment":"Credit Memo Comment",
 "var creditmemo.increment_id":"Credit Memo Id",
-"var store.getUrl('customer/account/')":"Customer Account URL",
+"var this.getUrl($store, 'customer/account/')":"Customer Account URL",
 "var order.getCustomerName()":"Customer Name",
 "var order.increment_id":"Order Id",
 "var order.getStatusLabel()":"Order Status"
@@ -27,7 +27,7 @@
                     order_status=$order.getStatusLabel()
                 |raw}}
             </p>
-            <p>{{trans 'You can check the status of your order by <a href="%account_url">logging into your account</a>.' account_url=$store.getUrl('customer/account/') |raw}}</p>
+            <p>{{trans 'You can check the status of your order by <a href="%account_url">logging into your account</a>.' account_url=$this.getUrl($store, 'customer/account/') |raw}}</p>
             <p>
                 {{trans 'If you have questions about your order, you can email us at <a href="mailto:%store_email">%store_email</a>' store_email=$store_email |raw}}{{depend store_phone}} {{trans 'or call us at <a href="tel:%store_phone">%store_phone</a>' store_phone=$store_phone |raw}}{{/depend}}.
                 {{depend store_hours}}
diff --git a/app/code/Magento/Sales/view/frontend/email/invoice_new.html b/app/code/Magento/Sales/view/frontend/email/invoice_new.html
index 50b15e7eac4..ecd9564ceeb 100644
--- a/app/code/Magento/Sales/view/frontend/email/invoice_new.html
+++ b/app/code/Magento/Sales/view/frontend/email/invoice_new.html
@@ -7,7 +7,7 @@
 <!--@subject  {{var store.getFrontendName()}}: Invoice # {{var invoice.increment_id}} for Order # {{var order.increment_id}} @-->
 <!--@vars {
 "var formattedBillingAddress|raw":"Billing Address",
-"var store.getUrl('customer/account/')":"Customer Account URL",
+"var this.getUrl($store, 'customer/account/')":"Customer Account URL",
 "var order.getCustomerName()":"Customer Name",
 "var comment":"Invoice Comment",
 "var invoice.increment_id":"Invoice Id",
@@ -26,7 +26,7 @@
             <p class="greeting">{{trans "%name," name=$order.getCustomerName()}}</p>
             <p>
                 {{trans "Thank you for your order from %store_name." store_name=$store.getFrontendName()}}
-                {{trans 'You can check the status of your order by <a href="%account_url">logging into your account</a>.' account_url=$store.getUrl('customer/account/') |raw}}
+                {{trans 'You can check the status of your order by <a href="%account_url">logging into your account</a>.' account_url=$this.getUrl($store, 'customer/account/') |raw}}
                 {{trans 'If you have questions about your order, you can email us at <a href="mailto:%store_email">%store_email</a>' store_email=$store_email |raw}}{{depend store_phone}} {{trans 'or call us at <a href="tel:%store_phone">%store_phone</a>' store_phone=$store_phone |raw}}{{/depend}}.
                 {{depend store_hours}}
                     {{trans 'Our hours are <span class="no-link">%store_hours</span>.' store_hours=$store_hours |raw}}
diff --git a/app/code/Magento/Sales/view/frontend/email/invoice_update.html b/app/code/Magento/Sales/view/frontend/email/invoice_update.html
index d487fc7586d..e3efe0b257b 100644
--- a/app/code/Magento/Sales/view/frontend/email/invoice_update.html
+++ b/app/code/Magento/Sales/view/frontend/email/invoice_update.html
@@ -6,7 +6,7 @@
 -->
 <!--@subject {{var store.getFrontendName()}}: Invoice # {{var invoice.increment_id}} update @-->
 <!--@vars {
-"var store.getUrl('customer/account/')":"Customer Account URL",
+"var this.getUrl($store, 'customer/account/')":"Customer Account URL",
 "var order.getCustomerName()":"Customer Name",
 "var comment":"Invoice Comment",
 "var invoice.increment_id":"Invoice Id",
@@ -27,7 +27,7 @@
                     order_status=$order.getStatusLabel()
                 |raw}}
             </p>
-            <p>{{trans 'You can check the status of your order by <a href="%account_url">logging into your account</a>.' account_url=$store.getUrl('customer/account/') |raw}}</p>
+            <p>{{trans 'You can check the status of your order by <a href="%account_url">logging into your account</a>.' account_url=$this.getUrl($store, 'customer/account/') |raw}}</p>
             <p>
                 {{trans 'If you have questions about your order, you can email us at <a href="mailto:%store_email">%store_email</a>' store_email=$store_email |raw}}{{depend store_phone}} {{trans 'or call us at <a href="tel:%store_phone">%store_phone</a>' store_phone=$store_phone |raw}}{{/depend}}.
                 {{depend store_hours}}
diff --git a/app/code/Magento/Sales/view/frontend/email/order_new.html b/app/code/Magento/Sales/view/frontend/email/order_new.html
index b3447d2f813..fff9b93a0fe 100644
--- a/app/code/Magento/Sales/view/frontend/email/order_new.html
+++ b/app/code/Magento/Sales/view/frontend/email/order_new.html
@@ -24,7 +24,7 @@
             <p>
                 {{trans "Thank you for your order from %store_name." store_name=$store.getFrontendName()}}
                 {{trans "Once your package ships we will send you a tracking number."}}
-                {{trans 'You can check the status of your order by <a href="%account_url">logging into your account</a>.' account_url=$store.getUrl('customer/account/') |raw}}
+                {{trans 'You can check the status of your order by <a href="%account_url">logging into your account</a>.' account_url=$this.getUrl($store, 'customer/account/') |raw}}
             </p>
             <p>
                 {{trans 'If you have questions about your order, you can email us at <a href="mailto:%store_email">%store_email</a>' store_email=$store_email |raw}}{{depend store_phone}} {{trans 'or call us at <a href="tel:%store_phone">%store_phone</a>' store_phone=$store_phone |raw}}{{/depend}}.
diff --git a/app/code/Magento/Sales/view/frontend/email/order_update.html b/app/code/Magento/Sales/view/frontend/email/order_update.html
index da59fb187f6..c6659f27a79 100644
--- a/app/code/Magento/Sales/view/frontend/email/order_update.html
+++ b/app/code/Magento/Sales/view/frontend/email/order_update.html
@@ -6,7 +6,7 @@
 -->
 <!--@subject {{var store.getFrontendName()}}: Order # {{var order.increment_id}} update @-->
 <!--@vars {
-"var store.getUrl('customer/account/')":"Customer Account URL",
+"var this.getUrl($store, 'customer/account/')":"Customer Account URL",
 "var order.getCustomerName()":"Customer Name",
 "var comment":"Order Comment",
 "var order.increment_id":"Order Id",
@@ -26,7 +26,7 @@
                     order_status=$order.getStatusLabel()
                 |raw}}
             </p>
-            <p>{{trans 'You can check the status of your order by <a href="%account_url">logging into your account</a>.' account_url=$store.getUrl('customer/account/') |raw}}</p>
+            <p>{{trans 'You can check the status of your order by <a href="%account_url">logging into your account</a>.' account_url=$this.getUrl($store, 'customer/account/') |raw}}</p>
             <p>
                 {{trans 'If you have questions about your order, you can email us at <a href="mailto:%store_email">%store_email</a>' store_email=$store_email |raw}}{{depend store_phone}} {{trans 'or call us at <a href="tel:%store_phone">%store_phone</a>' store_phone=$store_phone |raw}}{{/depend}}.
                 {{depend store_hours}}
diff --git a/app/code/Magento/Sales/view/frontend/email/shipment_new.html b/app/code/Magento/Sales/view/frontend/email/shipment_new.html
index 41e8f7507ab..f22bba25ea1 100644
--- a/app/code/Magento/Sales/view/frontend/email/shipment_new.html
+++ b/app/code/Magento/Sales/view/frontend/email/shipment_new.html
@@ -7,7 +7,7 @@
 <!--@subject {{var store.getFrontendName()}}: Shipment # {{var shipment.increment_id}} for Order # {{var order.increment_id}} @-->
 <!--@vars {
 "var formattedBillingAddress|raw":"Billing Address",
-"var store.getUrl('customer/account/')":"Customer Account URL",
+"var this.getUrl($store, 'customer/account/')":"Customer Account URL",
 "var order.getCustomerName()":"Customer Name",
 "var order.increment_id":"Order Id",
 "var payment_html|raw":"Payment Details",
@@ -27,7 +27,7 @@
             <p class="greeting">{{trans "%name," name=$order.getCustomerName()}}</p>
             <p>
                 {{trans "Thank you for your order from %store_name." store_name=$store.getFrontendName()}}
-                {{trans 'You can check the status of your order by <a href="%account_url">logging into your account</a>.' account_url=$store.getUrl('customer/account/') |raw}}
+                {{trans 'You can check the status of your order by <a href="%account_url">logging into your account</a>.' account_url=$this.getUrl($store, 'customer/account/') |raw}}
                 {{trans 'If you have questions about your order, you can email us at <a href="mailto:%store_email">%store_email</a>' store_email=$store_email |raw}}{{depend store_phone}} {{trans 'or call us at <a href="tel:%store_phone">%store_phone</a>' store_phone=$store_phone |raw}}{{/depend}}.
                 {{depend store_hours}}
                     {{trans 'Our hours are <span class="no-link">%store_hours</span>.' store_hours=$store_hours |raw}}
diff --git a/app/code/Magento/Sales/view/frontend/email/shipment_update.html b/app/code/Magento/Sales/view/frontend/email/shipment_update.html
index 0c4ffa610ed..7dbea9b83dc 100644
--- a/app/code/Magento/Sales/view/frontend/email/shipment_update.html
+++ b/app/code/Magento/Sales/view/frontend/email/shipment_update.html
@@ -6,7 +6,7 @@
 -->
 <!--@subject {{var store.getFrontendName()}}: Shipment # {{var shipment.increment_id}} update @-->
 <!--@vars {
-"var store.getUrl('customer/account/')":"Customer Account URL",
+"var this.getUrl($store, 'customer/account/')":"Customer Account URL",
 "var order.getCustomerName()":"Customer Name",
 "var comment":"Order Comment",
 "var order.increment_id":"Order Id",
@@ -27,7 +27,7 @@
                     order_status=$order.getStatusLabel()
                 |raw}}
             </p>
-            <p>{{trans 'You can check the status of your order by <a href="%account_url">logging into your account</a>.' account_url=$store.getUrl('customer/account/') |raw}}</p>
+            <p>{{trans 'You can check the status of your order by <a href="%account_url">logging into your account</a>.' account_url=$this.getUrl($store, 'customer/account/') |raw}}</p>
             <p>
                 {{trans 'If you have questions about your order, you can email us at <a href="mailto:%store_email">%store_email</a>' store_email=$store_email |raw}}{{depend store_phone}} {{trans 'or call us at <a href="tel:%store_phone">%store_phone</a>' store_phone=$store_phone |raw}}{{/depend}}.
                 {{depend store_hours}}
-- 
GitLab