i am creating a custom module and i want to include a custom phtml file above the attributes on the configurable product page…
Click here to see the requirements
Please take a look on the module files i have created and what i have done after some google search –
- etc/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="MagentoConfigurableProductBlockProductViewTypeConfigurable" type="Bay20WarehouseConfigurableBlockRewriteProductView" />
</config>
- view/frontened/layout/catalog_product_view_type_configurable.xml
<?xml version="1.0"?>
<!--
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<attribute name="class" value="page-product-configurable"/>
<referenceBlock name="product.info.options.wrapper">
<block class="MagentoConfigurableProductBlockProductViewTypeConfigurable" name="product.info.options.configurable" as="options_configurable" before="-" template="product/view/type/options/configurable.phtml"/>
</referenceBlock>
</body>
- view/templates/product/view/type/options/configurable.phtml
<?php
/** @var $block MagentoConfigurableProductBlockProductViewTypeConfigurable*/
//$_product = $block->getProduct();
//$_attributes = $block->decorateArray($block->getAllowAttributes());
?>
<p>Hello there</p>
but i am not able to get the file on configurable product view page, What’s wrong i am doing, please let me know.
thanks
2
Answers
I have achieved by this way.
create file as
file: catalog_product_view.xml
in PHTML file