0

I have my custom "sidebar_brand.phtml" in "catalog_product_view.xml".

<container name="right.product.container" as="rightProductContainer" label="Right Product Container" htmlTag="div" htmlClass="col-md-3 text-sm-center" >
    <block class="Magento\Catalog\Block\Product\View\Attributes" name="product.info.sidebarbrands" template="Magento_Catalog::product/view/sidebar-brand.phtml" after="product.info.main"/>
</container>

I have tried many different ways but I can not find out how to display the manufacturer attribute in this file.

Should I do it from the XML file or the phtml file?

I have seen different solutions, but nothing works. I am using Magento 2.2.3, how do I get the '$_product->getAttributeText('manufacturer');' working?

Sources: https://www.dckap.com/blog/display-custom-attribute-value-product-viewlist-page-magento-2/

https://stackoverflow.com/questions/37305107/how-do-i-display-an-attribute-on-product-view-page-in-magento-2

I am failing all the time! Can someone please show me how it should be in my Magento version?

The phtml file sidebar_brand.phtml works fine, but I am not able to show the product attribute.

Thank you in advance.

2
  • Can you update your whole xml code and also the sidebar_brand.phtml codes? Oct 8, 2018 at 14:23
  • After testing everything I now found out that the attribute Manufacturer was not active as default in the attribute set
    – M2newbie
    Oct 8, 2018 at 16:01

1 Answer 1

0

Your layout changes seem to fine ( and expecting .phtml changes fine too ) then only possible issue could be enabling storefrontend settings to view on catalog pages.

you need to check attribute front-end setting :

Stores->Attributes->Product

and find your manufacturer attribute ( click to edit ) and go to "Storefront Properties" ( as attached ) there you should change Visible on Catalog Pages on Storefront to Yes

enter image description here

hopefully it will work.

1
  • Hello, it was more simple then this. After testing everything I now found out that the attribute Manufacturer was not active as default in the attribute set. Might been working with Magento 1 too much! Thank you for your help.
    – M2newbie
    Oct 8, 2018 at 16:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.