11
11
*/
12
12
namespace Magento \Shipping \Helper ;
13
13
14
+ use Magento \Framework \App \ObjectManager ;
15
+ use Magento \Framework \UrlInterface ;
16
+ use Magento \Store \Model \StoreManagerInterface ;
17
+
14
18
class Data extends \Magento \Framework \App \Helper \AbstractHelper
15
19
{
16
20
/**
@@ -21,19 +25,28 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper
21
25
protected $ _allowedHashKeys = ['ship_id ' , 'order_id ' , 'track_id ' ];
22
26
23
27
/**
24
- * @var \Magento\Store\Model\ StoreManagerInterface
28
+ * @var StoreManagerInterface
25
29
*/
26
30
protected $ _storeManager ;
27
31
32
+ /**
33
+ * @var UrlInterface|null
34
+ */
35
+ private $ url ;
36
+
28
37
/**
29
38
* @param \Magento\Framework\App\Helper\Context $context
30
- * @param \Magento\Store\Model\StoreManagerInterface $storeManager
39
+ * @param StoreManagerInterface $storeManager
40
+ * @param UrlInterface|null $url
31
41
*/
32
42
public function __construct (
33
43
\Magento \Framework \App \Helper \Context $ context ,
34
- \Magento \Store \Model \StoreManagerInterface $ storeManager
44
+ StoreManagerInterface $ storeManager ,
45
+ UrlInterface $ url = null
35
46
) {
36
47
$ this ->_storeManager = $ storeManager ;
48
+ $ this ->url = $ url ?: ObjectManager::getInstance ()->get (UrlInterface::class);
49
+
37
50
parent ::__construct ($ context );
38
51
}
39
52
@@ -64,12 +77,13 @@ protected function _getTrackingUrl($key, $model, $method = 'getId')
64
77
{
65
78
$ urlPart = "{$ key }: {$ model ->{$ method }()}: {$ model ->getProtectCode ()}" ;
66
79
$ params = [
80
+ '_scope ' => $ model ->getStoreId (),
81
+ '_nosid ' => true ,
67
82
'_direct ' => 'shipping/tracking/popup ' ,
68
83
'_query ' => ['hash ' => $ this ->urlEncoder ->encode ($ urlPart )]
69
84
];
70
85
71
- $ storeModel = $ this ->_storeManager ->getStore ($ model ->getStoreId ());
72
- return $ storeModel ->getUrl ('' , $ params );
86
+ return $ this ->url ->getUrl ('' , $ params );
73
87
}
74
88
75
89
/**
0 commit comments