1111 */
1212namespace Magento \Shipping \Helper ;
1313
14+ use Magento \Framework \App \ObjectManager ;
15+ use Magento \Framework \UrlInterface ;
16+ use Magento \Store \Model \StoreManagerInterface ;
17+
1418class Data extends \Magento \Framework \App \Helper \AbstractHelper
1519{
1620 /**
@@ -21,19 +25,28 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper
2125 protected $ _allowedHashKeys = ['ship_id ' , 'order_id ' , 'track_id ' ];
2226
2327 /**
24- * @var \Magento\Store\Model\ StoreManagerInterface
28+ * @var StoreManagerInterface
2529 */
2630 protected $ _storeManager ;
2731
32+ /**
33+ * @var UrlInterface|null
34+ */
35+ private $ url ;
36+
2837 /**
2938 * @param \Magento\Framework\App\Helper\Context $context
30- * @param \Magento\Store\Model\StoreManagerInterface $storeManager
39+ * @param StoreManagerInterface $storeManager
40+ * @param UrlInterface|null $url
3141 */
3242 public function __construct (
3343 \Magento \Framework \App \Helper \Context $ context ,
34- \Magento \Store \Model \StoreManagerInterface $ storeManager
44+ StoreManagerInterface $ storeManager ,
45+ UrlInterface $ url = null
3546 ) {
3647 $ this ->_storeManager = $ storeManager ;
48+ $ this ->url = $ url ?: ObjectManager::getInstance ()->get (UrlInterface::class);
49+
3750 parent ::__construct ($ context );
3851 }
3952
@@ -64,12 +77,13 @@ protected function _getTrackingUrl($key, $model, $method = 'getId')
6477 {
6578 $ urlPart = "{$ key }: {$ model ->{$ method }()}: {$ model ->getProtectCode ()}" ;
6679 $ params = [
80+ '_scope ' => $ model ->getStoreId (),
81+ '_nosid ' => true ,
6782 '_direct ' => 'shipping/tracking/popup ' ,
6883 '_query ' => ['hash ' => $ this ->urlEncoder ->encode ($ urlPart )]
6984 ];
7085
71- $ storeModel = $ this ->_storeManager ->getStore ($ model ->getStoreId ());
72- return $ storeModel ->getUrl ('' , $ params );
86+ return $ this ->url ->getUrl ('' , $ params );
7387 }
7488
7589 /**
0 commit comments