Magento Asked on January 6, 2022
I want to add custom link in More Information tab.
See attached screenshot:
I want to give a link instead of text
I was able to do this by adding the attribute then importing via csv with text similar to the following
'<a href='https://pirate.black/' target='_blank'>https://pirate.black//</a>
It will also work if directly entered in the new product attribute.
Answered by user10588486 on January 6, 2022
Create an Attribute in admin with text type say external_link
Add phtml at:
app/design/frontend/{Package}/{theme}/Magento_Catalog/layout/catalog_product_view.xml
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="product.info.addtocart">
<block class="MagentoCatalogBlockProductView" name="external.link" template="Magento_Catalog::externallink.phtml"/>
</referenceBlock>
</body>
</page>
Now create phtml and get attribute value:
app/design/frontend/{Package}/{theme}/Magento_Catalog/templates/externallink.phtml
<?php $product = $block->getProduct(); ?>
<?php if($link = $product->getExternalLink()){ ?>
<div class="link">
<a href="<?= $link; ?>"><?= $block->escapeHtml(__('Link text')) ?></a>
</div>
<?php } ?>
Hope above will help!
Answered by Pawan on January 6, 2022
Then you need to do the following things.
first create one product attribute where you mention this link of third party.
Now create one custom extension and create custom phtml file and call the file on product page on specific by using reference block.
Now in that phtml file, fetch that product attribute value and show to customer.
Answered by Dhiren Vasoya on January 6, 2022
0 Asked on March 2, 2021 by kowsigan-atsayam
0 Asked on March 2, 2021
configurable product downloadable grouped products magento2 simple product
2 Asked on March 1, 2021 by vikas-kalal
4 Asked on March 1, 2021 by arvind07
1 Asked on February 26, 2021 by ijeep
3 Asked on February 25, 2021 by crim
1 Asked on February 24, 2021 by magento_learner
1 Asked on February 24, 2021
4 Asked on February 22, 2021
0 Asked on February 20, 2021 by anonymous-record
1 Asked on February 20, 2021
0 Asked on February 20, 2021 by sarvesh-tiwari
1 Asked on February 19, 2021 by jayreis
0 Asked on February 19, 2021
2 Asked on February 18, 2021 by ashish-jagnani
8 Asked on February 17, 2021 by mubashar-aftab
1 Asked on February 17, 2021 by shahzad-h
Get help from others!
Recent Questions
Recent Answers
© 2023 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP