Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once 'abstract.php';
- class Namespace_Shell_ImageCache extends Mage_Shell_Abstract
- {
- public function run() {
- $imageType = Mage::getStoreConfig('algoliasearch/image/type');
- $imageWidth = Mage::getStoreConfig('algoliasearch/image/width');
- $imageHeight = Mage::getStoreConfig('algoliasearch/image/height');
- $ids = Mage::getModel('catalog/product')->getCollection()
- ->addAttributeToFilter('status', array('eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED))
- ->addFieldToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)
- ->getAllIds();
- foreach ($ids as $id) {
- $product = Mage::getModel('catalog/product')->load($id);
- echo $product->getSku(), PHP_EOL;
- echo Mage::helper('algoliasearch/image')->init($product, 'thumbnail')->resize(75, 75)->toString(), PHP_EOL;
- echo Mage::helper('algoliasearch/image')->init($product, $imageType)->resize($imageWidth, $imageHeight)->toString(), PHP_EOL;
- }
- }
- }
- $shell = new Namespace_Shell_ImageCache();
- $shell->run();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement