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;








1















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.










share|improve this question






















  • Maybe you can try like this $this->storeManager->getStore()->getStoreUrl().'/'.$this->storeManager->getStore()->getCode().'oId/'.$orderData->getIncrementId().'/fId/'.$this->getFollowUpId();

    – magefms
    3 mins ago

















1















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.










share|improve this question






















  • Maybe you can try like this $this->storeManager->getStore()->getStoreUrl().'/'.$this->storeManager->getStore()->getCode().'oId/'.$orderData->getIncrementId().'/fId/'.$this->getFollowUpId();

    – magefms
    3 mins ago













1












1








1








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.










share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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

















  • 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










2 Answers
2






active

oldest

votes


















1














Try below code.



return $this->storeManager->getStore($orderData->getStoreId())->getBaseUrl(MagentoFrameworkUrlInterface::URL_TYPE_WEB).'oId/'.$orderData->getIncrementId().'/fId/'.$this->getFollowUpId();


It should work.






share|improve this answer


















  • 1





    Try this but it will return without store code like this http://example.com/oId/2000000058/fId/192

    – Chirag Patel
    16 mins ago


















1














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.






share|improve this answer























  • 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











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
);



);













draft saved

draft discarded


















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









1














Try below code.



return $this->storeManager->getStore($orderData->getStoreId())->getBaseUrl(MagentoFrameworkUrlInterface::URL_TYPE_WEB).'oId/'.$orderData->getIncrementId().'/fId/'.$this->getFollowUpId();


It should work.






share|improve this answer


















  • 1





    Try this but it will return without store code like this http://example.com/oId/2000000058/fId/192

    – Chirag Patel
    16 mins ago















1














Try below code.



return $this->storeManager->getStore($orderData->getStoreId())->getBaseUrl(MagentoFrameworkUrlInterface::URL_TYPE_WEB).'oId/'.$orderData->getIncrementId().'/fId/'.$this->getFollowUpId();


It should work.






share|improve this answer


















  • 1





    Try this but it will return without store code like this http://example.com/oId/2000000058/fId/192

    – Chirag Patel
    16 mins ago













1












1








1







Try below code.



return $this->storeManager->getStore($orderData->getStoreId())->getBaseUrl(MagentoFrameworkUrlInterface::URL_TYPE_WEB).'oId/'.$orderData->getIncrementId().'/fId/'.$this->getFollowUpId();


It should work.






share|improve this answer













Try below code.



return $this->storeManager->getStore($orderData->getStoreId())->getBaseUrl(MagentoFrameworkUrlInterface::URL_TYPE_WEB).'oId/'.$orderData->getIncrementId().'/fId/'.$this->getFollowUpId();


It should work.







share|improve this answer












share|improve this answer



share|improve this answer










answered 47 mins ago









Yash ShahYash Shah

1,04129




1,04129







  • 1





    Try this but it will return without store code like this http://example.com/oId/2000000058/fId/192

    – Chirag Patel
    16 mins ago












  • 1





    Try this but it will return without store code like this http://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













1














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.






share|improve this answer























  • 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














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.






share|improve this answer























  • 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












1








1







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.






share|improve this answer













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.







share|improve this answer












share|improve this answer



share|improve this answer










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

















  • 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

















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Log på Navigationsmenu

Creating second map without labels using QGIS?How to lock map labels for inset map in Print Composer?How to Force the Showing of Labels of a Vector File in QGISQGIS Valmiera, Labels only show for part of polygonsRemoving duplicate point labels in QGISLabeling every feature using QGIS?Show labels for point features outside map canvasAbbreviate Road Labels in QGIS only when requiredExporting map from composer in QGIS - text labels have moved in output?How to make sure labels in qgis turn up in layout map?Writing label expression with ArcMap and If then Statement?

Nuuk Indholdsfortegnelse Etyomologi | Historie | Geografi | Transport og infrastruktur | Politik og administration | Uddannelsesinstitutioner | Kultur | Venskabsbyer | Noter | Eksterne henvisninger | Se også | Navigationsmenuwww.sermersooq.gl64°10′N 51°45′V / 64.167°N 51.750°V / 64.167; -51.75064°10′N 51°45′V / 64.167°N 51.750°V / 64.167; -51.750DMI - KlimanormalerSalmonsen, s. 850Grønlands Naturinstitut undersøger rensdyr i Akia og Maniitsoq foråret 2008Grønlands NaturinstitutNy vej til Qinngorput indviet i dagAntallet af biler i Nuuk må begrænsesNy taxacentral mødt med demonstrationKøreplan. Rute 1, 2 og 3SnescootersporNuukNord er for storSkoler i Kommuneqarfik SermersooqAtuarfik Samuel KleinschmidtKangillinguit AtuarfiatNuussuup AtuarfiaNuuk Internationale FriskoleIlinniarfissuaq, Grønlands SeminariumLedelseÅrsberetning for 2008Kunst og arkitekturÅrsberetning for 2008Julie om naturenNuuk KunstmuseumSilamiutGrønlands Nationalmuseum og ArkivStatistisk ÅrbogGrønlands LandsbibliotekStore koncerter på stribeVandhund nummer 1.000.000Kommuneqarfik Sermersooq – MalikForsidenVenskabsbyerLyngby-Taarbæk i GrønlandArctic Business NetworkWinter Cities 2008 i NuukDagligt opdaterede satellitbilleder fra NuukområdetKommuneqarfik Sermersooqs hjemmesideTurist i NuukGrønlands Statistiks databankGrønlands Hjemmestyres valgresultaterrrWorldCat124325457671310-5