How to pass store code to custom URL in magento 2How to get Magento 2 base URL?Custom URL for magento extensionRemoving Magento Store URLs Param ?__store=How to get Magento root url properly?module pass custom url parametersMagento 2.1.1: How can we add Payment Information (custom payment) to an order?Getting URL for Products only works for first storeMagento 2: How to get secure category URL programmatically?How to know if module's output is disabled in magento 2?Magento 2.2.3 How to change validation message Or add new custom rule in system config fieldMagento 2.3.0 How to add store filter in searchCriteriaBuilder
Failing students when it might cause them economic ruin
Cuban Primes
Why did the soldiers of the North disobey Jon?
How could it be that 80% of townspeople were farmers during the Edo period in Japan?
Do high-wing aircraft represent more difficult engineering challenges than low-wing aircraft?
Working hours and productivity expectations for game artists and programmers
Why would company (decision makers) wait for someone to retire, rather than lay them off, when their role is no longer needed?
Given 0s on Assignments with suspected and dismissed cheating?
Cannot remove door knob -- totally inaccessible!
Why is the A380’s with-reversers stopping distance the same as its no-reversers stopping distance?
How can I safely determine the output voltage and current of a transformer?
Why doesn't Iron Man's action affect this person in Endgame?
Why does string strummed with finger sound different from the one strummed with pick?
What are the effects of eating many berries from the Goodberry spell per day?
What is this rubber on gear cables
Why is so much ransomware breakable?
Why is vowel phonology represented in a trapezoid instead of a square?
301 Redirects what does ([a-z]+)-(.*) and ([0-9]+)-(.*) mean
How to know the path of a particular software?
Why were the bells ignored in S8E5?
AD: OU for system administrator accounts
What is the velocity distribution of the exhaust for a typical rocket engine?
Square spiral in Mathematica
Roman Numerals Equation 2
How to pass store code to custom URL in magento 2
How to get Magento 2 base URL?Custom URL for magento extensionRemoving Magento Store URLs Param ?__store=How to get Magento root url properly?module pass custom url parametersMagento 2.1.1: How can we add Payment Information (custom payment) to an order?Getting URL for Products only works for first storeMagento 2: How to get secure category URL programmatically?How to know if module's output is disabled in magento 2?Magento 2.2.3 How to change validation message Or add new custom rule in system config fieldMagento 2.3.0 How to add store filter in searchCriteriaBuilder
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I would like to add store code to a custom URL in Magento 2.3.0
Actually, I want to pass store code to a custom URL in my custom module based on relevant store order.
Let's take an example:
public function getCustomUrl($orderData)
if($this->emailHelper->dynamicUrl())
return $this->urlInterface->getUrl($this->emailHelper->dynamicUrl()).'oId/'.$orderData->getIncrementId().'/fId/'.$this->getFollowUpId();
else
return $this->urlInterface->getUrl('route/controller/index/'.'oId/'.$orderData->getIncrementId().'/fId/'.$this->getFollowUpId());
In the above code
$orderData = order object i can get storeId in this object
$this->emailHelper->dynamicUrl() = get custom string from system config
$orderData->getIncrementId() = pass orderId to url params
$this->getFollowUpId() = module custom table ID pass to url params.
Above code, the result is http://example.com/default/seo/oId/000000112/fId/179
where /default/
is store code. I would like to pass /store2Code/ instead of
/default/where
/store2Code/` is order placed on store 2.
So in short pass store code based on the placed order store.
Note : I have enabled pass store code to URL from system config. so the reason for this store code is showing in URL.
Any help would be appreciated! Thanks.
module url helper magento2.3.0
add a comment |
I would like to add store code to a custom URL in Magento 2.3.0
Actually, I want to pass store code to a custom URL in my custom module based on relevant store order.
Let's take an example:
public function getCustomUrl($orderData)
if($this->emailHelper->dynamicUrl())
return $this->urlInterface->getUrl($this->emailHelper->dynamicUrl()).'oId/'.$orderData->getIncrementId().'/fId/'.$this->getFollowUpId();
else
return $this->urlInterface->getUrl('route/controller/index/'.'oId/'.$orderData->getIncrementId().'/fId/'.$this->getFollowUpId());
In the above code
$orderData = order object i can get storeId in this object
$this->emailHelper->dynamicUrl() = get custom string from system config
$orderData->getIncrementId() = pass orderId to url params
$this->getFollowUpId() = module custom table ID pass to url params.
Above code, the result is http://example.com/default/seo/oId/000000112/fId/179
where /default/
is store code. I would like to pass /store2Code/ instead of
/default/where
/store2Code/` is order placed on store 2.
So in short pass store code based on the placed order store.
Note : I have enabled pass store code to URL from system config. so the reason for this store code is showing in URL.
Any help would be appreciated! Thanks.
module url helper magento2.3.0
Maybe you can try like this$this->storeManager->getStore()->getStoreUrl().'/'.$this->storeManager->getStore()->getCode().'oId/'.$orderData->getIncrementId().'/fId/'.$this->getFollowUpId();
– magefms
3 mins ago
add a comment |
I would like to add store code to a custom URL in Magento 2.3.0
Actually, I want to pass store code to a custom URL in my custom module based on relevant store order.
Let's take an example:
public function getCustomUrl($orderData)
if($this->emailHelper->dynamicUrl())
return $this->urlInterface->getUrl($this->emailHelper->dynamicUrl()).'oId/'.$orderData->getIncrementId().'/fId/'.$this->getFollowUpId();
else
return $this->urlInterface->getUrl('route/controller/index/'.'oId/'.$orderData->getIncrementId().'/fId/'.$this->getFollowUpId());
In the above code
$orderData = order object i can get storeId in this object
$this->emailHelper->dynamicUrl() = get custom string from system config
$orderData->getIncrementId() = pass orderId to url params
$this->getFollowUpId() = module custom table ID pass to url params.
Above code, the result is http://example.com/default/seo/oId/000000112/fId/179
where /default/
is store code. I would like to pass /store2Code/ instead of
/default/where
/store2Code/` is order placed on store 2.
So in short pass store code based on the placed order store.
Note : I have enabled pass store code to URL from system config. so the reason for this store code is showing in URL.
Any help would be appreciated! Thanks.
module url helper magento2.3.0
I would like to add store code to a custom URL in Magento 2.3.0
Actually, I want to pass store code to a custom URL in my custom module based on relevant store order.
Let's take an example:
public function getCustomUrl($orderData)
if($this->emailHelper->dynamicUrl())
return $this->urlInterface->getUrl($this->emailHelper->dynamicUrl()).'oId/'.$orderData->getIncrementId().'/fId/'.$this->getFollowUpId();
else
return $this->urlInterface->getUrl('route/controller/index/'.'oId/'.$orderData->getIncrementId().'/fId/'.$this->getFollowUpId());
In the above code
$orderData = order object i can get storeId in this object
$this->emailHelper->dynamicUrl() = get custom string from system config
$orderData->getIncrementId() = pass orderId to url params
$this->getFollowUpId() = module custom table ID pass to url params.
Above code, the result is http://example.com/default/seo/oId/000000112/fId/179
where /default/
is store code. I would like to pass /store2Code/ instead of
/default/where
/store2Code/` is order placed on store 2.
So in short pass store code based on the placed order store.
Note : I have enabled pass store code to URL from system config. so the reason for this store code is showing in URL.
Any help would be appreciated! Thanks.
module url helper magento2.3.0
module url helper magento2.3.0
asked 52 mins ago
Chirag PatelChirag Patel
2,948524
2,948524
Maybe you can try like this$this->storeManager->getStore()->getStoreUrl().'/'.$this->storeManager->getStore()->getCode().'oId/'.$orderData->getIncrementId().'/fId/'.$this->getFollowUpId();
– magefms
3 mins ago
add a comment |
Maybe you can try like this$this->storeManager->getStore()->getStoreUrl().'/'.$this->storeManager->getStore()->getCode().'oId/'.$orderData->getIncrementId().'/fId/'.$this->getFollowUpId();
– magefms
3 mins ago
Maybe you can try like this
$this->storeManager->getStore()->getStoreUrl().'/'.$this->storeManager->getStore()->getCode().'oId/'.$orderData->getIncrementId().'/fId/'.$this->getFollowUpId();
– magefms
3 mins ago
Maybe you can try like this
$this->storeManager->getStore()->getStoreUrl().'/'.$this->storeManager->getStore()->getCode().'oId/'.$orderData->getIncrementId().'/fId/'.$this->getFollowUpId();
– magefms
3 mins ago
add a comment |
2 Answers
2
active
oldest
votes
Try below code.
return $this->storeManager->getStore($orderData->getStoreId())->getBaseUrl(MagentoFrameworkUrlInterface::URL_TYPE_WEB).'oId/'.$orderData->getIncrementId().'/fId/'.$this->getFollowUpId();
It should work.
1
Try this but it will return without store code like thishttp://example.com/oId/2000000058/fId/192
– Chirag Patel
16 mins ago
add a comment |
I guess this can help you https://magento.stackexchange.com/a/84982/45214 .
In the above link, the BaseUrl is already obtained from storemanager and it will return the store's baseurl. If you have enabled the configuration from the backend to display store_code (for ex. en_US) along with the BaseUrl in the URL, then it will return the BaseUrl/store_code/ as Base Url.
Hope this will be helpful.
I have already seen this reference url but it's not relevant what i want.
– Chirag Patel
15 mins ago
+1 for your efforts :)
– Chirag Patel
14 mins ago
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f274787%2fhow-to-pass-store-code-to-custom-url-in-magento-2%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try below code.
return $this->storeManager->getStore($orderData->getStoreId())->getBaseUrl(MagentoFrameworkUrlInterface::URL_TYPE_WEB).'oId/'.$orderData->getIncrementId().'/fId/'.$this->getFollowUpId();
It should work.
1
Try this but it will return without store code like thishttp://example.com/oId/2000000058/fId/192
– Chirag Patel
16 mins ago
add a comment |
Try below code.
return $this->storeManager->getStore($orderData->getStoreId())->getBaseUrl(MagentoFrameworkUrlInterface::URL_TYPE_WEB).'oId/'.$orderData->getIncrementId().'/fId/'.$this->getFollowUpId();
It should work.
1
Try this but it will return without store code like thishttp://example.com/oId/2000000058/fId/192
– Chirag Patel
16 mins ago
add a comment |
Try below code.
return $this->storeManager->getStore($orderData->getStoreId())->getBaseUrl(MagentoFrameworkUrlInterface::URL_TYPE_WEB).'oId/'.$orderData->getIncrementId().'/fId/'.$this->getFollowUpId();
It should work.
Try below code.
return $this->storeManager->getStore($orderData->getStoreId())->getBaseUrl(MagentoFrameworkUrlInterface::URL_TYPE_WEB).'oId/'.$orderData->getIncrementId().'/fId/'.$this->getFollowUpId();
It should work.
answered 47 mins ago
Yash ShahYash Shah
1,04129
1,04129
1
Try this but it will return without store code like thishttp://example.com/oId/2000000058/fId/192
– Chirag Patel
16 mins ago
add a comment |
1
Try this but it will return without store code like thishttp://example.com/oId/2000000058/fId/192
– Chirag Patel
16 mins ago
1
1
Try this but it will return without store code like this
http://example.com/oId/2000000058/fId/192
– Chirag Patel
16 mins ago
Try this but it will return without store code like this
http://example.com/oId/2000000058/fId/192
– Chirag Patel
16 mins ago
add a comment |
I guess this can help you https://magento.stackexchange.com/a/84982/45214 .
In the above link, the BaseUrl is already obtained from storemanager and it will return the store's baseurl. If you have enabled the configuration from the backend to display store_code (for ex. en_US) along with the BaseUrl in the URL, then it will return the BaseUrl/store_code/ as Base Url.
Hope this will be helpful.
I have already seen this reference url but it's not relevant what i want.
– Chirag Patel
15 mins ago
+1 for your efforts :)
– Chirag Patel
14 mins ago
add a comment |
I guess this can help you https://magento.stackexchange.com/a/84982/45214 .
In the above link, the BaseUrl is already obtained from storemanager and it will return the store's baseurl. If you have enabled the configuration from the backend to display store_code (for ex. en_US) along with the BaseUrl in the URL, then it will return the BaseUrl/store_code/ as Base Url.
Hope this will be helpful.
I have already seen this reference url but it's not relevant what i want.
– Chirag Patel
15 mins ago
+1 for your efforts :)
– Chirag Patel
14 mins ago
add a comment |
I guess this can help you https://magento.stackexchange.com/a/84982/45214 .
In the above link, the BaseUrl is already obtained from storemanager and it will return the store's baseurl. If you have enabled the configuration from the backend to display store_code (for ex. en_US) along with the BaseUrl in the URL, then it will return the BaseUrl/store_code/ as Base Url.
Hope this will be helpful.
I guess this can help you https://magento.stackexchange.com/a/84982/45214 .
In the above link, the BaseUrl is already obtained from storemanager and it will return the store's baseurl. If you have enabled the configuration from the backend to display store_code (for ex. en_US) along with the BaseUrl in the URL, then it will return the BaseUrl/store_code/ as Base Url.
Hope this will be helpful.
answered 46 mins ago
Kazim NooraniKazim Noorani
1,0721723
1,0721723
I have already seen this reference url but it's not relevant what i want.
– Chirag Patel
15 mins ago
+1 for your efforts :)
– Chirag Patel
14 mins ago
add a comment |
I have already seen this reference url but it's not relevant what i want.
– Chirag Patel
15 mins ago
+1 for your efforts :)
– Chirag Patel
14 mins ago
I have already seen this reference url but it's not relevant what i want.
– Chirag Patel
15 mins ago
I have already seen this reference url but it's not relevant what i want.
– Chirag Patel
15 mins ago
+1 for your efforts :)
– Chirag Patel
14 mins ago
+1 for your efforts :)
– Chirag Patel
14 mins ago
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f274787%2fhow-to-pass-store-code-to-custom-url-in-magento-2%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Maybe you can try like this
$this->storeManager->getStore()->getStoreUrl().'/'.$this->storeManager->getStore()->getCode().'oId/'.$orderData->getIncrementId().'/fId/'.$this->getFollowUpId();
– magefms
3 mins ago