1

I need to create function in magento for set session data and getSession data ... I created on e but this is not working ..

public function mySession($data){

        $_session = Mage::getModel('core/session');

        $_session->set($data);

        }

how can we write session function for set and gat

Hemant Raj
  • 35
  • 5
  • you can reffer this link [here][1] [1]: http://stackoverflow.com/questions/3340982/how-do-i-save-value-in-my-own-session-variable-in-magento – Shivananda Chary Nov 09 '14 at 12:45

1 Answers1

0

You can write your function like

    public function mySession($custom_variable, $data){
  Mage::getSingleton('core/session')->setData($custom_variable, $data);
        }  
   public function getMySession($custom_variable){  
  Mage::getSingleton('core/session')->getData($custom_variable);
        }