Skip to content

Instantly share code, notes, and snippets.

@tmp2000
Created June 5, 2017 09:00
Show Gist options
  • Save tmp2000/38bfd849ee2fb7b83ebc91716169b45c to your computer and use it in GitHub Desktop.
Save tmp2000/38bfd849ee2fb7b83ebc91716169b45c to your computer and use it in GitHub Desktop.
Magento / Get gallery images from product id
<?php
$backend = Mage::getResourceModel('catalog/product_attribute_backend_media');
$attributeId = Mage::getResourceModel('eav/entity_attribute')->getIdByCode('catalog_product', 'media_gallery');
$container = new Varien_Object(array(
'attribute' => new Varien_Object(array('id' => $attributeId))
));
$product = new Varien_Object(array(
'id' => 519,
'store_id' => Mage::app()->getStore()->getId(),
));
$gallery = $backend->loadGallery($product, $container);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment