Advertisement
pharmokan

magento get all gallery images

Apr 24th, 2020
710
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.54 KB | None | 0 0
  1. <?php
  2. error_reporting(E_ALL);
  3. ini_set('display_errors', 1);
  4.  ?>
  5. <?php
  6. require_once 'app/Mage.php';
  7. Mage::app();
  8.  
  9. $copypasta = <<< EOC
  10. <<< EOC
  11. SKU!
  12. SKU@
  13. SKU#
  14. EOC;
  15. $skus = explode(PHP_EOL, $copypasta);
  16.  
  17. foreach ($skus as $prod) {
  18.  
  19. $product = Mage::getModel('catalog/product')->loadByAttribute('sku', $prod);
  20.  
  21. if($product && $product->load('media_gallery')) {
  22.  
  23. foreach ($product->getMediaGalleryImages() as $image)
  24.   {
  25.     $file_name = $image->getFile();
  26.     echo  "URL" . $file_name;
  27.     echo "#";
  28.   }
  29. }
  30. echo "<br/>";
  31. }
  32.  
  33. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement