Categories listing code in a phtml file and also add that block in xml after that not display on product page sidebar.
Please help me.
Thanks.
Are you looking for category list in product page ?
So you want to display all the category or the category hierarchy ?
Please mention what exactly you are looking for.
If you want to show the category navigation on product page first set the product layout to two column left then add the following code in you default.xml or from admin panel if you want to do specific product product design tab.
<referenceContainer name="sidebar.main"> <block class="Magento\LayeredNavigation\Block\Navigation\Category" name="catalog.leftnav" before="-" template="layer/view.phtml"> </block> </referenceContainer>