2

I am devoloping a module in which I am creating separate account which not using anything of customer. I am not able to create a separate session for my module . I tried to study customer module's session.php but i didn't get it. I am not understanding this code :

public function __construct()
{
    $namespace = 'customer'; 
}

Also Please Guide me how can i achieve it , Any help will be appreciable.

  • create you own session same as customer just change namespace to your module – Minesh Patel Apr 16 '16 at 12:18
  • can i give any name here – PRashant PUrohit Apr 16 '16 at 12:20
  • 1
    yes. basically it will store as $_SESSION[$namespace] – Minesh Patel Apr 16 '16 at 12:21
  • ok sir thank you very much it cleared my doubt please suggest me any link or blog to read related to magento session – PRashant PUrohit Apr 16 '16 at 12:22
  • just google magento session handling – Minesh Patel Apr 16 '16 at 12:24
2

credits : Illia Pushnov

for customer namespace, you can check here : app/code/core/Mage/Customer/Model/Session.phpFile.

it is namespace of your model, it holds for usage it like Mage::getModel('customer/session).

So if your module named yourCompany_yourModel , you registered your yourCompany_yourModel model prefix in config.xml and created constructor as above in app/code/local/yourCompany/yourModel/Model/Session.php

if you make

    public function __construct()
    {
        $namespace = 'yourModule'; 
        $this->init($namespace);
    }

then you can use it in your code like:

Mage::getSingleton('yourModule/session')->setYourVariable($yourVar);

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.