Magento 2

Magento 2

In this post we will show you Magento 2 Add Custom Tab to Product Page, hear for Magento 2 Add Custom Tab to Product Page we will give you demo and example for implement.

agento 2 Add Custom Tab to Product Page for including custom tabs. Gone is the local.xml document and the catalog.xml record. In it’s place, every module has it’s own particular arrangement of design records and layouts. In the present illustration, we will be adding a custom tab to the item see page. This tab will show diverse guarantee data in light of the estimation of the maker. [caption id="attachment_2321" align="aligncenter" width="1211"]how to add Magento 2 Add Custom Tab to Product Page how to add Magento 2 Add Custom Tab to Product Page[/caption] The initial step is to add the new tab to the catalog_product_view.xml record inside your subject envelope. The envelope structure would be app/outline/frontend/ThemePackage/Theme/Magento_Catalog/format/catalog_product_view.xml. We will include the tab by means of a refresh to the substance piece. That tab will call the warranty-info.phtml format. The guarantee data layout, thusly will check the item’s maker esteem and show a static square particularly for that producer. The guarantee info.phtml document will be in the app/plan/frontend/ThemePackage/Theme/Magento_Catalog/formats/item/see/folder. The Custom Tabs download connect beneath will open a content record with all the design and layout pieces used to make this custom tab.

code for Magento 2 Add Custom Tab to Product Page

for Magento 2 Add Custom Tab to Product Page, in your theme’s Magento_Catalog/layout/catalog_product_view.xml file, add the following to the content block:

[php] <referenceContainer name="content"> <block class="Magento\Catalog\Block\Product\View\Description" name="product.info.details" template="product/view/details.phtml" after="product.info.media"> <block class="Magento\Catalog\Block\Product\View\Description" name="product.info.description" template="product/view/attribute.phtml" group="detailed_info"> <arguments> <argument name="at_call" xsi:type="string">getDescription</argument> <argument name="at_code" xsi:type="string">description</argument> <argument name="css_class" xsi:type="string">description</argument> <argument name="at_label" xsi:type="string">none</argument> <argument name="title" translate="true" xsi:type="string">Details</argument> </arguments> </block> <block class="Magento\Catalog\Block\Product\View\Attributes" name="product.attributes" as="additional" template="product/view/attributes.phtml" group="detailed_info"> <arguments> <argument translate="true" name="title" xsi:type="string">More Information</argument> </arguments> </block> <block class="Magento\Catalog\Block\Product\View" name="warrantyinfo.tab" as="warrantyinfo" template="product/view/warranty_info.phtml" group="detailed_info" > <arguments> <argument translate="true" name="title" xsi:type="string">Warranty Information</argument> </arguments> </block> </block> </referenceContainer> [/php]

for Magento 2 Add Custom Tab to Product Page, Template warranty_info.phtml contains::

[php] <?php $_product = $block->getProduct(); ?> <?php if($_product->getResource()->getAttribute(‘manufacturer’)->getFrontend()->getValue($_product)): ?> <?php if ($_product->getAttributeText(‘manufacturer’) == ‘Brand One’): ?> <?php echo $block->getLayout()->createBlock(‘Magento\Cms\Block\Block’)->setBlockId(‘brand-one-warranty’)->toHtml();?> <?php elseif ($_product->getAttributeText(‘manufacturer’) == ‘Brand Two’): ?> <?php echo $block->getLayout()->createBlock(‘Magento\Cms\Block\Block’)->setBlockId(‘brand-two-warranty’)->toHtml();?> <?php endif; ?> <?php endif; ?> [/php] Hope this code and post will helped you for implement Magento 2 Add Custom Tab to Product Page. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve onlincode. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs
onlincode.org

In this post we will show you Magento 2 Add Custom Tab to Product Page, hear for Magento 2 Add Custom Tab to Product Page we will give you demo and example for implement. agento 2 Add Custom Tab to Product Page for including custom tabs. Gone is the local.xml document and the catalog.xml record. …

In this post we will show you Magento 2 Add Custom Tab to Product Page, hear for Magento 2 Add Custom Tab to Product Page we will give you demo and example for implement.

