I have tried couple of ways that are already mention on Stack, but none worked for me.
What i have done so far is here….
- First i have created
attribute
in the back-end and assigned it to
defaultattribute set
. attribute code isyoutubevideo
-
I put following piece of code in
catalog_product_view.xml
<block class="Magento\Catalog\Block\Product\View\Description" name="product.info.video" template="product/view/video.phtml" group="detailed_info"> <arguments> <argument name="at_call" xsi:type="string">getYoutubevideo</argument> <argument name="at_code" xsi:type="string">youtubevideo</argument> <argument name="css_class" xsi:type="string">youtubevideo</argument> <argument name="at_label" xsi:type="string">none</argument> <argument name="title" translate="true" xsi:type="string">Video</argument> </arguments>
its not working with this way , the video.phtml
file is copy of attribute.phtml
file. which is present on the same path.
Its work if i change in xml video.phtml
to attribute.phtml
, But it shown on under tab. I don't want to show it in tab.
I'm working on Magento 2.0.9
What else way to shown it on product page somewhere else.
Any help would be appreciated Thanks
Best Answer
I have similar requirement to show some text attribute values on frontend on product view page after the short description.
I have modified
catalog_product_view.xml
and added my own template file in my custom theme.app/design/frontend/ThemePackage/themename/Magento_Catalog/layout/catalog_product_view.xml
app/design/frontend/ThemePackage/themename/Magento_Catalog/templates/product/view/customattribute.phtml
I have taken reference from [http://www.mohannatarajan.com/magento/magento2-get-product-attribute-value][1]