5

How can I retrieve the category image (url) in the list.phtml file?

I am currently using this to get the current category:

<?php $category = $_objectManager->get('Magento\Framework\Registry')->registry('current_category'); ?>

But I don't know how to get the image url using $category?

  • Avoiding using Object Manager directly in template. – Khoa TruongDinh Mar 24 '17 at 14:28
7

We can try with $category->getImageUrl())

Take a look: vendor/magento/module-catalog/view/frontend/templates/category/image.phtml

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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