Question

I found the following errors in the exception.log and debug.log files in /var/log folder:

[2019-12-17 16:23:05] main.CRITICAL: The element "product.info.options" can't have a child because "product.info.options" already has a child with alias "default". {"exception":"[object] (Magento\\Framework\\Exception\\LocalizedException(code: 0): The element \"product.info.options\" can't have a child because \"product.info.options\" already has a child with alias \"default\". at /home/xxxxx/public_html/vendor/magento/framework/Data/Structure.php:625)"} []
[2019-12-17 16:23:05] main.CRITICAL: The element "product.info.options" can't have a child because "product.info.options" already has a child with alias "text". {"exception":"[object] (Magento\\Framework\\Exception\\LocalizedException(code: 0): The element \"product.info.options\" can't have a child because \"product.info.options\" already has a child with alias \"text\". at /home/xxxxx/public_html/vendor/magento/framework/Data/Structure.php:625)"} []
[2019-12-17 16:23:05] main.CRITICAL: The element "product.info.options" can't have a child because "product.info.options" already has a child with alias "file". {"exception":"[object] (Magento\\Framework\\Exception\\LocalizedException(code: 0): The element \"product.info.options\" can't have a child because \"product.info.options\" already has a child with alias \"file\". at /home/xxxxx/public_html/vendor/magento/framework/Data/Structure.php:625)"} []
[2019-12-17 16:23:05] main.CRITICAL: The element "product.info.options" can't have a child because "product.info.options" already has a child with alias "select". {"exception":"[object] (Magento\\Framework\\Exception\\LocalizedException(code: 0): The element \"product.info.options\" can't have a child because \"product.info.options\" already has a child with alias \"select\". at /home/xxxxx/public_html/vendor/magento/framework/Data/Structure.php:625)"} []
[2019-12-17 16:23:05] main.CRITICAL: The element "product.info.options" can't have a child because "product.info.options" already has a child with alias "date". {"exception":"[object] (Magento\\Framework\\Exception\\LocalizedException(code: 0): The element \"product.info.options\" can't have a child because \"product.info.options\" already has a child with alias \"date\". at /home/xxxxx/public_html/vendor/magento/framework/Data/Structure.php:625)"} []

Besides, in the catalog_product_view.xml file this is the block product.info.options.

                <block class="Magento\Catalog\Block\Product\View" name="product.info" template="product/view/form.phtml" after="estimated.delivery" before="product.info.details">
                    <container name="product.info.form.content" as="product_info_form_content">
                        <block class="Magento\Catalog\Block\Product\View" name="product.info.addtocart" as="addtocart" template="product/view/addtocart.phtml"/>
                    </container>
                    <block class="Magento\Framework\View\Element\Template" name="product.info.form.options" as="options_container">
                        <block class="Magento\Catalog\Block\Product\View" name="product.info.options.wrapper" as="product_options_wrapper" template="product/view/options/wrapper.phtml">
                            <block class="Magento\Catalog\Block\Product\View\Options" name="product.info.options" as="product_options" template="product/view/options.phtml">
                                <block class="Magento\Catalog\Block\Product\View\Options\Type\DefaultType" as="default" template="product/view/options/type/default.phtml"/>
                                <block class="Magento\Catalog\Block\Product\View\Options\Type\Text" as="text" template="product/view/options/type/text.phtml"/>
                                <block class="Magento\Catalog\Block\Product\View\Options\Type\File" as="file" template="product/view/options/type/file.phtml"/>
                                <block class="Magento\Catalog\Block\Product\View\Options\Type\Select" as="select" template="product/view/options/type/select.phtml"/>
                                <block class="Magento\Catalog\Block\Product\View\Options\Type\Date" as="date" template="product/view/options/type/date.phtml"/>
                            </block>
                            <block class="Magento\Framework\View\Element\Html\Calendar" name="html_calendar" as="html_calendar" template="Magento_Theme::js/calendar.phtml"/>
                        </block>
                        <block class="Magento\Catalog\Block\Product\View" name="product.info.options.wrapper.bottom" as="product_options_wrapper_bottom" template="product/view/options/wrapper/bottom.phtml">
                            <block class="Magento\Catalog\Block\Product\View" name="product.info.addtocart.additional" as="product.info.addtocart" template="product/view/addtocart.phtml"/>
                        </block>
                    </block>
                </block>

Any idea on how to resolve this issue of the template?

No correct solution

OTHER TIPS

The names and alias of each blocks have to be unique. you have to find in your theme the following snippets.

as="default" , as="text" , as="file , as="select" , as="date"

What solved the exception for me was doing the following:

If you open the original file:

app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml

You'll see that there's a difference because the children have names assigned.

But in your xml from your theme, you don't have the names.

enter image description here

So adding the name attribute to the children of product.info.options stopped the exception in my case.

Btw don't forget to clear Magento cache.

References:

https://github.com/magento/magento2/pull/8514/files

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top