I passed some data in session in success.phtml to get it in order_new.phtml email template, all goes well except the value that i get is that of the previous session !. I think the email it sends before I retrieve the data. Exemple: instead to get 104, i get 103.

Have you an idea how to handle this case.


<?php Mage::getSingleton('core/session')->setData('my-code', $code); ?>


<?php Mage::getSingleton('core/session')->getData('my-code'); ?>


<td>{{block type="core/template" area="frontend" template="email/code.phtml"}}</td>

You can use magento registery instead of session

Mage::register('name-of-registry-key', $your-data);//set data

$var = Mage::registry('name-of-registry-key');//get data

Mage::unregister('name-of-registry-key');//unset data
  • it doesn't work @Murtuza Zabuawala, i can't registry the data in code.phtml when i Mage::log the registry in the same file success.phtml i get it but not in the other. – PЯINCƏ Mar 9 '17 at 11:20
  • i find that it's normal that the registry not work because i retrieve my data from another page(is not persisted), this is why i used getData (is persisted) – PЯINCƏ Mar 9 '17 at 15:12

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.