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?

1
  • Avoiding using Object Manager directly in template. Commented Mar 24, 2017 at 14:28

1 Answer 1

8

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 and acknowledge you have read our privacy policy.

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