3

I want to know what is app emulation in magento... I saw its forcefully set store id ....in store...but why this is use in magento.. I use this in my project..but i want to know Detail about App Emulation..

$appEmulation = Mage::getSingleton('core/app_emulation');

    $initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation(0);
    $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
11

One of the biggest feature Magento is famous for is its capabilities to develop multi-store and multi-language web stores. Each store can be completely different from its fellow stores. Store Emulation helps developers to emulate any store programmatically.

Suppose you want to send custom transactional e-mail for all stores at the same time as cronjob. When a process run on backend for example cron jobs or email notifications, these processes work under admin store. But suppose if you want to send transactional e-mail on store wise, then email template need grab from store view. You can enable App Emulation and perform this action.

Ex:
    $storeId = 1;
    $appEmulation = Mage::getSingleton('core/app_emulation');

    // Start environment emulation of the specified store
    $initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);

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

    // Stop environment emulation and restore original store
    $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
| improve this answer | |
  • What if we use Mage::app()->setCurrentStore($order->getStoreId()); to send list of products in an order and send email through observer. would this be the same as emulation? – R T Jun 25 '18 at 5:43
  • How can i maintain different QTY in same sku in magento multi-store? – zus Sep 28 '18 at 9:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.