agento 2 Add Custom Tab to Product Page for including custom tabs. Gone is the local.xml document and the catalog.xml record. In it’s place, every module has it’s own particular arrangement of design records and layouts. In the present illustration, we will be adding a custom tab to the item see page. This tab will show diverse guarantee data in light of the estimation of the maker.
[caption id="attachment_2321" align="aligncenter" width="1211"]how to add Magento 2 Add Custom Tab to Product Page how to add Magento 2 Add Custom Tab to Product Page[/caption]
The initial step is to add the new tab to the catalog_product_view.xml record inside your subject envelope.

The envelope structure would be app/outline/frontend/ThemePackage/Theme/Magento_Catalog/format/catalog_product_view.xml.

We will include the tab by means of a refresh to the substance piece. That tab will call the warranty-info.phtml format.

The guarantee data layout, thusly will check the item’s maker esteem and show a static square particularly for that producer.

The guarantee info.phtml document will be in the app/plan/frontend/ThemePackage/Theme/Magento_Catalog/formats/item/see/folder.

The Custom Tabs download connect beneath will open a content record with all the design and layout pieces used to make this custom tab.

code for Magento 2 Add Custom Tab to Product Page

for Magento 2 Add Custom Tab to Product Page, in your theme’s Magento_Catalog/layout/catalog_product_view.xml file, add the following to the content block:

[php]
<referenceContainer name="content">
<block class="Magento\Catalog\Block\Product\View\Description" name="product.info.details" template="product/view/details.phtml" after="product.info.media">
<block class="Magento\Catalog\Block\Product\View\Description" name="product.info.description" template="product/view/attribute.phtml" group="detailed_info">
<arguments>
<argument name="at_call" xsi:type="string">getDescription</argument>
<argument name="at_code" xsi:type="string">description</argument>
<argument name="css_class" xsi:type="string">description</argument>
<argument name="at_label" xsi:type="string">none</argument>
<argument name="title" translate="true" xsi:type="string">Details</argument>
</arguments>
</block>
<block class="Magento\Catalog\Block\Product\View\Attributes" name="product.attributes" as="additional" template="product/view/attributes.phtml" group="detailed_info">
<arguments>
<argument translate="true" name="title" xsi:type="string">More Information</argument>
</arguments>
</block>
<block class="Magento\Catalog\Block\Product\View" name="warrantyinfo.tab" as="warrantyinfo" template="product/view/warranty_info.phtml" group="detailed_info" >
<arguments>
<argument translate="true" name="title" xsi:type="string">Warranty Information</argument>
</arguments>
</block>
</block>
</referenceContainer>
[/php]

for Magento 2 Add Custom Tab to Product Page, Template warranty_info.phtml contains::

[php]
<?php $_product = $block->getProduct(); ?>
<?php if($_product->getResource()->getAttribute(‘manufacturer’)->getFrontend()->getValue($_product)): ?>
<?php if ($_product->getAttributeText(‘manufacturer’) == ‘Brand One’): ?>
<?php echo $block->getLayout()->createBlock(‘Magento\Cms\Block\Block’)->setBlockId(‘brand-one-warranty’)->toHtml();?>
<?php elseif ($_product->getAttributeText(‘manufacturer’) == ‘Brand Two’): ?>
<?php echo $block->getLayout()->createBlock(‘Magento\Cms\Block\Block’)->setBlockId(‘brand-two-warranty’)->toHtml();?>
<?php endif; ?>
<?php endif; ?>
[/php]

Hope this code and post will helped you for implement Magento 2 Add Custom Tab to Product Page. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve onlincode. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs onlincode.org Read More »

register customer/user programmatically in magento 2

In this post we will show you how to add customer programmatically in magento 2. In this post we can register customer/user programmatically in magento 2. By using this code We can add customer to any store and website. once the customer created we can add address to the customer programmatically this following code in …

register customer/user programmatically in magento 2 Read More »

save default address programatically – magento2

save default address programatically – magento2 In this post we can add or update customer address programatically in magento2. In this code we pass customer address detail and update it. hear we chaek user is login or not. Hear we check customer is login or any other not. $get_Instance = \Magento\Framework\App\ObjectManager::getInstance(); // get login customer …

save default address programatically – magento2 Read More »

Magento 2 Create Invoice Programmatically

Magento 2 Create Invoice Programmatically In Magento a pair of, with the exception of making product and client programmatically, you’ll be able to conjointly produce invoice programmatically with ease once following the given guides within the Magento 2 Create invoice programmatically topic. Why do Magento 2 stores got to originated the program for making the …

Magento 2 Create Invoice Programmatically Read More »

We accept paid advance and paid guest Posting on our Site : Contact US