New Tabs into product details and strings - Luma theme
-
11-10-2020 - |
Pregunta
How can I add new tabs in Luma theme to show more information about created attributes?
In the small description in the Italian view I leave the string "none", with code inspection the class is "type".
I tried to change the text of the product in the Italian view but it does not work.
Please help me.
Solución
Assuming you want to add a static block to hold the additional information about created attributes you can use below code:
<?xml version="1.0"?>
<page layout="1column" 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\Cms\Block\Block" name="additionalinfo.tab" as="additionalinfo" group="detailed_info" >
<arguments>
<argument translate="true" name="title" xsi:type="string">Addtional Information</argument>
<argument name="block_id" xsi:type="string">additionalinfo</argument>
</arguments>
</block>
</referenceBlock>
</body>
</page>
This would go in your theme within file:
Magento_Catalog/layout/catalog_product_view.xml
A block will need to be created called additionalinfo
and the information within here will be displayed in your tab. Similarly you can use phtml files that are shown instead of the static block.
Otros consejos
Override catalog_product_view.xml
in your module and add your block in product.info.details
reference block as shown below
<?xml version="1.0"?>
<page layout="1column" 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="Path/to/Block" name="nameofblock" template="Vendor_Module::path/to/template" group="detailed_info" >
<arguments>
<argument translate="true" name="title" xsi:type="string">Title of the tab</argument>
</arguments>
</block>
</referenceBlock>
</body>
</page>
Feel free ask any queries.