
MAGENTO 1.X – GET IMAGES URLS AND LABELS FROM PRODUCTS
If you need to get the url or labels of the images assigned on the products, you can perform the following:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
$productId = 'PRODUCT_ID'; $product = Mage::getModel('catalog/product')->load($productId); $productMediaConfig = Mage::getModel('catalog/product_media_config'); // URLs $baseImageUrl = $productMediaConfig->getMediaUrl($product->getImage()); $smallImageUrl = $productMediaConfig->getMediaUrl($product->getSmallImage()); $thumbnailUrl = $productMediaConfig->getMediaUrl($product->getThumbnail()); // Labels $_product->getData('image_label'); $_product->getData('small_image_label'); $_product->getData('thumbnail_label'); |