コード例 #1
0
ファイル: Data.php プロジェクト: natxetee/magento2
 /**
  * Render payment information block
  *
  * @param  Mage_Payment_Model_Info $info
  * @param  int $storeId
  * @return string
  * @throws Exception
  */
 public function getInfoBlockHtml(Mage_Payment_Model_Info $info, $storeId)
 {
     /** @var $appEmulation Mage_Core_Model_App_Emulation */
     $appEmulation = Mage::getSingleton('Mage_Core_Model_App_Emulation');
     $initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);
     try {
         // Retrieve specified view block from appropriate design package (depends on emulated store)
         $paymentBlock = $info->getBlockMock() ?: $this->getInfoBlock($info);
         $paymentBlock->setArea(Mage_Core_Model_App_Area::AREA_FRONTEND)->setIsSecureMode(true);
         $paymentBlock->getMethod()->setStore($storeId);
         $paymentBlockHtml = $paymentBlock->toHtml();
     } catch (Exception $exception) {
         $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
         throw $exception;
     }
     $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
     return $paymentBlockHtml;
 }