Advertisement
Guest User

Untitled

a guest
Aug 16th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. <?php
  2.  
  3. require_once 'abstract.php';
  4.  
  5. class Namespace_Shell_ImageCache extends Mage_Shell_Abstract
  6. {
  7.  
  8. public function run() {
  9. $imageType = Mage::getStoreConfig('algoliasearch/image/type');
  10. $imageWidth = Mage::getStoreConfig('algoliasearch/image/width');
  11. $imageHeight = Mage::getStoreConfig('algoliasearch/image/height');
  12.  
  13. $ids = Mage::getModel('catalog/product')->getCollection()
  14. ->addAttributeToFilter('status', array('eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED))
  15. ->addFieldToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)
  16. ->getAllIds();
  17.  
  18. foreach ($ids as $id) {
  19. $product = Mage::getModel('catalog/product')->load($id);
  20. echo $product->getSku(), PHP_EOL;
  21. echo Mage::helper('algoliasearch/image')->init($product, 'thumbnail')->resize(75, 75)->toString(), PHP_EOL;
  22. echo Mage::helper('algoliasearch/image')->init($product, $imageType)->resize($imageWidth, $imageHeight)->toString(), PHP_EOL;
  23. }
  24. }
  25. }
  26.  
  27. $shell = new Namespace_Shell_ImageCache();
  28. $shell->run();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement