/** * Get the store id for the order. In non-admin stores, can use the current * store. In admin stores, must get the order the quote is actually * being created in. * @return int */ protected function _getStoreId() { $storeEnv = Mage::app()->getStore(); if ($storeEnv->isAdmin()) { /** @var Mage_Adminhtml_Model_Session_Quote */ $quoteSession = $this->_factory->getAdminQuoteSessionModel(); // when in the admin, the store id the order is actually being created // for should be used instead of the admin store id - should be // available in the session $storeEnv = $quoteSession->getStore(); } return $storeEnv->getId(); }