Created
March 11, 2014 14:41
-
-
Save code-poel/9487167 to your computer and use it in GitHub Desktop.
Magento App Emulation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once('app/Mage.php'); | |
Mage::app(); | |
$stores = array_map(function($store) { | |
return $store->getId(); | |
}, Mage::app()->getStores(true)); | |
foreach ($stores as $store_id) { | |
// Setup app emulation | |
$appEmulation = Mage::getSingleton('core/app_emulation'); | |
$initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($store_id); | |
// Load up an emulated category | |
$cat = Mage::getModel('catalog/category')->load(3); | |
// Output the URL | |
echo $cat->getUrl() . PHP_EOL; | |
// Turn off emulation | |
$appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks! you save my day!