enter image description here

I can get all the category names and ids by the following code, but I can only get the thumbnails of the first level classification, can't get the pictures of the subclasses? What should I do? If you can help me, this will be a wonderful thing.


Be sure to load the category model each time.

$category = Mage::getModel('catalog/category')->load($id);
$imageUrl = $category->getImageUrl();

You can get the image of a category after load category. Following code will help you.

protected $_storeManager;
public function __construct(
\Magento\Store\Model\StoreManagerInterface $storeManager ) { $this->_storeManager = $storeManager;

public function getThumbnailUrl($imageName){ $url = $this->_storeManager->getStore()->getBaseUrl( \Magento\Framework\UrlInterface::URL_TYPE_MEDIA ) . 'catalog/category/' . $imageName; return $url; }

$_objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $load_cat = $_objectManager->create('Magento\Catalog\Model\Category')->load($_subcategory->getId());



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.