Issue
I have this code in my form.phtml
/**
* Product view template
*
* @var $block \Magento\Catalog\Block\Product\View
*/
<?php if ($_product->isSaleable() && $block->hasOptions() && $block->getOptionsContainer() == 'container2'): ?>
<?php echo $block->getChildChildHtml('options_container'); ?>
<?php endif;?>
And here is the layout catalog_product_view
<?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">
<head>
<css src="MM_Catalog::css/magnific-popup.css"/>
</head>
<body>
<referenceContainer name="content">
<referenceBlock name="product.info">
<action method="setTemplate">
<argument name="template" xsi:type="string">MM_Catalog::product/view/form.phtml</argument>
</action>
</referenceBlock>
</referenceContainer>
</body>
</page>
This works, but I need to add more fields into the printed fieldset. But I don't know where and how I am supposed to specify these fields that are printed into the fieldset.
Thanks for your help
Solution
Check the default layout file catalog_product_view.xml you will find that
"options_container" contains another secondary block inside it named as "product_options_wrapper" which contains the following template
Magento_Catalog::product/view/options/wrapper.phtml
You can add more fields here by overriding it in your custom module .
"product_options_wrapper" contains another secondary block "product_options" which is responsible for option's rendering.
So if you want to add more fields according to options you can find corresponding templates for each options over there like,for Text input
Magento_Catalog::product/view/options/type/text.phtml
You can add fields in this templates by overriding it in your custom module.
Answered By - Rahul Barot Answer Checked By - Clifford M. (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.