Skip to content

Instantly share code, notes, and snippets.

@evgv
Last active November 22, 2016 09:16
Show Gist options
  • Save evgv/f812df5d560aef8d9b5f to your computer and use it in GitHub Desktop.
Save evgv/f812df5d560aef8d9b5f to your computer and use it in GitHub Desktop.
Magento. Environment emulation.

Environment emulation

  // init app emulation model
  $appEmulation = Mage::getSingleton('core/app_emulation'); 
  
  // Start environment emulation of the specified store
  $initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($store_id); 

  /**
   * Any code thrown here will be executed as we are currently running that store
   * with applied locale, design and similar
   */

  // Stop environment emulation and restore original store
  $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo); 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment