How to insert a link in Magento 2?How to redirect a category page link to CMS page link in Magento 2How can I move compare product link in header | Magento 2Magento 2 : Convert Attribute to LinkCustom Customer Account Link related page is not having navigation links on left side: Magento 2In Customer Account Dashboard Page i have added linkMagento : Upload .GIF image for a ProductMove theme layout elements on a product view from within a Module Magento 2How to insert specific invoice items in sales_invoice_item Table?How to copy a module in Magento2?How to create two pages from a same module in Magento 2?
If your plane is out-of-control, why does military training instruct releasing the joystick to neutralize controls?
Why are they 'nude photos'?
Switching interface VLAN ID Mid-Production
How to drill holes in 3/8" thick steel plates?
How to deal with moral/legal subjects in writing?
Should disabled buttons give feedback when clicked?
Is English unusual in having no second person plural form?
How to befriend private nested class
Misspelling my name on my mathematical publications
Fast validation of time windows in a routing problem
How do you move up one folder in Finder?
Confirming the Identity of a (Friendly) Reviewer After the Reviews
Sharing shapefile collection
Why is the ladder of the LM always in the dark side of the LM?
Employers keep telling me my college isn't good enough - is there any way to fix this?
Some interesting calculation puzzle that I made
Are there any medieval light sources without fire?
Does throwing a penny at a train stop the train?
Why did Harry Potter get a bedroom?
How can I truly shut down ssh server?
Graduate student with abysmal English writing skills, how to help
What is a "shilicashe?"
Why was hardware diversification an asset for the IBM PC ecosystem?
Why do we need common sense in AI?
How to insert a link in Magento 2?
How to redirect a category page link to CMS page link in Magento 2How can I move compare product link in header | Magento 2Magento 2 : Convert Attribute to LinkCustom Customer Account Link related page is not having navigation links on left side: Magento 2In Customer Account Dashboard Page i have added linkMagento : Upload .GIF image for a ProductMove theme layout elements on a product view from within a Module Magento 2How to insert specific invoice items in sales_invoice_item Table?How to copy a module in Magento2?How to create two pages from a same module in Magento 2?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I'm very new to Magento. I have created a page, and I want to insert a link.
I have this page:
When clicking on "Order Detail", It's will move to another page. I tried to research but I can't find a solution.
Can anyone help??? Thanks
magento2 product
add a comment |
I'm very new to Magento. I have created a page, and I want to insert a link.
I have this page:
When clicking on "Order Detail", It's will move to another page. I tried to research but I can't find a solution.
Can anyone help??? Thanks
magento2 product
If you have any confusion, feel free to ask me.
– Rohan Hapani
Jul 2 at 9:00
+1 for accept :) You can give upvote also by click on up arrow button. Happy coding :)
– Rohan Hapani
Jul 2 at 9:03
Thanks @Rohan. it worked fine
– user81098
Jul 2 at 9:03
add a comment |
I'm very new to Magento. I have created a page, and I want to insert a link.
I have this page:
When clicking on "Order Detail", It's will move to another page. I tried to research but I can't find a solution.
Can anyone help??? Thanks
magento2 product
I'm very new to Magento. I have created a page, and I want to insert a link.
I have this page:
When clicking on "Order Detail", It's will move to another page. I tried to research but I can't find a solution.
Can anyone help??? Thanks
magento2 product
magento2 product
edited Jul 2 at 8:48
Shorabh
1,0876 silver badges15 bronze badges
1,0876 silver badges15 bronze badges
asked Jul 2 at 8:42
user81098user81098
447 bronze badges
447 bronze badges
If you have any confusion, feel free to ask me.
– Rohan Hapani
Jul 2 at 9:00
+1 for accept :) You can give upvote also by click on up arrow button. Happy coding :)
– Rohan Hapani
Jul 2 at 9:03
Thanks @Rohan. it worked fine
– user81098
Jul 2 at 9:03
add a comment |
If you have any confusion, feel free to ask me.
– Rohan Hapani
Jul 2 at 9:00
+1 for accept :) You can give upvote also by click on up arrow button. Happy coding :)
– Rohan Hapani
Jul 2 at 9:03
Thanks @Rohan. it worked fine
– user81098
Jul 2 at 9:03
If you have any confusion, feel free to ask me.
– Rohan Hapani
Jul 2 at 9:00
If you have any confusion, feel free to ask me.
– Rohan Hapani
Jul 2 at 9:00
+1 for accept :) You can give upvote also by click on up arrow button. Happy coding :)
– Rohan Hapani
Jul 2 at 9:03
+1 for accept :) You can give upvote also by click on up arrow button. Happy coding :)
– Rohan Hapani
Jul 2 at 9:03
Thanks @Rohan. it worked fine
– user81098
Jul 2 at 9:03
Thanks @Rohan. it worked fine
– user81098
Jul 2 at 9:03
add a comment |
3 Answers
3
active
oldest
votes
If you want to redirect on custom module page. Then, you should create this files :
Create front router file : app/code/Vendor/Helloworld/etc/frontend/routes.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route id="helloworld" frontName="helloworld">
<module name="Vendor_Helloworld"/>
</route>
</router>
</config>
Create new controller : app/code/Vendor/Helloworld/Controller/Index/Index.php
<?php
namespace VendorHelloworldControllerIndex;
class Index extends MagentoFrameworkAppActionAction
/**
* @var MagentoFrameworkViewResultPageFactory
*/
protected $resultPageFactory;
/**
* @param MagentoFrameworkAppActionContext $context
* @param MagentoFrameworkViewResultPageFactory resultPageFactory
*/
public function __construct(
MagentoFrameworkAppActionContext $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory
)
$this->resultPageFactory = $resultPageFactory;
parent::__construct($context);
/**
* Default customer account page
*
* @return void
*/
public function execute()
$resultPage = $this->resultPageFactory->create();
$resultPage->getConfig()->getTitle()->prepend(__('Welcome to RH Helloworld module'));
return $resultPage;
?>
Create Block file : VendorHelloworldBlockHelloworld.php
<?php
namespace VendorHelloworldBlock;
class Helloworld extends MagentoFrameworkViewElementTemplate
public function __construct(
MagentoFrameworkViewElementTemplateContext $context,
array $data = []
)
parent::__construct($context, $data);
public function getHelloworldData()
return 'Helloworld block file call successfully';
?>
Create layout file : Vendor/Helloworld/view/frontend/layout/helloworld_index_index.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="VendorHelloworldBlockHelloworld" name="formbuilder" template="Vendor_Helloworld::helloworld.phtml"/>
</referenceContainer>
</body>
</page>
Create template file : Vendor/Helloworld/view/frontend/templates/helloworld.phtml
<h3>
<?php echo $block->getHelloworldData(); ?>
</h3>
=====================================================================
Now, add link in your phtml like :
<a href="<?pgp echo $this->getUrl("helloworld/index/index"); ?>">Order Detail</a>
I hope it will helpful for you.
add a comment |
Use product getProductUrl() function like.
<a href="<?pgp echo $_product->getProductUrl(); ?>">Order Detail</a>
Hi @Shorabh. I'm trying to do like this:<td data-th="<?= $block->escapeHtml(__('Actions')) ?>" class="col actions"> <a href="<?= $block->getDetailUrl($item) ?>" class="action view"> <span><?= $block->escapeHtml(__('Order Detail')) ?></span> </a> </td> Could you explain more detail about your answered? thanks
– user81098
Jul 2 at 8:52
add a comment |
You can add link with this reference :-
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$storeManager = $objectManager->get('MagentoStoreModelStoreManagerInterface');
$baseURL = $storeManager->getStore()->getBaseUrl();
$baseURL is your site URL and you can append page name as required
<a href="<?php echo $baseURL; ?>YourPageName">Order Detail</a>
Don't use object manager direct. It's bad practise.
– Rohan Hapani
Jul 2 at 9:02
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%2f280403%2fhow-to-insert-a-link-in-magento-2%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
If you want to redirect on custom module page. Then, you should create this files :
Create front router file : app/code/Vendor/Helloworld/etc/frontend/routes.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route id="helloworld" frontName="helloworld">
<module name="Vendor_Helloworld"/>
</route>
</router>
</config>
Create new controller : app/code/Vendor/Helloworld/Controller/Index/Index.php
<?php
namespace VendorHelloworldControllerIndex;
class Index extends MagentoFrameworkAppActionAction
/**
* @var MagentoFrameworkViewResultPageFactory
*/
protected $resultPageFactory;
/**
* @param MagentoFrameworkAppActionContext $context
* @param MagentoFrameworkViewResultPageFactory resultPageFactory
*/
public function __construct(
MagentoFrameworkAppActionContext $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory
)
$this->resultPageFactory = $resultPageFactory;
parent::__construct($context);
/**
* Default customer account page
*
* @return void
*/
public function execute()
$resultPage = $this->resultPageFactory->create();
$resultPage->getConfig()->getTitle()->prepend(__('Welcome to RH Helloworld module'));
return $resultPage;
?>
Create Block file : VendorHelloworldBlockHelloworld.php
<?php
namespace VendorHelloworldBlock;
class Helloworld extends MagentoFrameworkViewElementTemplate
public function __construct(
MagentoFrameworkViewElementTemplateContext $context,
array $data = []
)
parent::__construct($context, $data);
public function getHelloworldData()
return 'Helloworld block file call successfully';
?>
Create layout file : Vendor/Helloworld/view/frontend/layout/helloworld_index_index.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="VendorHelloworldBlockHelloworld" name="formbuilder" template="Vendor_Helloworld::helloworld.phtml"/>
</referenceContainer>
</body>
</page>
Create template file : Vendor/Helloworld/view/frontend/templates/helloworld.phtml
<h3>
<?php echo $block->getHelloworldData(); ?>
</h3>
=====================================================================
Now, add link in your phtml like :
<a href="<?pgp echo $this->getUrl("helloworld/index/index"); ?>">Order Detail</a>
I hope it will helpful for you.
add a comment |
If you want to redirect on custom module page. Then, you should create this files :
Create front router file : app/code/Vendor/Helloworld/etc/frontend/routes.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route id="helloworld" frontName="helloworld">
<module name="Vendor_Helloworld"/>
</route>
</router>
</config>
Create new controller : app/code/Vendor/Helloworld/Controller/Index/Index.php
<?php
namespace VendorHelloworldControllerIndex;
class Index extends MagentoFrameworkAppActionAction
/**
* @var MagentoFrameworkViewResultPageFactory
*/
protected $resultPageFactory;
/**
* @param MagentoFrameworkAppActionContext $context
* @param MagentoFrameworkViewResultPageFactory resultPageFactory
*/
public function __construct(
MagentoFrameworkAppActionContext $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory
)
$this->resultPageFactory = $resultPageFactory;
parent::__construct($context);
/**
* Default customer account page
*
* @return void
*/
public function execute()
$resultPage = $this->resultPageFactory->create();
$resultPage->getConfig()->getTitle()->prepend(__('Welcome to RH Helloworld module'));
return $resultPage;
?>
Create Block file : VendorHelloworldBlockHelloworld.php
<?php
namespace VendorHelloworldBlock;
class Helloworld extends MagentoFrameworkViewElementTemplate
public function __construct(
MagentoFrameworkViewElementTemplateContext $context,
array $data = []
)
parent::__construct($context, $data);
public function getHelloworldData()
return 'Helloworld block file call successfully';
?>
Create layout file : Vendor/Helloworld/view/frontend/layout/helloworld_index_index.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="VendorHelloworldBlockHelloworld" name="formbuilder" template="Vendor_Helloworld::helloworld.phtml"/>
</referenceContainer>
</body>
</page>
Create template file : Vendor/Helloworld/view/frontend/templates/helloworld.phtml
<h3>
<?php echo $block->getHelloworldData(); ?>
</h3>
=====================================================================
Now, add link in your phtml like :
<a href="<?pgp echo $this->getUrl("helloworld/index/index"); ?>">Order Detail</a>
I hope it will helpful for you.
add a comment |
If you want to redirect on custom module page. Then, you should create this files :
Create front router file : app/code/Vendor/Helloworld/etc/frontend/routes.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route id="helloworld" frontName="helloworld">
<module name="Vendor_Helloworld"/>
</route>
</router>
</config>
Create new controller : app/code/Vendor/Helloworld/Controller/Index/Index.php
<?php
namespace VendorHelloworldControllerIndex;
class Index extends MagentoFrameworkAppActionAction
/**
* @var MagentoFrameworkViewResultPageFactory
*/
protected $resultPageFactory;
/**
* @param MagentoFrameworkAppActionContext $context
* @param MagentoFrameworkViewResultPageFactory resultPageFactory
*/
public function __construct(
MagentoFrameworkAppActionContext $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory
)
$this->resultPageFactory = $resultPageFactory;
parent::__construct($context);
/**
* Default customer account page
*
* @return void
*/
public function execute()
$resultPage = $this->resultPageFactory->create();
$resultPage->getConfig()->getTitle()->prepend(__('Welcome to RH Helloworld module'));
return $resultPage;
?>
Create Block file : VendorHelloworldBlockHelloworld.php
<?php
namespace VendorHelloworldBlock;
class Helloworld extends MagentoFrameworkViewElementTemplate
public function __construct(
MagentoFrameworkViewElementTemplateContext $context,
array $data = []
)
parent::__construct($context, $data);
public function getHelloworldData()
return 'Helloworld block file call successfully';
?>
Create layout file : Vendor/Helloworld/view/frontend/layout/helloworld_index_index.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="VendorHelloworldBlockHelloworld" name="formbuilder" template="Vendor_Helloworld::helloworld.phtml"/>
</referenceContainer>
</body>
</page>
Create template file : Vendor/Helloworld/view/frontend/templates/helloworld.phtml
<h3>
<?php echo $block->getHelloworldData(); ?>
</h3>
=====================================================================
Now, add link in your phtml like :
<a href="<?pgp echo $this->getUrl("helloworld/index/index"); ?>">Order Detail</a>
I hope it will helpful for you.
If you want to redirect on custom module page. Then, you should create this files :
Create front router file : app/code/Vendor/Helloworld/etc/frontend/routes.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route id="helloworld" frontName="helloworld">
<module name="Vendor_Helloworld"/>
</route>
</router>
</config>
Create new controller : app/code/Vendor/Helloworld/Controller/Index/Index.php
<?php
namespace VendorHelloworldControllerIndex;
class Index extends MagentoFrameworkAppActionAction
/**
* @var MagentoFrameworkViewResultPageFactory
*/
protected $resultPageFactory;
/**
* @param MagentoFrameworkAppActionContext $context
* @param MagentoFrameworkViewResultPageFactory resultPageFactory
*/
public function __construct(
MagentoFrameworkAppActionContext $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory
)
$this->resultPageFactory = $resultPageFactory;
parent::__construct($context);
/**
* Default customer account page
*
* @return void
*/
public function execute()
$resultPage = $this->resultPageFactory->create();
$resultPage->getConfig()->getTitle()->prepend(__('Welcome to RH Helloworld module'));
return $resultPage;
?>
Create Block file : VendorHelloworldBlockHelloworld.php
<?php
namespace VendorHelloworldBlock;
class Helloworld extends MagentoFrameworkViewElementTemplate
public function __construct(
MagentoFrameworkViewElementTemplateContext $context,
array $data = []
)
parent::__construct($context, $data);
public function getHelloworldData()
return 'Helloworld block file call successfully';
?>
Create layout file : Vendor/Helloworld/view/frontend/layout/helloworld_index_index.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="VendorHelloworldBlockHelloworld" name="formbuilder" template="Vendor_Helloworld::helloworld.phtml"/>
</referenceContainer>
</body>
</page>
Create template file : Vendor/Helloworld/view/frontend/templates/helloworld.phtml
<h3>
<?php echo $block->getHelloworldData(); ?>
</h3>
=====================================================================
Now, add link in your phtml like :
<a href="<?pgp echo $this->getUrl("helloworld/index/index"); ?>">Order Detail</a>
I hope it will helpful for you.
answered Jul 2 at 8:58
Rohan HapaniRohan Hapani
7,6364 gold badges20 silver badges65 bronze badges
7,6364 gold badges20 silver badges65 bronze badges
add a comment |
add a comment |
Use product getProductUrl() function like.
<a href="<?pgp echo $_product->getProductUrl(); ?>">Order Detail</a>
Hi @Shorabh. I'm trying to do like this:<td data-th="<?= $block->escapeHtml(__('Actions')) ?>" class="col actions"> <a href="<?= $block->getDetailUrl($item) ?>" class="action view"> <span><?= $block->escapeHtml(__('Order Detail')) ?></span> </a> </td> Could you explain more detail about your answered? thanks
– user81098
Jul 2 at 8:52
add a comment |
Use product getProductUrl() function like.
<a href="<?pgp echo $_product->getProductUrl(); ?>">Order Detail</a>
Hi @Shorabh. I'm trying to do like this:<td data-th="<?= $block->escapeHtml(__('Actions')) ?>" class="col actions"> <a href="<?= $block->getDetailUrl($item) ?>" class="action view"> <span><?= $block->escapeHtml(__('Order Detail')) ?></span> </a> </td> Could you explain more detail about your answered? thanks
– user81098
Jul 2 at 8:52
add a comment |
Use product getProductUrl() function like.
<a href="<?pgp echo $_product->getProductUrl(); ?>">Order Detail</a>
Use product getProductUrl() function like.
<a href="<?pgp echo $_product->getProductUrl(); ?>">Order Detail</a>
answered Jul 2 at 8:46
ShorabhShorabh
1,0876 silver badges15 bronze badges
1,0876 silver badges15 bronze badges
Hi @Shorabh. I'm trying to do like this:<td data-th="<?= $block->escapeHtml(__('Actions')) ?>" class="col actions"> <a href="<?= $block->getDetailUrl($item) ?>" class="action view"> <span><?= $block->escapeHtml(__('Order Detail')) ?></span> </a> </td> Could you explain more detail about your answered? thanks
– user81098
Jul 2 at 8:52
add a comment |
Hi @Shorabh. I'm trying to do like this:<td data-th="<?= $block->escapeHtml(__('Actions')) ?>" class="col actions"> <a href="<?= $block->getDetailUrl($item) ?>" class="action view"> <span><?= $block->escapeHtml(__('Order Detail')) ?></span> </a> </td> Could you explain more detail about your answered? thanks
– user81098
Jul 2 at 8:52
Hi @Shorabh. I'm trying to do like this:<td data-th="<?= $block->escapeHtml(__('Actions')) ?>" class="col actions"> <a href="<?= $block->getDetailUrl($item) ?>" class="action view"> <span><?= $block->escapeHtml(__('Order Detail')) ?></span> </a> </td> Could you explain more detail about your answered? thanks
– user81098
Jul 2 at 8:52
Hi @Shorabh. I'm trying to do like this:<td data-th="<?= $block->escapeHtml(__('Actions')) ?>" class="col actions"> <a href="<?= $block->getDetailUrl($item) ?>" class="action view"> <span><?= $block->escapeHtml(__('Order Detail')) ?></span> </a> </td> Could you explain more detail about your answered? thanks
– user81098
Jul 2 at 8:52
add a comment |
You can add link with this reference :-
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$storeManager = $objectManager->get('MagentoStoreModelStoreManagerInterface');
$baseURL = $storeManager->getStore()->getBaseUrl();
$baseURL is your site URL and you can append page name as required
<a href="<?php echo $baseURL; ?>YourPageName">Order Detail</a>
Don't use object manager direct. It's bad practise.
– Rohan Hapani
Jul 2 at 9:02
add a comment |
You can add link with this reference :-
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$storeManager = $objectManager->get('MagentoStoreModelStoreManagerInterface');
$baseURL = $storeManager->getStore()->getBaseUrl();
$baseURL is your site URL and you can append page name as required
<a href="<?php echo $baseURL; ?>YourPageName">Order Detail</a>
Don't use object manager direct. It's bad practise.
– Rohan Hapani
Jul 2 at 9:02
add a comment |
You can add link with this reference :-
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$storeManager = $objectManager->get('MagentoStoreModelStoreManagerInterface');
$baseURL = $storeManager->getStore()->getBaseUrl();
$baseURL is your site URL and you can append page name as required
<a href="<?php echo $baseURL; ?>YourPageName">Order Detail</a>
You can add link with this reference :-
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$storeManager = $objectManager->get('MagentoStoreModelStoreManagerInterface');
$baseURL = $storeManager->getStore()->getBaseUrl();
$baseURL is your site URL and you can append page name as required
<a href="<?php echo $baseURL; ?>YourPageName">Order Detail</a>
edited Jul 2 at 9:01
Rohan Hapani
7,6364 gold badges20 silver badges65 bronze badges
7,6364 gold badges20 silver badges65 bronze badges
answered Jul 2 at 8:58
Kinjal PatelKinjal Patel
393 bronze badges
393 bronze badges
Don't use object manager direct. It's bad practise.
– Rohan Hapani
Jul 2 at 9:02
add a comment |
Don't use object manager direct. It's bad practise.
– Rohan Hapani
Jul 2 at 9:02
Don't use object manager direct. It's bad practise.
– Rohan Hapani
Jul 2 at 9:02
Don't use object manager direct. It's bad practise.
– Rohan Hapani
Jul 2 at 9:02
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%2f280403%2fhow-to-insert-a-link-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
If you have any confusion, feel free to ask me.
– Rohan Hapani
Jul 2 at 9:00
+1 for accept :) You can give upvote also by click on up arrow button. Happy coding :)
– Rohan Hapani
Jul 2 at 9:03
Thanks @Rohan. it worked fine
– user81098
Jul 2 at 9:03