I'd like to create, on the product page, a button that leads to a specific tab with id = "exampleid"like "Be the first to review this product".
The phtml file is this:
<?php // @codingStandardsIgnoreFile /** * @var $block \Magento\Catalog\Block\Product\View */ ?> <?php $_product = $block->getProduct(); ?> <?php if($_product->getData('exampleattribute')==1){?> <div id="exampleid"> <?php echo $this->getLayout()->createBlock('Magento\Cms\Block\Block')->setBlockId('exampleblock')->toHtml();?> </div> <?php } ?> and the catalog_product_view.xml is this:
<?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceBlock name="product.info.details"> <block class="Magento\Catalog\Block\Product\View" name="example.tab" template="Vendor_extension::exampletab.phtml" group="detailed_info"> <arguments> <argument name="title" translate="true" xsi:type="string">Example tab</argument> <argument name="sort_order" xsi:type="string">25</argument> </arguments> </block> </referenceBlock> </body> </page> what is the correct and clean way to create a link that calls the id of the tab?
Thanks a lot to everyone ;)